/* Dashboard KPI Cards */
.kpi-cards-container {
    display: flex;
    gap: 1.25rem;
    justify-content: space-between;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.kpi-card {
    flex: 1 1 0;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1.5px solid #e0e0e0;
}
.kpi-card:hover {
    box-shadow: 0 6px 18px rgba(52,152,219,0.10);
    transform: translateY(-2px) scale(1.02);
}
.kpi-label {
    font-size: 1.05rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-align: center;
}
.kpi-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    text-align: center;
    letter-spacing: 1px;
}
.kpi-desc {
    font-size: 0.95rem;
    color: var(--light-text);
    text-align: center;
    margin-top: 0.25rem;
}
/* Custom style for multiple select input (previouslyOnDrug) */
#previouslyOnDrug[multiple] {
    min-height: 120px;
    max-height: 220px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--dark-text);
    padding: 0.5rem 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    outline: none;
    width: 100%;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}
#previouslyOnDrug[multiple]:focus {
    border-color: var(--primary-color);
}
#previouslyOnDrug[multiple] option {
    padding: 6px 12px;
    font-size: 1rem;
    background: #fff;
    color: #222;
    border-radius: 6px;
    margin: 2px 0;
}
/* Restrict patient status distribution chart to its grid/container */
#patientStatusDoughnut {
    width: 100% !important;
    max-width: 400px;
    height: auto !important;
    display: block;
    margin: 0 auto;
    box-sizing: border-box;
}
/* Force white color for Epilepsy Management System header */
h1,
.system-header h1 {
    color: #fff !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.32);
}
/* Ensure all form labels, input placeholders, and headings are visible on light backgrounds */
label, .form-label, .login-form label, .add-patient-form label {
    color: #222 !important;
    font-weight: 500;
}

input, select, textarea {
    color: #222;
    background-color: #fff;
}

input::placeholder, textarea::placeholder {
    color: #888 !important;
    opacity: 1;
}

h1, h2, h3, h4, h5, h6 {
    color: #222 !important;
}

/* For Nepali/Hindi/other language labels, ensure color is also set */
.form-label[lang], label[lang] {
    color: #222 !important;
}
/* Clinical Decision Support Alert Styles */
.dose-adequate {
    background-color: rgba(40,167,69,0.25) !important;
    color: var(--dark-text) !important;
    font-weight: 600;
    position: relative;
    border-left: 4px solid #28a745;
}
.dose-inadequate {
    background-color: rgba(220,53,69,0.18) !important;
    color: var(--dark-text) !important;
    font-weight: 600;
    position: relative;
    border-left: 4px solid #dc3545;
}
.dose-excessive {
    background-color: rgba(253,126,20,0.18) !important;
    color: var(--dark-text) !important;
    font-weight: 600;
    position: relative;
    border-left: 4px solid #fd7e14;
}
.dose-suboptimal {
    background-color: rgba(255,193,7,0.18) !important;
    color: var(--dark-text) !important;
    font-weight: 600;
    position: relative;
    border-left: 4px solid #ffc107;
}
.dose-adequacy-icon {
    margin-left: 6px;
    font-size: 1em;
    vertical-align: middle;
    opacity: 0.85;
}
.cds-no-alerts {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Unified CDS Section Styles */
.cds-section {
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.cds-section h5 {
    margin: 0;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.cds-section .alert {
    margin: 10px 16px;
    border-radius: 6px;
}

.cds-section .alert:last-child {
    margin-bottom: 16px;
}

/* Screening Tool Styles */
.screening-tool-container {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.screening-tool-title {
    color: #2c5aa0;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.screening-instructions {
    background: #fff;
    border-left: 4px solid #17a2b8;
    padding: 10px 12px;
    margin-bottom: 16px;
    font-style: italic;
    color: #495057;
}

.screening-questions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.screening-question {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
}

.screening-question label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #212529;
}

.screening-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.screening-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #495057;
}

.screening-option:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.screening-option input[type="radio"] {
    margin: 0;
}

.screening-option input[type="radio"]:checked + * {
    color: #2c5aa0;
}

.screening-scoring {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 12px;
    margin-top: 16px;
}

.screening-scoring strong {
    color: #856404;
    display: block;
    margin-bottom: 8px;
}

.screening-scoring ul {
    margin: 0;
    padding-left: 20px;
}

.screening-scoring li {
    color: #856404;
    margin-bottom: 4px;
}

.alert-next-steps {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    padding: 12px;
    margin-top: 12px;
    border-radius: 4px;
}

.alert-next-steps strong {
    color: #0c5460;
    display: block;
    margin-bottom: 8px;
}

.alert-next-steps ol {
    margin: 0;
    padding-left: 20px;
}

.alert-next-steps li {
    color: #0c5460;
    margin-bottom: 6px;
}

.alert-references {
    background: #e7f3ff;
    border-left: 4px solid #007bff;
    padding: 12px;
    margin-top: 12px;
    border-radius: 4px;
}

.alert-references strong {
    color: #004085;
    display: block;
    margin-bottom: 8px;
}

.alert-references ul {
    margin: 0;
    padding-left: 20px;
}

.alert-references li {
    color: #004085;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.alert-body {
    padding: 10px 0;
    color: #495057;
    line-height: 1.5;
}

.alert-rationale strong {
    font-weight: 600;
    color: #212529;
}

.cds-action-section {
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    margin: 0;
}

/* Streamlined Medication Interface */
.streamlined-medication-interface {
    background: #fff;
    border-radius: 8px;
    padding: 0;
}

/* Ultra-Compact Safety Pills */
.safety-pills-container {
    animation: slideIn 0.3s ease-out;
}

.safety-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 15px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 70px;
    justify-content: center;
}

.safety-pill:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.safety-pill i {
    font-size: 11px;
    opacity: 0.7;
}

.safety-pill.checked {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
    color: white;
    font-weight: 600;
}

.safety-pill.checked i {
    opacity: 1;
    animation: checkPulse 0.3s ease-out;
}

@keyframes checkPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Offline Mode Styles */
body.offline-mode {
    filter: saturate(0.8);
}

body.offline-mode::before {
    content: '';
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 107, 107, 0.02);
    pointer-events: none;
    z-index: 1;
}

.offline-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    position: relative;
}

.offline-disabled::after {
    content: '\f1eb';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    color: #ff6b6b;
    font-size: 12px;
    text-decoration: line-through;
}

#global-offline-banner {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Structured Data Entry Styles */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.checkbox-label span {
    font-weight: 500;
    color: #495057;
}

.medication-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.medication-item-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.medication-item-group label {
    font-weight: 600;
    color: #2c5aa0;
    font-size: 0.9rem;
}

.medication-item-group select,
.medication-item-group input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.medication-item-group select:focus,
.medication-item-group input:focus {
    outline: 0;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Compact Breakthrough Seizure Checklist (Alternative Style) */
.safety-checklist-compact {
    animation: slideIn 0.3s ease-out;
}

.safety-check-item {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(240, 198, 116, 0.3);
    border-radius: 20px;
    padding: 6px 12px;
    margin: 2px;
    font-size: 0.85em;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.safety-check-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #f0c674;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.safety-check-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.safety-check-item .checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid #856404;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.safety-check-item input[type="checkbox"]:checked ~ .checkmark {
    background: #28a745;
    border-color: #28a745;
}

.safety-check-item input[type="checkbox"]:checked ~ .checkmark::after {
    content: "✓";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
    font-weight: bold;
}

.safety-check-item input[type="checkbox"]:checked ~ .check-text {
    color: #28a745;
    font-weight: 600;
}

.check-text {
    color: #856404;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breakthrough-checklist-compact {
    animation: slideIn 0.3s ease-out;
}

.breakthrough-checklist-compact h5 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breakthrough-checklist-compact label {
    transition: background-color 0.2s ease;
    padding: 5px;
    border-radius: 4px;
}

.breakthrough-checklist-compact label:hover {
    background-color: rgba(255, 193, 7, 0.1);
}

.inline-guidance {
    padding: 5px 8px;
    border-radius: 4px;
    background-color: rgba(40, 167, 69, 0.1);
    border-left: 3px solid #28a745;
    animation: fadeInUp 0.3s ease-out;
}

.loading-spinner {
    animation: pulse 1.5s ease-in-out infinite;
}

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

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Epilepsy Type Classification UI */
#epilepsyTypeSection {
    transition: all 0.3s ease;
}

#epilepsyTypeSection .classification-help {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #007bff;
}

#epilepsyTypeSection .status-indicator {
    background: #d4edda;
    color: #155724;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

/* Follow-up Frequency Selector - COMPACT */
.frequency-selector {
    position: relative;
    min-width: 150px;
    text-align: right;
    z-index: 20002;
}

.frequency-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 3px;
    gap: 4px;
}

.frequency-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    min-width: 100px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.frequency-button:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.frequency-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    z-index: 1000;
    min-width: 150px;
    margin-top: 2px;
}

.frequency-option {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.frequency-option:last-child {
    border-bottom: none;
}

.frequency-option:hover {
    background: #f8f9fa;
}

.frequency-option i {
    margin-right: 8px;
    width: 14px;
    color: var(--primary-color);
}

.frequency-option span {
    font-weight: 500;
    margin-right: auto;
}

.frequency-option small {
    color: #666;
    font-size: 0.7rem;
}

.frequency-status {
    margin-top: 3px;
    padding: 4px 8px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modal-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 8px;
    position: relative;
}

#followUpModal .modal-close {
    position: static;
    float: right;
    margin-left: 10px;
}

.cds-severity-section {
    margin-bottom: 20px;
}

.cds-severity-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f8f9fa;
    border-left: 4px solid #dee2e6;
}

.cds-high .cds-severity-header {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.cds-medium .cds-severity-header {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.cds-info .cds-severity-header {
    background: #d1ecf1;
    border-left-color: #17a2b8;
    color: #0c5460;
}

.cds-alert {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.cds-alert:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.cds-alert-high {
    border-left: 4px solid #dc3545;
}

.cds-alert-medium {
    border-left: 4px solid #ffc107;
}

.cds-alert-info {
    border-left: 4px solid #17a2b8;
}

.cds-alert-low {
    border-left: 4px solid #28a745;
}

.cds-alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
}

.cds-alert-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.cds-alert-actions {
    display: flex;
    gap: 8px;
}

.cds-ack-btn {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cds-ack-btn:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.cds-alert-content {
    padding: 16px;
}

.cds-alert-description {
    margin-bottom: 12px;
    color: #495057;
    line-height: 1.5;
}

.cds-alert-rationale {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #6c757d;
}

.cds-alert-recommendations {
    margin-top: 12px;
}

.cds-alert-recommendations strong {
    color: #495057;
}

.cds-alert-recommendations ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.cds-alert-recommendations li {
    margin-bottom: 4px;
    color: #495057;
    line-height: 1.4;
}

.cds-acknowledged {
    opacity: 0.6;
    border-color: #28a745;
}

.cds-acknowledged .cds-alert-header {
    background: #d4edda;
}

.cds-acknowledged .cds-alert-title::after {
    content: " ✓ Acknowledged";
    font-size: 0.8rem;
    color: #155724;
    font-weight: normal;
}

/* Responsive CDS alerts */
@media (max-width: 768px) {
    .cds-alert-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cds-alert-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .cds-ack-btn {
        flex: 1;
        max-width: 100px;
    }
}

/* Referral Workflow Styles */
.referral-summary-box {
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.referral-summary-box {
    color: #000; /* Ensure all text is black by default */
}

.referral-summary-box p,
.referral-summary-box .summary-label,
.referral-summary-box .summary-value,
.referral-summary-box h4,
.referral-summary-box strong {
    color: #000 !important; /* Force black text for all elements */
    margin: 0 0 8px 0;
}

.referral-summary-box p:last-child {
    margin-bottom: 0;
}

.referral-summary-box p:last-child {
    margin-bottom: 0;
}

.breakthrough-checklist {
    background: #e8f4fd;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.breakthrough-checklist h4 {
    color: var(--primary-color);
    margin-top: 0;
}

.dosage-aid {
    background: #e8f5e9;
    border-left: 4px solid var(--success-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Referral Patient List Styles */
.referral-queue-header {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

.referral-queue-header h3 {
    margin: 0 0 0.5rem 0;
    color: var(--secondary-color);
    font-weight: 600;
}

.referral-queue-header p {
    color: var(--light-text);
    margin-bottom: 1rem;
}

.referral-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.referral-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.referral-card.tertiary {
    border-left-color: var(--warning-color);
}

.referral-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.referral-card-header {
    padding: 1.25rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.patient-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.patient-info h4 {
    margin: 0;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.patient-id {
    color: var(--light-text);
    font-size: 0.9rem;
    background: #f5f5f5;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

.referral-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.days-ago {
    font-size: 0.85rem;
    color: var(--success-color);
    background: rgba(39, 174, 96, 0.1);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.days-ago.urgent {
    color: var(--danger-color);
    background: rgba(231, 76, 60, 0.1);
}

.seizure-freq {
    font-size: 0.85rem;
    color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.referral-card-body {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.patient-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--medium-text);
    font-size: 0.95rem;
}

.patient-details div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.patient-details i {
    color: var(--primary-color);
    width: 16px;
    text-align: center;
}

.referral-reason {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.current-meds {
    background: #e8f4fd;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-top: 1rem;
}

.referral-card-actions {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tertiary-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--warning-color);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .referral-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .referral-meta {
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }
    
    .patient-details {
        grid-template-columns: 1fr;
    }
    
    .referral-card-actions {
        flex-direction: column;
    }
    
    .tertiary-badge {
        margin-left: 0;
        justify-content: center;
    }
}

/* CSS Variables for consistent theming */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #f8f9fa;
    --dark-text: #222;
    --medium-text: #444;
    --light-text: #7f8c8d;
    --hindi-blue: #1e3a8a;
    --border-radius: 12px;
    --box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* Light reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ensure all text in the patient education center is dark for readability */
#patientEducationCenter {
    background: #fff !important;
    color: var(--dark-text) !important;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    padding: 1rem;
    margin-bottom: 1rem;
}
#patientEducationCenter * {
    color: var(--dark-text) !important;
}

/* Consistent text colors for medication elements */
#breakthroughChecklist, #breakthroughChecklist *,
.medication-item-group label,
.medication-item-group .hindi-translation {
    color: var(--dark-text) !important;
}

/* Ensure all drug names are visible on any background */
.medication-item-group label {
    font-weight: 500;
}

/* Critical Alerts Section */
#criticalAlertsSection {
    margin-bottom: 2rem;
    transition: var(--transition);
    border-radius: var(--border-radius);
    overflow: hidden;
}

#criticalAlertsHeader {
    padding: 1rem 1.5rem;
    background-color: #fff5f5;
    border-left: 5px solid var(--danger-color);
    transition: var(--transition);
}

#criticalAlertsHeader:hover {
    background-color: #ffebee;
}

#criticalAlertsHeader h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: var(--danger-color);
    font-weight: 600;
}

#criticalAlertsToggle {
    transition: transform 0.3s ease;
    color: var(--danger-color);
}

#criticalAlertsContent {
    background-color: white;
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}

#criticalAlertsList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: var(--transition);
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-item:hover {
    background-color: #f9f9f9;
}

.alert-item i {
    font-size: 1.25rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.alert-item.high i { color: var(--danger-color); }
.alert-item.medium i { color: var(--warning-color); }
.alert-item.low i { color: var(--primary-color); }

.alert-content {
    flex: 1;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.alert-title {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 1rem;
}

.alert-phc {
    font-size: 0.75rem;
    background-color: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    color: var(--medium-text);
}

.alert-desc {
    font-weight: 500;
    color: var(--dark-text);
    margin-bottom: 0.25rem;
}

.alert-details {
    font-size: 0.875rem;
    color: var(--medium-text);
    margin-bottom: 0.25rem;
.patient-card .card-details .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--light-bg);
    border-radius: 12px;
    margin-bottom: 10px;
    border: none;
}
.patient-card .card-details .detail-item:last-child {
    margin-bottom: 0;
}
    padding: 1.5rem;
    text-align: center;
    color: var(--light-text);
    font-style: italic;
}

/* Badge for alert count */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    padding: 0 0.5rem;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--dark-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Main container styles */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
}

.system-header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.system-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.625rem;
}

.system-header p {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

.system-header i {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    background: white;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.login-card {
    background: white;
    border-radius: var(--border-radius);
        padding: 1.25rem 1.25rem 1.25rem 1.25rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--primary-color), var(--danger-color), var(--warning-color), var(--success-color));
}

.login-logo {
    text-align: center;
    margin-bottom: 1rem;
}

.login-logo h2 {
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
    font-size: 1.75rem;
}

.login-logo p {
    color: var(--light-text);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

/* Form styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-width: 100%;
}

/* Follow-up form specific styling for better layout */
#followUpForm.form-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* For very wide screens, use 3 columns */
@media (min-width: 1400px) {
    .form-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    #followUpForm.form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* For large screens, use 2 columns */
@media (min-width: 1200px) and (max-width: 1399px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* For tablet screens, maintain single column */
@media (min-width: 768px) and (max-width: 1199px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    #followUpForm.form-grid {
        grid-template-columns: 1fr;
    }
}

/* For mobile screens, single column */
@media (max-width: 767px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    #followUpForm.form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.seizure-helper-card {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: #f0f7ff;
    border: 1px solid #cfe2ff;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.seizure-helper-card strong {
    color: #0f5ad3;
    font-size: 0.9rem;
}

.seizure-helper-card p {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: #495057;
}

.seizure-helper-card .btn {
    white-space: nowrap;
}

.form-group label {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.label-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    display: block;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--dark-text);
    background: #fff;
    transition: var(--transition);
}

.form-group textarea {
    min-height: 70px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

/* Scope: Slightly reduce form sizes only inside follow-up modal - COMPACT */
#followUpModal .form-group label {
    font-size: 0.85rem;
    color: var(--dark-text);
    margin-bottom: 0.2rem;
}
#followUpModal .form-group input,
#followUpModal .form-group select,
#followUpModal .form-group textarea {
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100%;
    transition: border-color 0.2s ease;
}

#followUpModal .form-group select {
    height: auto;
    min-height: 38px;
}

#followUpModal .form-group input:focus,
#followUpModal .form-group select:focus,
#followUpModal .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group input.error {
    border-color: var(--danger-color);
    background: #fdecea;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.3125rem;
    display: none;
}

/* Form section headers - Collapsible on all devices */
.form-section-header {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin: 0.5rem 0 0 0;
    padding: 0.6rem 1rem;
    border-radius: 6px 6px 0 0;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.form-section-header:hover {
    background: linear-gradient(90deg, #2980b9, #1a252f);
}

.form-section-header.collapsed {
    border-radius: 6px;
    margin-bottom: 0.25rem;
}

.form-section-header .section-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.form-section-header .collapse-icon {
    transition: transform 0.3s ease;
    color: white;
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.form-section-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.form-section-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    overflow: hidden;
}

/* Follow-up form specific adjustments - COMPACT */
#followUpForm .form-section-content {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: 0.4rem 0.6rem;
}

/* Follow-up form input and text sizing - COMPACT */
#followUpForm input,
#followUpForm select,
#followUpForm textarea {
    font-size: 0.85rem;
}

#followUpForm label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

#followUpForm .form-group label {
    font-size: 0.82rem;
    font-weight: 500;
}

/* Follow-up form groups - COMPACT single column for better readability */
#followUpForm .form-group {
    margin-bottom: 0.25rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    background: #f9f9f9;
    border-left: 3px solid #e9ecef;
    transition: all 0.2s ease;
}

#followUpForm .form-group:hover {
    border-left-color: var(--primary-color);
    background: #f0f8ff;
}

/* Special styling for important sections */
#followUpForm .form-group[style*="grid-column: 1 / -1"] {
    background: #fff8e1;
    border-left-color: var(--warning-color);
    border-width: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Checkbox sections get special treatment */
#followUpForm .form-group:has(input[type="checkbox"]) {
    background: #e8f5e8;
    border-left-color: var(--success-color);
}

.form-section-content.collapsed {
    display: none;
}

/* Better organization for medication change section - COMPACT */
.medication-change-section {
    background: #f0f8ff;
    border: 1px dashed var(--primary-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.medication-change-section h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 0.3rem;
}

/* Breakthrough checklist styling - COMPACT */
#breakthroughChecklist {
    margin-bottom: 0.75rem !important;
}

#breakthroughChecklist .form-group {
    background: #fff8e1;
    margin-bottom: 0.4rem;
    padding: 0.4rem 0.5rem;
}

/* Side effects container styling - COMPACT */
.side-effects-container {
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
    padding: 0.5rem;
}

.side-effects-container .checkbox-label {
    background: white;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem !important;
    border: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

.form-section-content.no-border {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

/* Follow-up form section headers - COMPACT */
#followUpForm .form-section-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.5rem 0.75rem;
    margin: 0.4rem 0 0 0;
    border-radius: 5px 5px 0 0;
    font-size: 0.95rem;
    border: none;
}

#followUpForm .form-section-header .collapse-icon {
    color: white;
}

/* Better spacing between logical groups - COMPACT */
#followUpForm .form-group + .form-group {
    border-top: 1px solid #e9ecef;
    padding-top: 0.3rem;
    margin-top: 0.15rem;
}

/* Hindi translations in follow-up */
#followUpForm .hindi-translation {
    display: block;
    font-style: italic;
    color: #B8D4FF;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    font-weight: normal;
}

/* Follow-up frequency selector improvements - COMPACT */
#followUpSeizureFrequency {
    font-size: 0.85rem !important;
    padding: 0.5rem !important;
    line-height: 1.3;
    max-height: 180px;
    overflow-y: auto;
}

#followUpSeizureFrequency option {
    padding: 4px 6px;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
    max-width: 100%;
}

/* Better select styling for long options - COMPACT */
#followUpForm select {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
    line-height: 1.3;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
    cursor: pointer;
}

/* All form inputs in follow-up form - COMPACT */
#followUpForm input,
#followUpForm textarea {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 100%;
    transition: border-color 0.2s ease;
}

#followUpForm input:focus,
#followUpForm select:focus,
#followUpForm textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-section-header:first-of-type {
    margin-top: 0;
}

/* Enhanced Hindi translation styling */
.hindi-translation {
    color: #B8D4FF;
    font-size: 0.9rem;
    font-weight: 500;
    font-style: italic;
    margin-top: 2px;
}

/* Role selector */
.role-selector {
    display: flex;
    justify-content: space-between;
    gap: 0.9375rem;
    margin-bottom: 0.25rem;
}

.role-option {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.role-option:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.role-option.active {
    border-color: var(--primary-color);
    background-color: #e3f2fd;
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
}

.role-option i {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.role-option .role-name {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--dark-text);
}

.role-option .role-desc {
    font-size: 0.875rem;
    color: var(--light-text);
    margin-top: 0.3125rem;
}

/* Error highlight for role selector when a selected role is not permitted */
.role-selector.role-error {
    animation: roleErrorPulse 1s ease-in-out 0s 2;
}

@keyframes roleErrorPulse {
    0% { box-shadow: 0 0 0 rgba(231, 76, 60, 0); }
    50% { box-shadow: 0 0 12px rgba(231, 76, 60, 0.25); }
    100% { box-shadow: 0 0 0 rgba(231, 76, 60, 0); }
}

/* Visually indicate a role not permitted option */
.role-option.not-permitted {
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Enhanced button styles */
.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 48px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    border: 2px solid transparent;
}

.btn-primary:not(:disabled):hover {
    background: linear-gradient(135deg, #2980b9, var(--primary-color));
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.25);
}

.btn-secondary {
    background: #f8f9fa;
    color: var(--dark-text);
    border: 2px solid #e1e5e9;
}

.btn-secondary:not(:disabled):hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #219653);
    color: white;
}

.btn-success:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #e67e22);
    color: white;
}

.btn-warning:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(243, 156, 18, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c0392b);
    color: white;
}

.btn-danger:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}

/* Security notice */
.security-notice {
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.security-notice h3 {
    color: var(--secondary-color);
    margin-bottom: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-size: 1.25rem;
}

.security-notice p {
    color: var(--medium-text);
}

/* Dashboard Styles */
.dashboard-container {
    display: none;
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.97);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    position: relative;
    animation: slideIn 0.5s ease-out;
}

.header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    color: white;
    padding: 1.875rem;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 2rem;
    color: #fff !important;
}

.header p {
    font-size: 1.125rem;
}

.nav-tabs {
    display: flex;
    background: var(--light-bg);
    border-bottom: 1px solid #e9ecef;
    overflow-x: auto;
    justify-content: space-evenly;
}

.nav-tab {
    flex: 0 1 auto;
    padding: 0.9375rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--light-text);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    min-width: 120px;
}

.nav-tab:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.nav-tab.active {
    background: white;
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
}

.tab-content {
    padding: 1.875rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.875rem;
}

/* Chart Row Layout */
.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Scope: Compact typography for Follow-up tab */
#follow-up {
    font-size: 0.95rem;
}
#follow-up h3 {
    font-size: 1.25rem;
}
#follow-up .patient-card .patient-name {
    font-size: 1.15rem;
}
#follow-up .action-btn {
    font-size: 0.95rem;
    padding: 12px 20px;
}

.chart-box {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.chart-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.chart-box h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-box h3 i {
    color: var(--primary-color);
}

/* KPI Gauges */
.kpi-gauge {
    position: relative;
    width: 100%;
    height: 200px;
    margin: 0 auto;
}

.kpi-footer {
    text-align: center;
    margin-top: 1rem;
    color: var(--medium-text);
    font-size: 0.9em;
}

/* Critical Alerts */
#criticalAlertsList {
    margin-top: 1rem;
}

.alert-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: #fff8f8;
    border-left: 4px solid var(--danger-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.alert-item:hover {
    transform: translateX(5px);
    background: #fff0f0;
}

.alert-item i {
    color: var(--danger-color);
    font-size: 1.2rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #000;
}

.alert-desc {
    font-size: 0.9rem;
    color: #333;
}

.alert-time {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.25rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    border-left: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.stat-content {
    flex: 1;
    text-align: left;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
    color: var(--secondary-color);
    word-break: break-word;
    overflow-wrap: break-word;
}

.patient-card .card-details .detail-label {
    font-weight: 500;
    color: var(--light-text);
    font-size: 0.9rem;
    min-width: 80px;
}
.patient-card .card-details .detail-value {
    color: var(--secondary-color);
    font-weight: 600;
    text-align: right;
    flex: 1;
}
.stat-card:hover .stat-arrow {
    transform: translateX(5px);
}

/* Special stat card styles */
.stat-card[style*="border-left-color: #e74c3c"] .stat-icon {
    background: rgba(231, 76, 60, 0.1);
}

.stat-card[style*="border-left-color: #e74c3c"] .stat-icon i {
    color: #e74c3c;
}

.stat-card[style*="border-left-color: #f39c12"] .stat-icon {
    background: rgba(243, 156, 18, 0.1);
}

.stat-card[style*="border-left-color: #f39c12"] .stat-icon i {
    color: #f39c12;
}

.stat-card[style*="border-left-color: #7f8c8d"] .stat-icon {
    background: rgba(127, 140, 141, 0.1);
}

.stat-card[style*="border-left-color: #7f8c8d"] .stat-icon i {
    color: #7f8c8d;
}

.stat-card[style*="border-left-color: #3498db"] .stat-icon {
    background: rgba(52, 152, 219, 0.1);
}

.stat-card[style*="border-left-color: #9b59b6"] .stat-icon {
    background: rgba(155, 89, 182, 0.1);
}

.stat-card[style*="border-left-color: #9b59b6"] .stat-icon i {
    color: #9b59b6;
}

/* Animation for stat cards */
@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for stat cards */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        margin-right: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
    }
    
    .stat-number {
        font-size: 1.4rem;
    }
}

/* Improved readability for viewer stat cards */
.stat-card.viewer {
    background: white !important;
    opacity: 0.95;
    filter: grayscale(5%);
}
.stat-card.viewer .stat-number {
    color: #333 !important;
}
.stat-card.viewer .stat-label {
    color: #555 !important;
}
.stat-card.viewer .stat-icon {
    color: #666 !important;
}
.stat-card.viewer .stat-icon i {
    color: #666 !important;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.3125rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

.logout-container {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    z-index: 100;
}

.user-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 0.9375rem;
    border-radius: 20px;
    font-size: 0.875rem;
}

.logout-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.5rem 0.9375rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3125rem;
    transition: var(--transition);
    z-index: 101;
    position: relative;
}

.logout-btn:focus {
    outline: 2px solid white;
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.export-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
    gap: 0.625rem;
}

.deidentified {
    background: var(--light-bg);
    border-radius: var(--border-radius);
    padding: 0.9375rem;
    margin-top: 0.9375rem;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.deidentified i {
    color: var(--primary-color);
    font-size: 1.125rem;
}

.deidentified div {
    color: var(--medium-text);
}

/* Chart containers */
.chart-container {
    display: flex;
    gap: 1.25rem;
    margin-top: 1.875rem;
    flex-wrap: wrap;
}

.chart-box {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    animation: fadeIn 0.5s ease-out;
}

.chart-box h3 {
    color: var(--secondary-color);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.25rem;
}

/* Management subtabs and analytics improvements */
.management-subtabs .management-subtab {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 8px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.management-subtabs .management-subtab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.management-subtabs .management-subtab:focus {
  outline: 3px solid rgba(52,152,219,0.25);
  outline-offset: 2px;
}

/* Active tab stronger appearance */
.management-subtabs .management-subtab.active {
  background: linear-gradient(135deg, #1f78b4, #0c5f90);
  color: white !important;
  box-shadow: 0 8px 24px rgba(16, 66, 102, 0.14);
  transform: translateY(-2px);
  border: 1px solid rgba(0,0,0,0.06);
}

/* Analytics container grid */
#mg-analytics #managementAnalyticsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* Analytics card */
.analytics-card {
  background: linear-gradient(180deg, #fff, #fbfdff);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  min-height: 160px;
  display:flex;
  flex-direction:column;
  gap: 0.5rem;
}

/* Chart title inside card */
.analytics-card h5 {
  margin: 0;
  color: var(--secondary-color);
  font-weight: 700;
}

/* Responsive tweak */
@media (max-width: 520px) {
  .management-subtabs { gap: 6px; }
  .management-subtabs .management-subtab { font-size: 0.9rem; padding: 0.5rem; min-height: 36px; }
  #mg-analytics #managementAnalyticsContainer { grid-template-columns: 1fr; }
}

/* Patient cards */
.patient-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5625rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: var(--transition);
    cursor: pointer;
    animation: slideInCard 0.5s ease-out;
    animation-fill-mode: backwards;
}

.patient-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.patient-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Search */
.search-container {
    margin-bottom: 1.25rem;
    position: relative;
}

/* Remove margin when search is in the follow-up filters row */
.follow-up-filters .search-container {
    margin-bottom: 0;
}

.search-container input {
    width: 100%;
    padding: 0.9375rem 0.9375rem 0.9375rem 2.8125rem;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1.125rem;
    transition: var(--transition);
}

.search-container input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
}

.search-container i {
    position: absolute;
    left: 0.9375rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light-text);
}

/* Patient detail */
.patient-detail {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.875rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: none;
}

.patient-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5625rem;
    padding-bottom: 0.9375rem;
    border-bottom: 2px solid var(--light-bg);
}

.patient-header h2 {
    color: var(--primary-color);
    font-size: 1.75rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5625rem;
}

.detail-item {
    background: var(--light-bg);
    padding: 0.9375rem;
    border-radius: var(--border-radius);
}

.detail-item h4 {
    color: var(--medium-text);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.detail-item p {
    font-size: 1.125rem;
    color: var(--dark-text);
    font-weight: 500;
}

.medication-grid {
    display: flex;
    gap: 0.9375rem;
    flex-wrap: wrap;
    margin-bottom: 1.5625rem;
}

.medication-item {
    background: #e3f2fd;
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.history-container {
    margin-top: 1.5625rem;
}

.history-item {
    padding: 0.9375rem;
    border-left: 3px solid var(--primary-color);
    margin-bottom: 0.9375rem;
    background: var(--light-bg);
    border-radius: 0 8px 8px 0;
}

.history-item h4 {
    color: var(--secondary-color);
    margin-bottom: 0.3125rem;
}

.history-item p {
    color: var(--medium-text);
}

/* Empty state for history/follow-ups - ensure high contrast and readable spacing */
.history-container p {
    color: var(--dark-text);
    background: rgba(255,255,255,0.85);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    display: inline-block;
    margin: 0.25rem 0 0.75rem 0;
}

.history-empty {
    color: var(--dark-text) !important;
    background: #fff7e6; /* subtle warm background to denote empty state */
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    display: inline-block;
    font-weight: 600;
}

.back-btn {
    margin-top: 1.25rem;
}

/* Loading indicator */
.loading-indicator {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    /* Make sure the global loader overlays modals (follow-up modal uses z-index:10000) */
    z-index: 50000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    font-size: 1.2rem;
}

/* Ensure modal content inside loading-indicator uses readable dark text */
.loading-indicator .modal-content,
.loading-indicator .modal-content * {
    color: var(--dark-text) !important;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 5px solid white;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Medication grid */
.medication-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 1.25rem;
    margin-bottom: 1.875rem;
    grid-column: 1 / -1;
    width: 100%;
}

/* Medication section should not use parent grid */
#section-content-2 {
    display: block !important;
    grid-template-columns: none !important;
}

.medication-item-group {
    background: #f0f8ff;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.medication-item-group label {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

/* When a modal should be explicitly in front (e.g. helper opened on top of follow-up modal) */
.modal--top {
    z-index: 20010 !important;
}

#followUpModal {
    align-items: flex-start;
    padding-top: 20px;
}

.modal-content {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    width: 95%;
    max-width: 900px;
    text-align: left;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    max-height: 90vh;
    overflow-y: auto;
    margin: 0 auto 30px;
    position: relative;
    border: 1px solid #e1e5e9;
}

/* Make follow-up modal a bit wider like old system */
#followUpModal .modal-content {
    max-width: 1100px;
    padding: 1rem;
}

/* Ensure wide sections span full width in follow-up modal */
#followUpModal #drugDoseVerificationSection,
#followUpModal [id*="Section"],
#followUpModal .full-width {
    grid-column: 1 / -1;
}

/* Support for grid-column: span 2 declarations - now just span 1 for single column */
[style*="grid-column: span 2"] {
    grid-column: span 1;
}

/* Contextual panels within forms */
.warning-box,
[style*="background: #fff3cd"] {
    background: #fff3cd !important;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    color: #000 !important;
}

.info-box,
[style*="background: #e8f4fd"] {
    background: #e8f4fd !important;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    color: #000 !important;
}

@media (max-width: 767px) {
    [style*="grid-column: span 2"] {
        grid-column: span 1;
    }
}

.modal-content h4 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    color: var(--medium-text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20001; /* Ensure above modal content */
    pointer-events: auto;
    touch-action: manipulation;
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    transform: scale(1.05);
}

/* Expand clickable area without changing visual size */
.modal-close::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.report-table th, .report-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}
.report-table th {
    background-color: var(--light-bg);
    color: var(--secondary-color);
    font-weight: 600;
}
.report-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Hindi translations */
.hindi-translation {
    font-size: 0.8em;
    color: var(--hindi-blue);
    font-style: italic;
    font-weight: 600;
}

/* Dialer link */
.dial-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}
.dial-link:hover {
    text-decoration: underline;
}

/* Guidance message */
.guidance-message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 500;
    border-left: 4px solid;
}

/* Success message */
.success-message {
    background: var(--success-color);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    display: none;
    align-items: center;
    gap: 0.5rem;
}

/* Close button for modal */
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Prescribed drugs section - COMPACT */
.prescribed-drugs-section {
    background: #e8f4fd;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    margin-bottom: 0.3rem;
}

.prescribed-drugs-section h4 {
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.drug-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.drug-item {
    background: white;
    padding: 0.2rem 0.4rem;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* Pill-style for prescribed drugs (clickable) - COMPACT */
.prescribed-pill {
    background: #ffffff;
    border: 1px solid #3b82f6;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.1);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-size: 0.85rem;
}
.prescribed-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.18);
    background: #f8fbff;
}
.prescribed-pill:active {
    transform: translateY(0);
}
.prescribed-pill .pill-name {
    font-weight: 700;
    color: #1f3a83;
    font-size: 0.95rem;
}
.prescribed-pill .pill-dosage {
    color: #3b82f6;
    background: #e8f1ff;
    border-radius: 999px;
    padding: 3px 9px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Medication change section */
.medication-change-section {
    display: none;
    grid-column: 1 / -1;
    background: #fff3cd;
    border: 2px solid var(--warning-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.1);
}

/* Enhanced medication form styling */
.medication-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.medication-item-group {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.medication-item-group:hover {
    background: #f0f4f8;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.medication-item-group label {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* Special form sections styling */
.form-group[style*="background"] {
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.form-group[style*="background"]:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.medication-change-section h4 {
    color: var(--warning-color);
    margin-bottom: 1rem;
}

/* Seizure frequency options with descriptions */
.seizure-frequency-option {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.seizure-frequency-option:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.seizure-frequency-option.selected {
    background: #e3f2fd;
    border-color: var(--primary-color);
}

.seizure-frequency-title {
    font-weight: 600;
    color: var(--dark-text);
}

.seizure-frequency-desc {
    font-size: 0.9rem;
    color: var(--medium-text);
    margin-top: 0.25rem;
}

/* Checkbox Styling */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
    margin: 0 10px 0 0;
    vertical-align: middle;
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    border-color: var(--primary-color);
}

/* Side Effects Checklist Styles */
.side-effects-container {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
}

.side-effect-item {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: var(--transition);
}

.side-effect-item:hover {
    background: #f0f7ff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.side-effect-item input[type="checkbox"] {
    flex-shrink: 0;
    margin-right: 12px;
}

.side-effect-item label {
    margin: 0;
    font-size: 1rem;
    color: var(--dark-text);
    cursor: pointer;
    flex-grow: 1;
    display: flex;
    align-items: center;
    line-height: 1.4;
    padding: 2px 0;
    min-height: 24px;
    align-items: center;
}

.side-effect-item .hindi-translation {
    margin-left: 10px;
    font-size: 0.9rem;
    color: var(--hindi-blue);
    font-style: normal;
    font-weight: 500;
    opacity: 0.9;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .side-effects-container {
        grid-template-columns: 1fr !important;
    }
    
    .side-effect-item {
        margin: 6px 0;
        padding: 6px 10px;
    }
}

/* Text visibility improvements for warning and info boxes */
[style*="background: #fff3cd"],
[style*="background: #e8f4fd"] {
    color: #000 !important;
}

[style*="background: #fff3cd"] *,
[style*="background: #e8f4fd"] *,
[style*="background: #fff3cd"] .form-text,
[style*="background: #e8f4fd"] .form-text,
[style*="background: #fff3cd"] .hindi-translation,
[style*="background: #e8f4fd"] .hindi-translation,
.warning-box,
.warning-box *,
.alert-warning,
.alert-warning *,
.alert-info,
.alert-info * {
    color: #000 !important;
}

/* Specific styles for warning boxes with yellow background */
[style*="background: #fff3cd"],
.warning-box,
.alert-warning {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107 !important;
}

/* Specific styles for info boxes with blue background */
[style*="background: #e8f4fd"],
.alert-info {
    background-color: #e8f4fd !important;
    border-left: 4px solid #17a2b8 !important;
}

/* Style for warning text */
.text-warning {
    color: #000 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .role-selector {
        flex-direction: column;
    }
    
    .login-card {
        padding: 1.25rem;
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .logout-container {
        position: relative;
        top: 0;
        right: 0;
        justify-content: center;
        margin-top: 1.25rem;
        flex-direction: column;
        align-items: center;
    }
    
    .system-header h1 {
        font-size: 1.75rem;
    }
    
    .system-header p {
        font-size: 1rem;
    }
    
    .system-header i {
        font-size: 3rem;
        width: 90px;
        height: 90px;
    }
    
    .patient-list {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 1.25rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .chart-container {
        flex-direction: column;
    }
    
    .export-container {
        flex-direction: column;
        align-items: flex-end;
    }
    
    .nav-tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        min-width: auto;
    }
    
    .btn {
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Make headers display properly on mobile - All forms */
    .form-section-header {
        font-size: 0.95rem;
        padding: 0.5rem 0.75rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-height: 48px; /* Touch-friendly */
        transition: all 0.2s ease;
    }
    
    .form-section-header:hover {
        background: linear-gradient(90deg, #2980b9, #1a252f);
    }
    
    /* Add Patient form section headers on mobile - ONLY ON MOBILE */
    #patientForm .form-section-header {
        font-size: 0.95rem;
        padding: 0.6rem 0.75rem;
        min-height: 48px;
    }
    
    /* Add Patient form section content on mobile - ONLY ON MOBILE */
    #patientForm .form-section-content {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }
    
    /* Follow-up form headers stay compact on mobile */
    #followUpForm .form-section-header {
        font-size: 0.9rem;
        padding: 0.45rem 0.6rem;
    }
    
    .form-section-content {
        grid-template-columns: 1fr;
        gap: 0.3rem;
        padding: 0.4rem 0.5rem;
    }
    
    /* Follow-up form sections - responsive grid on mobile */
    #followUpForm .form-section-content {
        grid-template-columns: 1fr;
        gap: 0.2rem;
        padding: 0.3rem 0.5rem;
    }
    
    .form-group {
        margin-bottom: 0.5rem;
    }
    
    /* Mobile-optimized form inputs - Touch-friendly */
    input, select, textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 48px; /* Touch-friendly size */
        padding: 0.6rem 0.75rem;
        border-radius: 6px;
    }
    
    /* Mobile labels - Improved readability */
    label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.4rem;
        display: block;
    }
    
    /* Touch-friendly buttons on mobile */
    .btn {
        min-height: 48px;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        touch-action: manipulation;
    }
    
    /* Sticky form actions on mobile - Enhanced */
    .form-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        border-top: 1px solid #dee2e6;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 100;
        margin: 0 -1rem;
    }
    
    /* Better modal padding on mobile */
    .modal-content {
        padding: 1rem;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    /* Compact CDSS display on mobile */
    #cdssPromptsContainer {
        margin: 0.5rem 0;
        padding: 1rem;
    }
}

/* Very small screens - minimal spacing adjustments */
@media (max-width: 480px) {
    .cdss-prompt-item {
        margin-bottom: 0.5rem;
    }
    
    /* Better mobile modal - COMPACT */
    .modal-content {
        margin: 0.25rem;
        padding: 0.75rem;
        max-height: 96vh;
        overflow-y: auto;
    }
    
    /* Even smaller section headers on very small screens */
    .form-section-header,
    #patientForm .form-section-header {
        font-size: 0.88rem;
        padding: 0.5rem 0.6rem;
    }
    
    /* Single column medication grid */
    .medication-form-grid,
    .medication-item-group {
        grid-template-columns: 1fr !important;
    }
    
    /* Smaller buttons on very small screens */
    .btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    /* Mobile form progress indicator */
    .form-progress {
        margin-top: 0.5rem;
        padding: 0.3rem 0;
    }
    
    .progress-bar {
        width: 100%;
        height: 8px;
        background: #e9ecef;
        border-radius: 4px;
        overflow: hidden;
        margin-bottom: 0.5rem;
    }
    
    .progress-fill {
        height: 100%;
        background: #007bff;
        transition: width 0.3s ease;
        border-radius: 4px;
    }
    
    .progress-text {
        font-size: 0.85rem;
        color: #666;
        text-align: center;
    }
}

@media (max-width: 900px) {
    .chart-box {
        min-width: 100%;
    }
    
    .modal-content {
        width: 98%;
        padding: 12px;
        margin: 5px auto;
        max-height: 92vh;
    }
    
    .patient-card {
        padding: 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .medication-form-grid {
        grid-template-columns: 1fr;
    }

    .injury-modal-content {
        width: 95%;
        max-width: 400px;
        padding: 15px;
    }

    .injury-type-options {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .injury-type-options .btn {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
    }
}

/* Additional mobile improvements */
@media (max-width: 480px) {
    .system-header h1 {
        font-size: 1.5rem;
    }
    
    .login-card {
        padding: 1rem;
    }
    
    .nav-tabs {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-tab {
        flex-shrink: 0;
        min-width: 100px;
    }
    
    .form-group label {
        font-size: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 12px;
    }

    .drug-list {
        flex-direction: column;
    }

    .drug-item {
        text-align: center;
    }

    .seizure-frequency-option {
        padding: 10px;
        margin-bottom: 6px;
    }

    .role-option {
        padding: 15px 12px;
    }

    #followUpModal {
        padding-top: 10px;
    }

    .modal-content {
        margin: 8px;
        padding: 10px;
    }
}

@media (max-width: 900px) {
    .form-group, .form-group[style*="grid-column"] {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }
    .form-section-header {
        grid-column: 1 / -1 !important;
    }
    .form-grid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    .form-group input,
    .form-group select,
    .form-group textarea,
    .form-group button {
        width: 100% !important;
        min-width: 0 !important;
    }
    .btn {
        width: 100% !important;
    }
    #add-patient .chart-box {
        padding: 10px !important;
    }
    .injury-type-options .btn {
        width: 100% !important;
    }
}

/* Injury Modal Styles */
#injury-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}

.injury-modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
}

.injury-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.injury-type-options .btn {
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: 600;
}

/* NEW STYLES for Injury Map */
.injury-map-container {
    grid-column: 1 / -1;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.body-svg-container {
    flex: 1;
    min-width: 200px;
    max-width: 250px;
}
.body-svg path, .body-svg rect {
    fill: #cce5ff;
    stroke: #6699cc;
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill 0.18s ease, transform 0.12s ease, stroke 0.18s ease;
    transform-origin: center center;
}
.body-svg path:hover, .body-svg rect:hover {
    fill: #ffdddd;
    transform: scale(1.04);
}
.body-svg path.selected, .body-svg rect.selected {
    fill: var(--danger-color);
    stroke: #a02b20;
}
.body-svg [tabindex] {
    outline: none;
}
.body-svg [tabindex]:focus {
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.18));
    stroke-width: 2;
}

/* Improve touch hit targets by slightly increasing the clickable area visually */
.body-svg-container svg {
    touch-action: manipulation;
}

/* Selected injuries list animations */
#selected-injuries-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    background: linear-gradient(180deg, #fff, #fafafa);
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
    transform-origin: left center;
    transition: transform 180ms cubic-bezier(.2,.9,.2,1), opacity 180ms ease;
    opacity: 1;
}

#selected-injuries-list li.adding {
    transform: translateX(-8px) scale(0.98);
    opacity: 0.0;
}

#selected-injuries-list li.removing {
    transform: translateX(8px) scale(0.98);
    opacity: 0.0;
}

/* transient tapped feedback */
.body-svg .tapped {
    transform: scale(1.08) !important;
    transition: transform 120ms ease;
}

/* Print styles for patient summary (moved from inline in script.js) */
/* Use .print-content wrapper in the print window */
@page { 
    size: A4;
    margin: 1cm;
}
.print-content {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    padding: 20px;
}
.print-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}
.print-header h2 {
    color: #2c3e50;
    margin: 0;
}
.print-section {
    margin-bottom: 20px;
    page-break-inside: avoid;
}
.print-section h3 {
    color: #3498db;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}
.detail-row {
    display: flex;
    margin-bottom: 8px;
    page-break-inside: avoid;
}
.detail-label {
    font-weight: bold;
    min-width: 200px;
    color: #555;
}
.medication-item {
    background: #f5f9ff;
    border-left: 3px solid #3498db;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
}
.print-timestamp {
    text-align: right;
    color: #777;
    font-size: 0.9em;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}
@media print {
    /* Ensure colors are preserved in print output where possible */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .no-print { display: none !important; }
}

/* Remove button: larger tap target */
#selected-injuries-list .remove-injury {
    background: transparent;
    border: none;
    color: #a02b20;
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
}

#selected-injuries-list .remove-injury:active {
    transform: scale(0.96);
}

/* Ensure the SVG parts enlarge slightly on touch for clarity */
.body-svg path:active, .body-svg rect:active, .body-svg polygon:active {
    transform: scale(1.06);
}
.injury-details-container {
    flex: 2;
    min-width: 250px;
}
#selected-injuries-list {
    list-style-type: none;
    padding: 0;
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
    background: var(--light-bg);
    border-radius: 8px;
    padding: 10px;
}
#selected-injuries-list li {
    background: white;
    padding: 8px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
#selected-injuries-list .remove-injury {
    background: #f1f1f1;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-weight: bold;
}
/* Patient timeline styles */
.timeline { display:flex; flex-direction:column; gap:10px; padding:8px 4px; }
.timeline-item { display:flex; gap:12px; align-items:flex-start; padding:10px; border-radius:8px; background: #fff; border:1px solid rgba(0,0,0,0.04); }
.timeline-date { min-width:120px; color:var(--light-text); font-size:0.9rem; }
.timeline-body { flex:1; }
.timeline-title { font-weight:700; margin-bottom:4px; }
.timeline-details { color:var(--medium-text); font-size:0.95rem; }
.timeline-registration { border-left:4px solid var(--primary-color); }
.timeline-followup { border-left:4px solid #3b82f6; }
.timeline-med-change { border-left:4px solid #10b981; }
.timeline-referral { border-left:4px solid #ef4444; }
.timeline-info { border-left:4px solid var(--light-text); }

.patient-detail-tabs { margin-top:12px; }
.tab-buttons { display:flex; gap:8px; margin-bottom:10px; }
.detail-tab { background:transparent; border:1px solid rgba(0,0,0,0.06); padding:8px 12px; border-radius:6px; cursor:pointer; }
.detail-tab.active { background:var(--light-bg); border-color:var(--primary-color); }
.detail-tab:focus { outline:2px solid rgba(59,130,246,0.2); }
.tab-contents { padding: 0; }
.detail-tab-pane { padding:4px 0; }
@media (max-width: 768px) {
    .injury-map-container {
        flex-direction: column;
    }
    .body-svg-container {
        margin: 0 auto;
    }
}

/* Patient Card Grid Styles */
.patient-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.patient-card {
    background: #fff;
    border-radius: 14px; /* slightly increased for closer old look */
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    padding: 1.5625rem; /* match old style card padding */
}

.patient-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 32px rgba(0,0,0,0.16);
}

.patient-card.completed {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border-color: #10b981;
}

.patient-card.completed .status-badge.completed {
    background: #10b981;
    color: white;
}

.patient-card.due {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
}

.patient-card.due .status-badge.due {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.card-content {
    padding: 0; /* padding moved to .patient-card as per older style */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 0; /* remove divider spacing */
    border-bottom: none; /* closer to older layout */
}

.patient-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0;
    line-height: 1.3;
    flex: 1;
    margin-right: 12px;
}

/* Follow-up frequency setup button */
.card-header .btn-outline-secondary {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    min-width: auto;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-header .btn-outline-secondary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-badge.completed {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.status-badge.due {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.card-details {
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f9fafb;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.875rem;
    min-width: 80px;
}

.detail-value {
    color: #1f2937;
    font-weight: 500;
    text-align: right;
    flex: 1;
}

.phone-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.phone-link:hover {
    text-decoration: underline;
}

.status-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-indicator.new {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-indicator.active {
    background: #dcfce7;
    color: #166534;
}

.status-indicator.referred-to-mo {
    background: #fef3c7;
    color: #92400e;
}

.status-indicator.follow-up {
    background: #e0e7ff;
    color: #3730a3;
}

.referral-notice .detail-label,
.completion-notice .detail-label,
.due-notice .detail-label {
    color: #3b82f6;
    font-weight: 600;
}

.due-notice .detail-label {
    color: #f59e0b;
}

.referral-notice .detail-value {
    color: #3b82f6;
    font-weight: 500;
}

.completion-notice .detail-value {
    color: #10b981;
    font-weight: 500;
}

.card-actions {
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

.action-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    border: none;
    padding: 14px 24px; /* slightly larger like old buttons */
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn:hover {
    background: linear-gradient(135deg, #2c7fbd, #1976d2);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.35);
}

.action-btn:active {
    transform: translateY(0);
}

.text-primary {
    color: #3b82f6;
}

.text-success {
    color: #10b981;
}

.start-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.start-btn:hover {
    background: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.card-details {
    font-size: 0.95rem;
    line-height: 1.5;
}

.detail-row {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.detail-row strong {
    color: var(--dark-text);
    min-width: 80px;
    font-weight: 600;
}

.phone-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.phone-link:hover {
    text-decoration: underline;
}

.patient-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.patient-status.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.patient-status.referred-to-mo,
.patient-status.referred-for-tertiary-care {
    background: #fff3e0;
    color: #f57c00;
}

.patient-status.inactive {
    background: #ffebee;
    color: #c62828;
}

.patient-status.completed {
    background: #d4edda;
    color: #155724;
}

.patient-status.tertiary-care {
    background: #f8d7da;
    color: #721c24;
}

/* Card type-specific styles */
.patient-card.referred {
    border-left: 4px solid #ffc107;
}

.patient-card.tertiary {
    border-left: 4px solid #dc3545;
}

/* Urgency indicators for tertiary care queue */
.patient-card.tertiary-card.high-urgency {
    border-left: 4px solid #dc2626;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.patient-card.tertiary-card.medium-urgency {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.patient-card.tertiary-card.normal-urgency {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.urgency-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f8f9fa;
}

.tertiary-card .patient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.patient-clinical-info {
    background: rgba(0, 0, 0, 0.02);
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
}

.referral-timeline {
    background: #fef3c7;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 3px solid #f59e0b;
}

.patient-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Info sections for different card types */
.card-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.referral-info {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.tertiary-info {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.card-info i {
    color: #856404;
    font-size: 1rem;
}

.tertiary-info i {
    color: #721c24;
}

.card-info strong {
    color: #333;
    display: block;
    margin-bottom: 2px;
}

.card-info small {
    color: #666;
}

/* Enhanced Follow-up Modal Styles */
.prescribed-drugs-list {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin: 10px 0;
}

.prescribed-drug-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.prescribed-drug-item:last-child {
    border-bottom: none;
}

.drug-name-clickable {
    color: #007bff;
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
}

.drug-name-clickable:hover {
    color: #0056b3;
    text-decoration: none;
}

.drug-dosage {
    color: #6c757d;
    font-size: 0.9rem;
}

.education-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.education-topic {
    margin-bottom: 15px;
}

.education-topic:last-child {
    margin-bottom: 0;
}

.education-topic h6 {
    color: #495057;
    margin-bottom: 8px;
    font-weight: 600;
}

.education-topic ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.education-topic li {
    margin-bottom: 4px;
    color: #6c757d;
}

.checklist-item {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 8px;
    background: #fff;
}

.checklist-item label {
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.checklist-item input[type="checkbox"] {
    margin-right: 10px;
}

.recommendations-content {
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

.recommendations-content h6 {
    color: #004085;
    margin-bottom: 10px;
}

.recommendations-content ul {
    margin: 0;
    padding-left: 20px;
}

.recommendations-content li {
    color: #004085;
    margin-bottom: 5px;
}

/* Drug Info Modal Styles */
#drugInfoModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 20020;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    display: none; /* Initially hidden */
}

#drugInfoModal.show {
    display: flex !important;
}

#drugInfoModal.loading-indicator {
    flex-direction: column;
}

#drugInfoModal .modal-content {
    max-width: 660px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    margin: 0;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

#drugInfoModal[style*="display: flex"] .modal-content,
#drugInfoModal[style*="display: block"] .modal-content {
    transform: scale(1);
    opacity: 1;
}

.drug-info-content {
    padding: 0;
}

.info-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-section h6 {
    color: #495057;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.info-section li {
    margin-bottom: 5px;
    color: #6c757d;
}

.warnings-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
}

.warnings-section h6 {
    color: #856404;
}

.warnings-section li {
    color: #856404;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background-color: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px;
}

/* No patients message styles */
.no-patients-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.no-patients-message i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

.no-patients-message p {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Permission denied styling */
.no-patients-message i.fa-lock {
    color: #dc3545;
}

/* Warning styling */
.no-patients-message i.fa-exclamation-triangle {
    color: #ffc107;
}

/* Success/completed styling */
.no-patients-message i.fa-check-circle {
    color: #28a745;
}

/* Section headers for referral queues */
h3 {
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
        margin: 10px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
}

h3 i {
    color: #6c757d;
    font-size: 1.1rem;
}

.completed-info {
    margin-top: 16px;
    background: #e8f8e8;
    border-left: 4px solid #27ae60;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.completed-info i {
    color: #27ae60;
    margin-top: 2px;
}

.completed-info strong {
    color: #27ae60;
    font-size: 0.9rem;
}

.completed-info small {
    color: #666;
    font-size: 0.85rem;
}

.no-patients-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--medium-text);
}

.no-patients-message i {
    font-size: 3rem;
    color: var(--success-color);
    margin-bottom: 16px;
    display: block;
}

.no-patients-message p {
    font-size: 1.1rem;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .patient-card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .patient-card {
        margin: 0;
    }
    
    .card-content {
        padding: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .patient-name {
        margin-right: 0;
        font-size: 1.125rem;
    }
    
    .status-badge {
        align-self: flex-end;
    }
    
    .detail-item {
        padding: 6px 0;
    }
    
    .detail-label {
        min-width: 70px;
        font-size: 0.8125rem;
    }
    
    .detail-value {
        font-size: 0.875rem;
    }
    
    .action-btn {
        padding: 10px 20px;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .patient-card-grid {
        gap: 12px;
    }
    
    .card-content {
        padding: 12px;
    }
    
    .patient-name {
        font-size: 1rem;
    }
    
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .detail-label {
        min-width: auto;
        font-size: 0.75rem;
    }
    
    .detail-value {
        font-size: 0.8125rem;
        text-align: left;
    }
}

/* Prevent follow-up form from collapsing when dropdown changes */
#followUpForm.stable {
    display: grid !important;
    visibility: visible !important;
}

/* Drug dose verification highlighting */
#drugDoseVerification {
    transition: all 0.3s ease;
}

#drugDoseVerification:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Toast Notification Styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 999998;
    max-width: 400px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.toast.toast-success {
    background-color: #28a745;
}

.toast.toast-error {
    background-color: #dc3545;
}

.toast.toast-warning {
    background-color: #ffc107;
    color: #212529;
}

.toast.toast-info {
    background-color: #17a2b8;
}

/* Show animation for toast */
.toast[style*="display: block"] {
    transform: translateX(0);
}

    /* Draft patient card styles */
    .patient-card.draft {
        border-left: 5px solid orange;
        background: linear-gradient(90deg, #fff3e0 80%, #ffe0b2 100%);
        box-shadow: 0 2px 8px rgba(255, 152, 0, 0.08);
        position: relative;
    }

    .patient-card .draft-badge {
        position: absolute;
        top: 12px;
        left: -2px;
        background: orange;
        color: white;
        font-weight: bold;
        font-size: 0.85rem;
        padding: 3px 12px;
        border-radius: 0 8px 8px 0;
        box-shadow: 0 2px 6px rgba(255, 152, 0, 0.12);
        z-index: 2;
        letter-spacing: 0.5px;
    }

/* Teleconsultation Styles */
.teleconsult-scheduler {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.teleconsult-scheduler .help-text {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.teleconsult-scheduler .required {
    color: #dc3545;
    margin-left: 2px;
}

.teleconsult-scheduler .info-box {
    background: #e8f4f8;
    border-left: 4px solid var(--primary-color);
    padding: 12px 16px;
    margin: 20px 0;
    border-radius: 4px;
    font-size: 0.9rem;
}

.teleconsult-scheduler .info-box i {
    color: var(--primary-color);
    margin-right: 8px;
}

.teleconsult-scheduler .action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* Patient Summary Panel for Teleconsultation */
#teleconsultationPanel {
    position: fixed;
    right: 0;
    top: 0;
    width: 400px;
    height: 100vh;
    background: #fff;
    border-left: 2px solid #ddd;
    box-shadow: -4px 0 12px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 10000;
    display: none;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.teleconsult-summary {
    padding: 20px;
}

.teleconsult-summary .summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.teleconsult-summary .summary-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.teleconsult-summary .btn-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
}

.teleconsult-summary .btn-close:hover {
    color: #333;
}

.teleconsult-summary .summary-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.teleconsult-summary .summary-section h5 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.teleconsult-summary .summary-section h5 i {
    color: var(--primary-color);
}

.teleconsult-summary .summary-section p {
    margin: 6px 0;
    font-size: 0.95rem;
    color: #555;
}

.teleconsult-summary .medication-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.teleconsult-summary .medication-list li {
    background: #f8f9fa;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.teleconsult-summary .alert-section .alert {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.teleconsult-summary .alert-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.teleconsult-summary .alert-danger {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.teleconsult-summary .alert-info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.teleconsult-summary .video-item,
.teleconsult-summary .followup-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.teleconsult-summary .video-item a {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 8px;
}

.teleconsult-summary .video-item a:hover {
    text-decoration: underline;
}

.teleconsult-summary .video-item .date,
.teleconsult-summary .followup-date {
    color: #999;
    font-size: 0.85rem;
    float: right;
}

.teleconsult-summary .followup-details {
    margin-top: 5px;
    color: #666;
}

.teleconsult-summary .summary-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Consultation History */
.consultation-history {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.consultation-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.consultation-card.scheduled {
    border-left: 4px solid #17a2b8;
}

.consultation-card.completed {
    border-left: 4px solid #28a745;
}

.consultation-card .consult-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.consultation-card .consult-date {
    font-weight: 600;
    color: #333;
}

.consultation-card .badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.consultation-card .badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.consultation-card .badge-success {
    background: #d4edda;
    color: #155724;
}

.consultation-card .badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

.consultation-card .consult-details {
    margin-bottom: 12px;
    color: #666;
    font-size: 0.95rem;
}

.consultation-card .consult-details p {
    margin: 6px 0;
}

.consultation-card .consult-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #teleconsultationPanel {
        width: 100%;
        max-width: 100%;
    }
    
    .teleconsult-scheduler {
        padding: 15px;
    }
    
    .teleconsult-scheduler .action-buttons {
        flex-direction: column;
    }
}
/* ======================================
   ADVANCED ANALYTICS - CUSTOM REPORTS
   ====================================== */

/* Quick Reports Grid */
.quick-reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.quick-report-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.quick-report-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.quick-report-card .report-icon {
    font-size: 2.5rem;
}

.quick-report-card h4 {
    margin: 4px 0;
    color: #1f2937;
    font-size: 1.1rem;
    font-weight: 600;
}

.quick-report-card p {
    margin: 0;
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.4;
}

.btn-generate-report {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-generate-report:hover {
    background: #2563eb;
}

/* Query Builder Styles */
.query-builder {
    background: white;
    border-radius: 8px;
    padding: 20px;
}

.qb-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 16px;
}

.qb-header h3 {
    margin: 0 0 8px 0;
    color: #1f2937;
}

.qb-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.qb-logic-selector {
    margin-bottom: 20px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 6px;
}

.qb-logic-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.logic-buttons {
    display: flex;
    gap: 8px;
}

.logic-btn {
    padding: 8px 16px;
    border: 2px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logic-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.logic-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.qb-conditions-container {
    margin-bottom: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.qb-condition {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.qb-condition:last-child {
    margin-bottom: 0;
}

.qb-condition .condition-logic {
    text-align: center;
    font-weight: 600;
    color: #3b82f6;
    font-size: 0.85rem;
    grid-column: 1 / -1;
    padding: 4px;
}

.qb-field-select,
.qb-operator-select,
.qb-value-select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
}

.qb-value-input {
    display: flex;
    gap: 4px;
    align-items: center;
}

.qb-multiselect {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    padding: 8px;
    background: #f3f4f6;
    border-radius: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
}

.qb-range-input,
.qb-numeric-input,
.qb-date-input {
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-remove-condition {
    background: #ef4444;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.btn-remove-condition:hover {
    background: #dc2626;
}

.qb-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-add-condition,
.btn-clear-filters {
    padding: 10px 16px;
    border: 2px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-add-condition:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn-clear-filters:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.qb-preview {
    padding: 12px;
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1e40af;
    margin-bottom: 16px;
}

.qb-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.qb-preset-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.preset-input {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-preset {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-preset:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn-preset.secondary {
    background: #f3f4f6;
}

.btn-preset.secondary:hover {
    background: #3b82f6;
}

.qb-generate-actions {
    display: flex;
    gap: 8px;
}

.btn-primary.btn-lg {
    padding: 10px 20px;
    font-weight: 600;
}

.btn-primary:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* Report View Styles */
.report-view {
    margin-bottom: 20px;
}

.report-header {
    margin-bottom: 16px;
}

.report-header h3 {
    margin: 0 0 8px 0;
    color: #1f2937;
}

.report-filters {
    margin: 4px 0;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #4b5563;
}

.report-summary {
    margin: 4px 0;
    color: #10b981;
    font-weight: 600;
}

.report-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.report-search-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    flex: 1;
    min-width: 200px;
    font-size: 0.9rem;
}

.report-export-buttons {
    display: flex;
    gap: 8px;
}

.btn-export-csv,
.btn-export-excel,
.btn-export-pdf {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-export-csv:hover {
    background: #f3f4f6;
}

.btn-export-excel:hover {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-export-pdf:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.report-table-container {
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.report-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.report-table th {
    padding: 12px 8px;
    text-align: left;
    border: 1px solid #ddd;
    font-weight: 600;
    cursor: pointer;
}

.report-table th.sortable:hover {
    background: #667eea;
}

.report-table td {
    padding: 10px 8px;
    border: 1px solid #e5e7eb;
}

.report-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.report-table tbody tr:hover {
    background: #eff6ff;
}

.sort-indicator {
    opacity: 0.5;
    margin-left: 4px;
}

.report-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
}

.btn-prev-page,
.btn-next-page {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-prev-page:hover:not(:disabled),
.btn-next-page:hover:not(:disabled) {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn-prev-page:disabled,
.btn-next-page:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

#pageIndicator {
    font-weight: 600;
    color: #374151;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments for reports */
@media (max-width: 768px) {
    .qb-condition {
        grid-template-columns: 1fr;
    }

    .report-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .report-search-input {
        min-width: auto;
    }

    .report-export-buttons {
        flex-wrap: wrap;
    }

    .quick-reports-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 100% !important;
        max-height: 95vh !important;
    }
}