/* Custom Premium Stylesheet for Layar Informasi Antrian Operasi */
/* Optimized for 1080p & 4K TV screens - Dynamic Scaling & Hardware Accelerated Paging */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Rajdhani:wght@500;600;700&display=swap');

:root {
    --bg-main: radial-gradient(circle at center, #0f172a, #020617);
    --card-bg: rgba(15, 23, 42, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
    --blur-strength: 16px;
    
    /* Neon Palette */
    --cyan-neon: #06b6d4;
    --emerald-neon: #10b981;
    --amber-neon: #f59e0b;
    --rose-neon: #f43f5e;
    --indigo-neon: #6366f1;
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Fonts */
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-tech: 'Rajdhani', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: #020617;
    background-image: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden; /* Avoid page scrollbars on TV */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Base layout container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem 1.5rem 0 1.5rem;
}

/* Header Section */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--cyan-neon), var(--indigo-neon), var(--emerald-neon));
}

.hospital-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hospital-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

.hospital-info h1 {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.15rem;
}

.hospital-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* DateTime Ticker */
.datetime-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.date-display {
    text-align: right;
}

.date-display .day {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.date-display .full-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.clock-display {
    font-family: var(--font-tech);
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--cyan-neon);
    text-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    letter-spacing: 2px;
    background: rgba(6, 182, 212, 0.05);
    padding: 0.25rem 1.25rem;
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.15);
    min-width: 200px;
    text-align: center;
}

/* Main Dashboard Area */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.25rem;
    flex-grow: 1;
    min-height: 0; /* Important for flex child overflow */
    margin-bottom: 1.25rem;
}

/* Left panel: Queue List Container */
.queue-panel {
    grid-column: span 8;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    padding: 1.5rem;
    min-height: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-title svg {
    color: var(--cyan-neon);
    filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}

.patient-count-badge {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--cyan-neon);
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Card-Grid container */
.queue-container {
    position: relative;
    flex-grow: 1;
    min-height: 0;
    width: 100%;
}

/* Fading pages for the card grid */
.grid-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    gap: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.grid-page.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* Dynamic Grid Configurations based on card counts */
.grid-page.cols-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.grid-page.cols-2-1 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr;
}

.grid-page.cols-2-2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.grid-page.cols-3-2 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
}

/* Base Card Style */
.op-card {
    background: rgba(30, 41, 59, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 6px solid var(--text-muted);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.op-card:hover {
    background: rgba(30, 41, 59, 0.5);
    transform: translateY(-3px);
}

/* Card status border colors */
.op-card.status-menunggu {
    border-left-color: var(--amber-neon);
}

.op-card.status-proses {
    border-left-color: var(--emerald-neon);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.12);
}

.op-card.status-selesai {
    border-left-color: var(--indigo-neon);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 5px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.status-badge::before {
    content: '';
    display: inline-block;
    border-radius: 50%;
}

.status-menunggu {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--amber-neon);
}

.status-menunggu::before {
    background-color: var(--amber-neon);
    box-shadow: 0 0 8px var(--amber-neon);
    animation: pulse-glow 1.5s infinite;
}

.status-proses {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--emerald-neon);
}

.status-proses::before {
    background-color: var(--emerald-neon);
    box-shadow: 0 0 10px var(--emerald-neon);
    animation: pulse-glow 1.2s infinite;
}

.status-selesai {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--indigo-neon);
}

.status-selesai::before {
    background-color: var(--indigo-neon);
}


/* ==========================================================================
   DYNAMIC SIZE VARIATION: MEDIUM (Default Sizing: 3-4 Cards / 2x2 Grid)
   ========================================================================== */
.card-size-medium {
    padding: 1.15rem 1.35rem;
}

.card-size-medium .op-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.card-size-medium .op-rm {
    font-family: var(--font-tech);
    color: var(--cyan-neon);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.card-size-medium .op-patient {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 210px;
}

.card-size-medium .op-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
}

.card-size-medium .op-procedure {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
}

.card-size-medium .op-doctor {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.card-size-medium .op-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.card-size-medium .op-time-container {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.card-size-medium .op-time {
    font-family: var(--font-tech);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cyan-neon);
}

.card-size-medium .op-gender-age {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-size-medium .status-badge {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.card-size-medium .status-badge::before {
    width: 6px;
    height: 6px;
}


/* ==========================================================================
   DYNAMIC SIZE VARIATION: HUGE (1 Card Sizing - Fills Container)
   ========================================================================== */
.card-size-huge {
    padding: 2.5rem 3rem;
}

.card-size-huge .op-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
}

.card-size-huge .op-rm {
    font-family: var(--font-tech);
    color: var(--cyan-neon);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: rgba(6, 182, 212, 0.08);
    padding: 0.25rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(6, 182, 212, 0.15);
}

.card-size-huge .op-patient {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    max-width: none;
}

.card-size-huge .op-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.card-size-huge .op-procedure {
    font-size: 3.3rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.card-size-huge .op-doctor {
    font-size: 1.6rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
}

.card-size-huge .op-doctor svg {
    width: 28px;
    height: 28px;
}

.card-size-huge .op-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

.card-size-huge .op-time-container {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-secondary);
    font-size: 1.3rem;
}

.card-size-huge .op-time-container svg {
    width: 26px;
    height: 26px;
}

.card-size-huge .op-time {
    font-family: var(--font-tech);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--cyan-neon);
}

.card-size-huge .op-gender-age {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.4rem 1.25rem;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-size-huge .status-badge {
    padding: 0.6rem 1.5rem;
    font-size: 1.25rem;
    gap: 0.65rem;
    border-radius: 8px;
}

.card-size-huge .status-badge::before {
    width: 12px;
    height: 12px;
}


/* ==========================================================================
   DYNAMIC SIZE VARIATION: LARGE (2 Cards Sizing - Side-by-Side)
   ========================================================================== */
.card-size-large {
    padding: 2rem 2.2rem;
}

.card-size-large .op-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
}

.card-size-large .op-rm {
    font-family: var(--font-tech);
    color: var(--cyan-neon);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 1px;
    background: rgba(6, 182, 212, 0.05);
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
}

.card-size-large .op-patient {
    font-size: 1.55rem;
    font-weight: 700;
    color: #fff;
    max-width: none;
}

.card-size-large .op-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.card-size-large .op-procedure {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.card-size-large .op-doctor {
    font-size: 1.15rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.card-size-large .op-doctor svg {
    width: 20px;
    height: 20px;
}

.card-size-large .op-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 0.85rem;
    margin-top: 0.85rem;
}

.card-size-large .op-time-container {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.card-size-large .op-time-container svg {
    width: 18px;
    height: 18px;
}

.card-size-large .op-time {
    font-family: var(--font-tech);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--cyan-neon);
}

.card-size-large .op-gender-age {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-size-large .status-badge {
    padding: 0.45rem 1rem;
    font-size: 0.95rem;
}

.card-size-large .status-badge::before {
    width: 8px;
    height: 8px;
}


/* ==========================================================================
   DYNAMIC SIZE VARIATION: SMALL (5-6 Cards / Paged / 3x2 Grid)
   ========================================================================== */
.card-size-small {
    padding: 0.85rem 1.1rem;
}

.card-size-small .op-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.35rem;
    margin-bottom: 0.35rem;
}

.card-size-small .op-rm {
    font-family: var(--font-tech);
    color: var(--cyan-neon);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-size-small .op-patient {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 145px;
}

.card-size-small .op-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.15rem 0;
}

.card-size-small .op-procedure {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
}

.card-size-small .op-doctor {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.2rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
}

.card-size-small .op-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.35rem;
    margin-top: 0.35rem;
}

.card-size-small .op-time-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.card-size-small .op-time-container svg {
    width: 12px;
    height: 12px;
}

.card-size-small .op-time {
    font-family: var(--font-tech);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cyan-neon);
}

.card-size-small .op-gender-age {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-size-small .status-badge {
    padding: 0.25rem 0.55rem;
    font-size: 0.7rem;
}

.card-size-small .status-badge::before {
    width: 5px;
    height: 5px;
}


/* Right panel: Carousel */
.carousel-panel {
    grid-column: span 4;
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: relative;
    min-height: 0;
}

.carousel-container {
    flex-grow: 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #020617;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #020617;
}

/* Empty State / Offline Indicators */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    gap: 1rem;
    height: 100%;
    width: 100%;
}

.empty-state svg {
    color: var(--text-muted);
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--emerald-neon);
    box-shadow: 0 0 8px var(--emerald-neon);
}

.status-dot.offline {
    background-color: var(--rose-neon);
    box-shadow: 0 0 8px var(--rose-neon);
    animation: pulse-glow 1s infinite;
}

/* Footer & Scrolling Marquee */
footer {
    height: 60px;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.marquee-label {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    background: var(--indigo-neon);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    box-shadow: 6px 0 15px rgba(0, 0, 0, 0.3);
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    padding-left: 200px; /* Offset for the absolute label */
}

/* Hardware accelerated CSS scrolling ticker */
.marquee-content {
    display: inline-flex;
    white-space: nowrap;
    align-items: center;
    gap: 3.5rem;
    animation: marquee-scroll 45s linear infinite;
    will-change: transform;
}

.marquee-content:hover {
    animation-play-state: paused;
}

.marquee-item {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.marquee-item::before {
    content: '✦';
    color: var(--cyan-neon);
    text-shadow: 0 0 6px var(--cyan-neon);
}

.marquee-item span.highlight {
    color: var(--cyan-neon);
    font-weight: 700;
}

/* Keyframes and Animations */
@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 6px currentColor;
    }
    50% {
        transform: scale(1.25);
        opacity: 0.7;
        box-shadow: 0 0 14px currentColor;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes marquee-scroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0); /* Assumes duplicated content for loop */
    }
}
