:root {
    --rojo:     #E91350;
    --mostaza:  #fdf5e6;
    --negro:    #1a0004;
    --carbon:   #3D010C;
    --blanco:   #ffffff;
    --verde:    #2ecc71;
    --naranja:  #f39c12;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Gotham', sans-serif; 
    background: var(--negro); 
    color: var(--blanco); 
    height: 100vh; 
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ─── FONDO SLIDESHOW ─── */
.bg-slideshow {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.bg-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    transform: scale(1.05);
    animation: slowZoom 12s ease-in-out infinite alternate;
}

.bg-slide.active { opacity: 1; }

@keyframes slowZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(26, 0, 4, 0.85) 0%,
        rgba(61, 1, 12, 0.75) 50%,
        rgba(26, 0, 4, 0.9) 100%
    );
    z-index: 1;
}

/* ─── HEADER ─── */
.display-header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid var(--rojo);
}

.display-logo { height: 80px; }

.display-header h1 {
    font-family: 'Rotio', cursive;
    font-size: 2.2rem;
    color: var(--mostaza);
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.display-clock {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--blanco);
    background: rgba(0,0,0,0.3);
    padding: 8px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ─── DISEÑO DE COLUMNAS ESTILO FAST-FOOD ─── */
.display-main {
    position: relative;
    z-index: 10;
    flex: 1;
    padding: 25px 30px;
    overflow: hidden; /* Evita scroll en el main ya que el scroll se maneja en las listas */
}

.display-columns {
    display: flex;
    height: 100%;
    align-items: stretch;
}

.display-column {
    flex: 1;
    width: 50%;
    background: rgba(18, 0, 3, 0.45);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
}

.display-column:first-child {
    margin-right: 15px;
}

.display-column:last-child {
    margin-left: 15px;
}

.prep-column {
    border: 2px solid rgba(243, 156, 18, 0.2);
    box-shadow: inset 0 0 20px rgba(243, 156, 18, 0.05);
}

.ready-column {
    border: 2px solid rgba(46, 204, 113, 0.25);
    box-shadow: inset 0 0 20px rgba(46, 204, 113, 0.05);
}

/* ENCABEZADOS DE COLUMNA */
.column-header {
    font-family: 'Rotio', cursive;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.prep-header {
    color: var(--naranja);
    text-shadow: 0 0 15px rgba(243, 156, 18, 0.4);
    border-bottom: 2px dashed rgba(243, 156, 18, 0.2);
}

.ready-header {
    color: var(--verde);
    text-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
    border-bottom: 2px dashed rgba(46, 204, 113, 0.2);
}

/* LISTAS DE PEDIDOS */
.column-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-right: 8px;
}

/* Estilos de scrollbar premium */
.column-list::-webkit-scrollbar {
    width: 6px;
}
.column-list::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}
.column-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
}
.column-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* ESTADO VACÍO EN COLUMNA */
.column-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255,255,255,0.2);
    font-size: 1.3rem;
    font-weight: 700;
    gap: 15px;
    text-align: center;
    border: 2px dashed rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 30px;
}
.column-empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}
.prep-column .column-empty-state i { color: rgba(243, 156, 18, 0.3); }
.ready-column .column-empty-state i { color: rgba(46, 204, 113, 0.3); }

/* VISTA COMPLETAMENTE VACÍA (FULL SCREEN) */
.empty-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 70vh;
    text-align: center;
    color: rgba(255,255,255,0.25);
}
.empty-display i { font-size: 6rem; margin-bottom: 25px; color: rgba(253,245,230,0.1); }
.empty-display p { font-size: 2.2rem; font-weight: 900; color: var(--mostaza); transition: opacity 0.5s ease; }
.empty-display span { font-size: 1.1rem; margin-top: 10px; transition: opacity 0.5s ease; }

/* ANIMACIONES DE ICONOS */
.pulse-orange {
    animation: flamePulse 1.2s infinite ease-in-out alternate;
}
@keyframes flamePulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(243, 156, 18, 0.5)); }
    100% { transform: scale(1.15) rotate(-5deg); filter: drop-shadow(0 0 10px rgba(243, 156, 18, 0.9)); }
}

.pulse-green {
    animation: checkPulse 1.5s infinite ease-in-out alternate;
}
@keyframes checkPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(46, 204, 113, 0.5)); }
    100% { transform: scale(1.18); filter: drop-shadow(0 0 12px rgba(46, 204, 113, 0.9)); }
}

/* ─── TARJETA DE PEDIDO ─── */
.order-card {
    width: 100%;
    background: rgba(10, 0, 2, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform: scale(0.8);
    opacity: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

@keyframes popIn {
    to { transform: scale(1); opacity: 1; }
}

/* En proceso */
.order-card.en-proceso {
    border-color: rgba(243, 156, 18, 0.4);
}
.order-card.en-proceso .card-status-bar {
    background: linear-gradient(90deg, var(--naranja), #e67e22);
}

/* Listo / completado (Glow parpadeante verde premium) */
.order-card.completado {
    border-color: rgba(46, 204, 113, 0.5);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, pulse-glow-green 2.5s infinite ease-in-out;
}
.order-card.completado .card-status-bar {
    background: linear-gradient(90deg, var(--verde), #27ae60);
}

@keyframes pulse-glow-green {
    0%, 100% { 
        box-shadow: 0 0 15px rgba(46, 204, 113, 0.15); 
        border-color: rgba(46, 204, 113, 0.4); 
    }
    50% { 
        box-shadow: 0 0 35px rgba(46, 204, 113, 0.4); 
        border-color: rgba(46, 204, 113, 1); 
        transform: scale(1.02);
    }
}

/* Barra de estado superior */
.card-status-bar {
    height: 6px;
    width: 100%;
    background: var(--naranja);
}

.card-body {
    padding: 12px 20px;
}

.card-customer {
    font-size: 1.5rem; /* Mayor visibilidad para el cliente */
    font-weight: 900;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--blanco);
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.card-customer i { font-size: 1.3rem; color: rgba(255,255,255,0.6); }

.card-items {
    list-style: none;
    margin-bottom: 15px;
}

.card-items li {
    font-size: 1.1rem; /* Texto más grande para lectura a distancia */
    padding: 6px 0;
    color: rgba(255,255,255,0.85);
    border-bottom: 1px dashed rgba(255,255,255,0.08);
    display: flex;
    gap: 8px;
}

.card-items li:last-child { border-bottom: none; }

.card-items .qty {
    color: var(--mostaza);
    font-weight: 900;
}

/* Badge de estado */
.card-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-proceso {
    background: rgba(243, 156, 18, 0.15);
    color: var(--naranja);
    border: 1px solid rgba(243, 156, 18, 0.25);
}
.status-proceso i { animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-listo {
    background: rgba(46, 204, 113, 0.15);
    color: var(--verde);
    border: 1px solid rgba(46, 204, 113, 0.25);
}
.status-listo i { animation: bounce 0.6s ease both; }
@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Animación de salida cuando ya se retira */
.order-card.fade-out {
    animation: fadeOut 1s forwards;
}
@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.8) translateY(-20px); }
}

html {
    overflow: hidden;
}

/* ─── OPTIMIZACIONES PARA PANTALLAS VERTICALES / PORTRAIT ─── */
@media (orientation: portrait) {
    .display-header {
        padding: 20px 25px;
        flex-direction: row; /* Mantener logo y hora horizontales, pero más compactos */
    }
    .display-logo {
        height: 60px;
    }
    .display-header h1 {
        font-size: 1.8rem;
    }
    .display-clock {
        font-size: 1.4rem;
        padding: 6px 14px;
    }
    .display-main {
        padding: 20px 20px;
    }
    .display-columns {
        flex-direction: column;
    }
    .display-column {
        width: 100%;
        padding: 20px 15px;
        border-radius: 20px;
    }
    .display-column:first-child {
        margin-bottom: 10px;
        margin-right: 0;
    }
    .display-column:last-child {
        margin-top: 10px;
        margin-left: 0;
    }
    .column-header {
        font-size: 1.6rem;
        margin-bottom: 15px;
        padding-bottom: 12px;
        gap: 10px;
    }
    .card-customer {
        font-size: 1.6rem; /* Tamaño masivo para excelente lectura */
    }
    .card-items li {
        font-size: 1.2rem;
    }
}

/* ─── ROTACIÓN FORZADA POR CSS (Para TVs instaladas físicamente en vertical pero con señal horizontal) ─── */

/* Opción A: Rotación Horaria (TV rotada hacia la derecha) */
body.force-rotated {
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: 0;
    left: 100vw;
    transform: rotate(90deg) !important;
    transform-origin: top left !important;
    overflow: hidden !important;
}

/* Opción B: Rotación Antihoraria (TV rotada hacia la izquierda - el caso más común) */
body.force-rotated-counter {
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: 100vh;
    left: 0;
    transform: rotate(-90deg) !important;
    transform-origin: top left !important;
    overflow: hidden !important;
}

/* Replicar las mejoras visuales de escala vertical para ambos tipos de rotación forzada */
body.force-rotated .display-header,
body.force-rotated-counter .display-header {
    padding: 20px 25px;
}
body.force-rotated .display-logo,
body.force-rotated-counter .display-logo {
    height: 60px;
}
body.force-rotated .display-header h1,
body.force-rotated-counter .display-header h1 {
    font-size: 1.8rem;
}
body.force-rotated .display-clock,
body.force-rotated-counter .display-clock {
    font-size: 1.4rem;
    padding: 6px 14px;
}
body.force-rotated .display-main,
body.force-rotated-counter .display-main {
    padding: 20px 20px;
}
body.force-rotated .display-columns,
body.force-rotated-counter .display-columns {
    flex-direction: column;
}
body.force-rotated .display-column,
body.force-rotated-counter .display-column {
    width: 100%;
    padding: 20px 15px;
    border-radius: 20px;
}
body.force-rotated .display-column:first-child,
body.force-rotated-counter .display-column:first-child {
    margin-bottom: 10px;
    margin-right: 0;
}
body.force-rotated .display-column:last-child,
body.force-rotated-counter .display-column:last-child {
    margin-top: 10px;
    margin-left: 0;
}
body.force-rotated .column-header,
body.force-rotated-counter .column-header {
    font-size: 1.6rem;
    margin-bottom: 15px;
    padding-bottom: 12px;
    gap: 10px;
}
body.force-rotated .card-customer,
body.force-rotated-counter .card-customer {
    font-size: 1.6rem;
}
body.force-rotated .card-items li,
body.force-rotated-counter .card-items li {
    font-size: 1.2rem;
}

/* ─── VIDEO SALVAPANTALLAS ─── */
.video-screensaver {
    position: fixed;
    inset: 0;
    z-index: 1000; /* Cubre todo el módulo de pantalla y el texto por completo */
    background: var(--negro);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.video-screensaver.active {
    opacity: 1;
    visibility: visible;
}

.video-screensaver video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Asegura que el video se vea completo sin recortar los bordes */
}

/* Rotar el video 90 grados para que quede de pie en pantallas verticales */
body.force-rotated .video-screensaver,
body.force-rotated-counter .video-screensaver {
    display: flex;
    justify-content: center;
    align-items: center;
}

body.force-rotated .video-screensaver video,
body.force-rotated-counter .video-screensaver video {
    width: 100vw; /* Se invierten las dimensiones para que al rotarlo encaje perfecto */
    height: 100vh;
    transform: rotate(90deg);
}
