.container {
    width: 100%;
    max-width: none;
    padding-inline: clamp(1rem, 2vw, 2rem);
}

.waiting-room-layout {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 1.5vw, 2rem);
    min-height: calc(100vh - 120px);
}

.top-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 1.5vw, 2rem);
    height: clamp(300px, 40vh, 430px);
    align-items: stretch;
}

.bottom-row {
    width: 100%;
}

/* Left side - Media/YouTube Player */
.media-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
    background: #000;
    border: 1px solid var(--border-color);
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
    background: #000;
}

.media-info {
    display: none;
    justify-content: space-between;
    align-items: center;
}

.playing-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.playing-title i {
    color: var(--primary);
    animation: pulse-glow 2s infinite;
}

/* Right side - Paging & Active Cards */
.queues-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.active-call-card {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border: 2px solid rgba(6, 182, 212, 0.3);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    animation: border-pulse 3s infinite alternate;
    justify-content: center;
    min-width: 0;
    height: 100%;
}

.active-call-card h3 {
    text-transform: uppercase;
    font-size: clamp(1.5rem, 1.8vw, 2rem);
    letter-spacing: 0.15em;
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 700;
}

.active-patient-name {
    font-size: clamp(3.25rem, 4vw, 4.75rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    line-height: 1.02;
}

.active-destination {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
    width: min(100%, 520px);
}

.destination-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.destination-badge .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.destination-badge .value {
    font-size: clamp(1.65rem, 1.8vw, 2.1rem);
    font-weight: 700;
    color: white;
    line-height: 1.1;
}

.destination-badge.office-badge .value {
    font-size: clamp(2rem, 2.25vw, 2.6rem);
}

.destination-badge.office-badge {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.05);
}

.destination-badge.doctor-badge {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.05);
}

/* History Panel & Table Style */
.history-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    border-color: rgba(6, 182, 212, 0.15);
    flex: 1;
}

.history-header-bar h3 {
    font-size: clamp(1.5rem, 1.8vw, 2rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-table-header {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(120px, 0.8fr) minmax(0, 1.5fr) minmax(90px, 0.7fr);
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border: 1px solid var(--border-color);
    border-bottom: 2px solid rgba(6, 182, 212, 0.3);
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
}

.history-table-header > div {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}

.history-table-header .col-patient,
.history-table-header .col-doctor {
    text-align: left;
}

.history-table-header .col-office {
    justify-content: center;
    text-align: center;
}

.history-table-header .col-time {
    text-align: right;
}

.history-table-body {
    display: flex;
    flex-direction: column;
    max-height: 350px;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.history-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(120px, 0.8fr) minmax(0, 1.5fr) minmax(90px, 0.7fr);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
    transition: var(--transition-smooth);
}

.history-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.history-row:last-child {
    border-bottom: none;
}

/* Larger Columns for Patient Board */
.col-patient {
    font-size: clamp(2rem, 2.15vw, 2.65rem);
    font-weight: 800;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    text-transform: uppercase;
    line-height: 1.05;
}

.col-office {
    font-size: clamp(1.65rem, 1.9vw, 2.1rem);
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.col-office-badge {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    width: clamp(54px, 3.25vw, 64px);
    height: clamp(54px, 3.25vw, 64px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.col-doctor {
    font-size: clamp(1.55rem, 1.9vw, 2.1rem);
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
}

.col-time {
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    color: var(--text-muted);
}

.empty-history {
    color: var(--text-muted);
    text-align: center;
    padding: 4rem 0;
    font-style: italic;
    font-size: 1.1rem;
}

html[data-theme="light"] .active-patient-name {
    background: linear-gradient(135deg, #172033, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

html[data-theme="light"] .active-call-card h3,
html[data-theme="light"] .history-header-bar h3,
html[data-theme="light"] .col-patient,
html[data-theme="light"] .destination-badge .value {
    color: var(--text-main);
    text-shadow: none;
}

html[data-theme="light"] .history-table-header,
html[data-theme="light"] .history-row {
    background: rgba(255, 255, 255, 0.48);
}

/* Fullscreen Paging Announcement Overlay */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.call-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.call-overlay-content {
    width: 85%;
    max-width: 900px;
    padding: 4rem 3rem;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 60px rgba(6, 182, 212, 0.3), var(--shadow-lg);
    background: rgba(17, 24, 39, 0.85);
    border-radius: var(--radius-lg);
}

.call-overlay.active .call-overlay-content {
    transform: scale(1);
}

.overlay-bell-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.5);
    animation: ring-bell 0.6s infinite alternate;
}

.overlay-bell-icon i {
    width: 50px;
    height: 50px;
    color: white;
}

.overlay-title {
    font-size: clamp(1.25rem, 1.4vw, 1.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--primary);
    margin-bottom: 1.5rem;
    animation: pulse-glow 1.5s infinite;
}

.overlay-patient-name {
    font-size: clamp(3rem, 4.5vw, 5rem);
    font-weight: 800;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, #ffffff, #c084fc, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 25px rgba(0,0,0,0.5);
}

.overlay-details {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.overlay-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.overlay-box .label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.overlay-box .value {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
}

.overlay-box.office-box {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.08);
}

.overlay-box.doctor-box {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.08);
}

.overlay-box.doctor-box .value {
    font-size: 1.75rem;
    line-height: 2.5rem;
}

#kioskOverlay .call-overlay-content {
    max-width: 820px;
    padding: 3rem;
}

#kioskOverlay .overlay-bell-icon {
    width: 84px;
    height: 84px;
    margin-bottom: 1.4rem;
}

#kioskOverlay .overlay-title {
    font-size: clamp(1.15rem, 1.25vw, 1.35rem);
    margin-bottom: 1rem;
}

#kioskOverlay .kiosk-title {
    font-size: clamp(2.75rem, 3.2vw, 3.75rem);
    line-height: 1.08;
    margin-bottom: 1rem;
}

#kioskOverlay .kiosk-help {
    max-width: 620px;
    margin: 0 auto 1.25rem;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.5;
}

/* Animations */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.03);
    }
}

@keyframes border-pulse {
    0% {
        border-color: rgba(6, 182, 212, 0.3);
        box-shadow: 0 0 20px rgba(6, 182, 212, 0.1), var(--shadow-lg);
    }
    100% {
        border-color: rgba(139, 92, 246, 0.6);
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.3), var(--shadow-lg);
    }
}

@keyframes ring-bell {
    0% {
        transform: rotate(-12deg) scale(1);
    }
    100% {
        transform: rotate(12deg) scale(1.05);
    }
}

/* Setup Overlay Form (subtle gear at top right of waiting-room) */
.settings-trigger {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    z-index: 100;
}

.settings-trigger:hover {
    color: white;
    background: rgba(255,255,255,0.1);
    transform: rotate(45deg);
}

/* Settings modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-modal.active {
    opacity: 1;
    pointer-events: all;
}

.settings-modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.settings-modal-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    background: linear-gradient(135deg, white, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.form-group input, .form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: white;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

@media (max-width: 900px) {
    .top-row {
        grid-template-columns: 1fr;
        height: auto;
    }

    .video-wrapper,
    .active-call-card {
        min-height: 360px;
    }

    .history-panel {
        overflow-x: auto;
    }

    .history-table-header,
    .history-table-body {
        min-width: 720px;
    }
}
