* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.db-status {
    font-size: 0.85rem;
    margin-top: 10px;
    padding: 5px 15px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    display: inline-block;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.3);
}

.tab-btn.active {
    background: white;
    color: #667eea;
    font-weight: bold;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input, 
.form-group select,
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    resize: vertical;
    font-family: monospace;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* QR Reader */
#qr-reader {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    border-radius: 10px;
    overflow: hidden;
}

#qr-reader video {
    border-radius: 10px;
}

.result-box {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    min-height: 50px;
    border-left: 4px solid #667eea;
}

.result-box:empty {
    display: none;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filters input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

.filters select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    min-width: 150px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 8px;
}

/* Stats */
.stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stat {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.stat.valid { background: #d4edda; color: #155724; }
.stat.expiring { background: #fff3cd; color: #856404; }
.stat.expired { background: #f8d7da; color: #721c24; }
.stat.total { background: #e2e3e5; color: #383d41; }

/* Drug List */
.drug-list {
    max-height: 500px;
    overflow-y: auto;
}

.drug-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.drug-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.drug-item.expired {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.drug-item.expiring {
    border-left-color: #ffc107;
    background: #fffef5;
}

.drug-item input[type="checkbox"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.drug-info {
    flex: 1;
}

.drug-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 5px;
}

.drug-details {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.drug-details span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.drug-expiry {
    font-weight: bold;
}

.drug-expiry.expired { color: #dc3545; }
.drug-expiry.expiring { color: #ffc107; }
.drug-expiry.valid { color: #28a745; }

.drug-actions {
    display: flex;
    gap: 10px;
}

.drug-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-edit:hover {
    background: #5a6fd6;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* Bulk Actions */
.bulk-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-label {
    display: inline-block;
    cursor: pointer;
}

.info {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    transform: translateX(150%);
    transition: transform 0.3s;
    z-index: 1000;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success { background: #28a745; }
.notification.error { background: #dc3545; }
.notification.warning { background: #ffc107; color: #333; }
.notification.info { background: #17a2b8; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #888;
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-radius: 8px;
    }
    
    .drug-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .drug-actions {
        margin-top: 10px;
        width: 100%;
    }
    
    .drug-actions button {
        flex: 1;
    }
    
    .stats {
        justify-content: center;
    }
    
    .filters {
        flex-direction: column;
    }
}

/* Scrollbar */
.drug-list::-webkit-scrollbar {
    width: 8px;
}

.drug-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.drug-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 8px;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions button {
    flex: 1;
}

/* Summary List Styles */
.summary-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.summary-list {
    max-height: 600px;
    overflow-y: auto;
}

.summary-group {
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    border-left: 4px solid #667eea;
}

.summary-group.has-expired {
    border-left-color: #dc3545;
}

.summary-group.has-expiring {
    border-left-color: #ffc107;
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.summary-header:hover {
    background: #e9ecef;
}

.summary-header .drug-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
    flex: 1;
}

.summary-header .badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-header .badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.total {
    background: #e2e3e5;
    color: #383d41;
}

.badge.valid {
    background: #d4edda;
    color: #155724;
}

.badge.expiring {
    background: #fff3cd;
    color: #856404;
}

.badge.expired {
    background: #f8d7da;
    color: #721c24;
}

.summary-header .toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s;
    margin-left: 10px;
}

.summary-group.open .toggle-icon {
    transform: rotate(180deg);
}

.summary-details {
    display: none;
    padding: 0 15px 15px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.summary-group.open .summary-details {
    display: block;
}

.summary-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin-top: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
}

.summary-detail-item.expired {
    background: #fff5f5;
    border-left: 3px solid #dc3545;
}

.summary-detail-item.expiring {
    background: #fffef5;
    border-left: 3px solid #ffc107;
}

.summary-detail-item .detail-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex: 1;
}

.summary-detail-item .detail-info span {
    font-size: 0.85rem;
    color: #666;
}

.summary-detail-item .detail-expiry {
    font-weight: bold;
}

.summary-detail-item .detail-expiry.expired {
    color: #dc3545;
}

.summary-detail-item .detail-expiry.expiring {
    color: #ffc107;
}

.summary-detail-item .detail-expiry.valid {
    color: #28a745;
}
