/* ================================================
   TV Legacy Display - CSS Styles
   Compatible with old browsers (no flexbox/grid)
   ================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    background-color: #f0f4f8;
    color: #1e293b;
}

/* ================================================
   LOGIN PAGE STYLES
   ================================================ */

#login-container {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0ea5e9 0%, #14b8a6 50%, #0891b2 100%);
    background-color: #0ea5e9;
    /* Fallback */
}

#login-box {
    width: 450px;
    max-width: 90%;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 45px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

#logo-container {
    text-align: center;
    margin-bottom: 30px;
}

#logo {
    width: 160px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

#logo-container h1 {
    font-size: 36px;
    font-weight: bold;
    background: linear-gradient(135deg, #0ea5e9 0%, #14b8a6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #0ea5e9;
    /* Fallback for old browsers */
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#logo-container .subtitle {
    font-size: 15px;
    color: #475569;
    margin-bottom: 4px;
    font-weight: 500;
}

#logo-container .subtitle-small {
    font-size: 13px;
    color: #64748b;
    font-weight: 400;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #334155;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background-color: #f8fafc;
    color: #1e293b;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #0284c7;
    background-color: #ffffff;
}

#login-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    background: linear-gradient(135deg, #0ea5e9 0%, #14b8a6 100%);
    background-color: #0ea5e9;
    /* Fallback */
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.3);
    transition: all 0.3s ease;
}

#login-btn:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0891b2 100%);
    box-shadow: 0 6px 24px rgba(14, 165, 233, 0.4);
    transform: translateY(-1px);
}

#login-btn:disabled {
    background-color: #94a3b8;
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

#footer-text {
    text-align: center;
    margin-top: 35px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
}

#footer-text .separator {
    color: #cbd5e1;
    padding: 0 6px;
}

#footer-text .copyright {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
}

#footer-text a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 500;
}

#footer-text a:hover {
    text-decoration: underline;
    color: #0284c7;
}

/* QR Login Styles */
#qr-login-container {
    padding: 10px 0;
    animation: fadeIn 0.3s ease-in-out;
}

#qr-login-container p {
    color: #334155;
    margin-bottom: 20px;
}

#qr-placeholder {
    width: 220px;
    height: 220px;
    margin: 0 auto;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#qr-code-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#qr-loading {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
}

#qr-timer {
    margin-top: 15px;
    font-size: 14px;
    font-weight: bold;
    color: #ef4444;
    /* Red for urgency */
    height: 20px;
}

.login-methods {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

#toggle-method {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f0f9ff;
    color: #0284c7;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

#toggle-method:hover {
    background-color: #e0f2fe;
    color: #0369a1;
    text-decoration: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   DISPLAY PAGE STYLES
   ================================================ */

#display-container {
    width: 100%;
    height: 100%;
    display: table;
}

/* Header */
#header {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.header-hidden #header {
    display: none;
}

#header-logo {
    width: 55px;
    height: 55px;
    background-color: #ffffff;
    padding: 6px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.1);
}

#header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#title {
    font-size: 30px;
    font-weight: bold;
    background: linear-gradient(135deg, #0ea5e9 0%, #14b8a6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #0f172a;
    /* Fallback */
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 5px 0 0 0;
    font-weight: 500;
}

#doctor-selector-container {
    background-color: #f1f5f9;
    padding: 10px 15px;
    border-radius: 8px;
}

#doctor-selector-container label {
    font-size: 12px;
    font-weight: bold;
    color: #64748b;
    margin-right: 10px;
}

#doctor-selector {
    padding: 8px 12px;
    font-size: 14px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    min-width: 200px;
    font-weight: bold;
}

/* Connection Status */
#connection-status {
    background-color: #f8fafc;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

#status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.status-connected {
    background-color: #22c55e;
}

.status-connecting {
    background-color: #f59e0b;
}

.status-error {
    background-color: #ef4444;
}

#status-text {
    font-size: 13px;
    font-weight: bold;
    color: #475569;
    vertical-align: middle;
}

/* Clock */
#clock {
    font-size: 24px;
    font-weight: bold;
    color: #0f172a;
    background-color: #f1f5f9;
    padding: 8px 16px;
    border-radius: 8px;
    margin-right: 15px;
}

#logout-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
    font-size: 0;
    /* Remove text space */
    color: #ffffff;
    background-color: #ef4444;
    /* Changed to red for power off feel */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

#logout-btn svg {
    margin-top: 2px;
    /* Slight adjustment for centering */
}

#logout-btn:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

#main-content {
    height: calc(100% - 130px);
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    transition: all 0.3s ease;
}

.header-hidden #main-content {
    height: calc(100% - 45px);
    /* Only footer remains */
}

/* Queue Panels */
.queue-panel {
    background-color: #ffffff;
    border-radius: 12px;
    height: 100%;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.panel-header {
    padding: 20px 25px;
    color: #ffffff;
}

.optometrist-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0891b2 100%);
    background-color: #0ea5e9;
    /* Fallback */
}

.doctor-header {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    background-color: #14b8a6;
    /* Fallback */
}

.panel-header h2 {
    font-size: 22px;
    margin: 0 0 10px 0;
}

.stats-row {
    margin-top: 10px;
}

.stat-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    margin-right: 10px;
}

/* Queue List */
.queue-list {
    padding: 15px;
    height: calc(100% - 100px);
    overflow-y: auto;
}

.empty-message {
    text-align: center;
    color: #94a3b8;
    font-size: 16px;
    padding: 40px 20px;
}

/* Patient Card */
.patient-card {
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 12px;
}

.patient-card.status-assigned {
    background-color: #ecfdf5;
    border-color: #86efac;
}

.patient-card.status-in-progress {
    background-color: #fef3c7;
    border-color: #fcd34d;
}

.patient-card.emergency {
    background-color: #fef2f2;
    border-color: #fca5a5;
}

.patient-card table {
    width: 100%;
}

.token-number {
    font-size: 28px;
    font-weight: bold;
    color: #0f172a;
    background-color: #e2e8f0;
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    min-width: 60px;
}

.patient-name {
    font-size: 18px;
    font-weight: 900;
    color: #1e293b;
}

.patient-uhid {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

.patient-status {
    font-size: 12px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 15px;
    text-transform: uppercase;
}

.status-waiting {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.status-active {
    background-color: #dcfce7;
    color: #15803d;
}

.cabin-info {
    font-size: 14px;
    font-weight: bold;
    color: #0f172a;
    background-color: #e0f2fe;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Footer */
#display-footer {
    background: linear-gradient(to right, #f8fafc 0%, #ffffff 100%);
    padding: 14px 30px;
    border-top: 2px solid transparent;
    border-image: linear-gradient(to right, #0ea5e9, #14b8a6) 1;
    font-size: 12px;
    color: #64748b;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

#display-footer .footer-brand {
    font-size: 13px;
    line-height: 1.5;
}

#display-footer .separator {
    color: #cbd5e1;
    padding: 0 8px;
}

#display-footer a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 500;
}

#display-footer a:hover {
    text-decoration: underline;
    color: #0284c7;
}

/* Scrollbar Styling (for modern browsers, gracefully ignored by old ones) */
.queue-list::-webkit-scrollbar {
    width: 8px;
}

.queue-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.queue-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Animation for new patients (gracefully ignored by old browsers) */
@keyframes highlight {
    0% {
        background-color: #fef08a;
    }

    100% {
        background-color: transparent;
    }
}

.patient-card.new-patient {
    animation: highlight 2s ease-out;
}

/* Settings Controls */
.settings-control {
    display: inline-block;
    margin-right: 15px;
    vertical-align: middle;
}

.settings-control label {
    font-size: 13px;
    color: #475569;
    font-weight: bold;
    cursor: pointer;
}

.settings-control input {
    margin-right: 5px;
    vertical-align: middle;
}

/* ================================================
   TEST ANNOUNCEMENT PANEL
   ================================================ */

/* Toggle button in footer */
.test-panel-toggle-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: bold;
    color: #0284c7;
    background-color: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.test-panel-toggle-btn:hover {
    background-color: #bae6fd;
    color: #0369a1;
    border-color: #7dd3fc;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}

/* Overlay panel — slides up above the footer */
#test-panel-body {
    position: fixed;
    bottom: 48px;   /* sits just above the footer bar */
    left: 0;
    right: 0;
    z-index: 9000;
    padding: 0 20px 10px 20px;
    animation: slideUpPanel 0.25s ease-out;
}

@keyframes slideUpPanel {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.test-panel-inner {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(14,165,233,0.08);
    overflow: hidden;
}

/* Panel header bar */
.test-panel-header {
    display: table;
    width: 100%;
    padding: 10px 18px;
    background: linear-gradient(135deg, #0ea5e9 0%, #14b8a6 100%);
    background-color: #0ea5e9; /* fallback */
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    box-sizing: border-box;
}

.test-panel-header span {
    display: table-cell;
    vertical-align: middle;
}

.test-panel-close {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.test-panel-close:hover {
    color: #ffffff;
}

/* Two-column content layout */
.test-panel-content {
    display: table;
    width: 100%;
    padding: 16px 18px;
    box-sizing: border-box;
}

.test-panel-left {
    display: table-cell;
    vertical-align: top;
    width: 60%;
    padding-right: 16px;
}

.test-panel-right {
    display: table-cell;
    vertical-align: top;
    width: 40%;
    border-left: 1px solid #f1f5f9;
    padding-left: 16px;
}

/* Label */
.test-label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #475569;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Text input area */
.test-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    font-family: Arial, Helvetica, sans-serif;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background-color: #f8fafc;
    color: #1e293b;
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.test-textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    background-color: #ffffff;
}

/* Preset buttons row */
.test-presets {
    margin-top: 8px;
    margin-bottom: 12px;
}

.test-presets-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: bold;
    margin-right: 6px;
    vertical-align: middle;
}

.test-preset-btn {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: bold;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    color: #475569;
    margin-right: 5px;
    vertical-align: middle;
    transition: all 0.15s;
}

.test-preset-btn:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

/* Action button group */
.test-btn-group {
    display: table;
    width: 100%;
}

.test-btn {
    display: table-cell;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    vertical-align: middle;
    transition: all 0.15s ease;
    letter-spacing: 0.2px;
}

/* English — sky blue */
.test-btn-en {
    background-color: #0ea5e9;
    color: #ffffff;
    margin-right: 6px;
}

.test-btn-en:hover {
    background-color: #0284c7;
    box-shadow: 0 3px 8px rgba(14,165,233,0.3);
}

/* Hindi — amber/orange */
.test-btn-hi {
    background-color: #f59e0b;
    color: #ffffff;
    margin-right: 6px;
}

.test-btn-hi:hover {
    background-color: #d97706;
    box-shadow: 0 3px 8px rgba(245,158,11,0.3);
}

/* Both (queue) — teal */
.test-btn-both {
    background-color: #14b8a6;
    color: #ffffff;
    margin-right: 6px;
}

.test-btn-both:hover {
    background-color: #0d9488;
    box-shadow: 0 3px 8px rgba(20,184,166,0.3);
}

/* Stress test — violet */
.test-btn-seq {
    background-color: #8b5cf6;
    color: #ffffff;
}

.test-btn-seq:hover {
    background-color: #7c3aed;
    box-shadow: 0 3px 8px rgba(139,92,246,0.3);
}

/* Status message */
.test-status {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
    min-height: 20px;
    color: #475569;
}

/* Debug panel (right column) */
.test-debug-label {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.test-debug-box {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #334155;
    line-height: 1.8;
    min-height: 80px;
}

.test-debug-hint {
    margin-top: 8px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.6;
}

.test-debug-hint code {
    background-color: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    color: #475569;
    border: 1px solid #e2e8f0;
}