@import url('../style.css');

/* Variables y tema F1 */
:root {
    --primary-red: #e10600; /* Color oficial F1 */
    --dark-bg: #111111;
    --darker-bg: #0a0a0a;
    --text-light: #ffffff;
    --text-muted: #9ca3af;
    --accent: #f59e0b;
    --mp-blue: #009ee3;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: var(--darker-bg);
    color: var(--text-light);
    overflow: hidden; /* Evitar scroll en app tipo PWA */
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.racing-font {
    font-family: 'Racing Sans One', cursive;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-red);
    text-shadow: 0 0 10px rgba(225, 6, 0, 0.4);
}

/* Background dinámico (Asfalto/Neón) */
body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% 0%, #2a0000 0%, var(--darker-bg) 60%);
    z-index: -1;
}

/* Contenedor principal */
#app-container {
    flex: 1;
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    overflow: hidden;
}

/* Pantallas */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px 4px;
    background: #020617;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* Tarjetas de contenido */
.card {
    background: rgba(17, 17, 17, 0.9);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 16px 8px;
    width: 100%;
    max-width: 460px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    position: relative;
    margin: auto;
}

.card h1, .card h2 {
    margin-bottom: 15px;
}

.card p {
    color: var(--text-muted);
    margin-bottom: 25px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Splash Screen Animada */
#screen-splash {
    background: var(--dark-bg);
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.splash-logo {
    width: 200px;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(225, 6, 0, 0.3);
    animation: pulseLogo 2s infinite alternate;
}

.loader-bar {
    width: 150px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loader-bar::after {
    content: '';
    position: absolute;
    left: -50px;
    top: 0;
    height: 100%;
    width: 50px;
    background: var(--primary-red);
    animation: loadingBar 1.5s infinite ease-in-out;
}

/* Gráfico de Auto */
.car-graphic img {
    width: 100%;
    max-width: 250px;
    margin: 10px 0 30px;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5));
}

/* Botones */
.btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-red) 0%, #990000 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(225, 6, 0, 0.4);
}

.btn-mp {
    background: var(--mp-blue);
    color: white;
    margin-top: 20px;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Inputs */
input[type="text"], input[type="tel"] {
    width: 100%;
    padding: 15px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 10px rgba(225, 6, 0, 0.2);
}

.input-group {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.5);
    border: 1px solid #444;
    border-radius: 8px;
    margin-bottom: 10px;
    padding-left: 15px;
}
.input-group span.prefix {
    color: var(--text-muted);
    font-weight: bold;
}
.input-group input {
    margin-bottom: 0;
    border: none;
    background: transparent;
    text-align: left;
    box-shadow: none;
}

.error-msg {
    color: var(--primary-red) !important;
    font-size: 0.8rem !important;
    text-align: left;
    margin-top: -5px;
    margin-bottom: 15px !important;
    display: none;
}

/* Opciones de Lavado */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.option-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    color: white;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.option-card i {
    font-size: 1.8rem;
    color: var(--text-muted);
    margin-right: 15px;
}

.option-card span {
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
    text-align: left;
}

.option-card .price {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 4px;
}

.option-card:hover, .option-card:focus {
    background: rgba(225, 6, 0, 0.1);
    border-color: var(--primary-red);
}
.option-card:hover i {
    color: var(--primary-red);
}

.option-card.premium {
    border-color: var(--accent);
    background: rgba(245, 158, 11, 0.05);
}
.option-card.premium i, .option-card.premium .price {
    color: var(--accent);
}

/* Resumen Pago */
.order-summary {
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    margin-bottom: 20px;
}
.order-summary h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text-muted);
}
.order-summary p {
    margin-bottom: 5px;
    color: white;
}
.order-summary strong {
    color: var(--primary-red);
}

/* Reseñas */
.stars {
    font-size: 2.5rem;
    color: #444;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    cursor: pointer;
}

.stars .star.active {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 15px;
    background: var(--darker-bg);
    border-top: 1px solid #222;
    font-size: 0.8rem;
    color: #666;
    z-index: 10;
}

/* Animaciones */
@keyframes pulseLogo {
    0% { transform: scale(0.95); box-shadow: 0 0 20px rgba(225, 6, 0, 0.2); }
    100% { transform: scale(1.05); box-shadow: 0 0 60px rgba(225, 6, 0, 0.6); }
}

@keyframes loadingBar {
    0% { left: -50px; }
    100% { left: 150px; }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================================
   PISTA INTERACTIVA EN VIVO Y WIDGET DE DEMORA (CLIENTE)
   ============================================================ */

/* Ocultar patentes de autos en la vista del cliente por privacidad */
.car-plate {
    display: none !important;
}

.live-track-container {
    position: relative;
    width: 100%;
    height: 250px;
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1.5px solid rgba(225, 6, 0, 0.4);
    box-shadow: 0 0 20px rgba(225, 6, 0, 0.2);
}

.client-canvas-area {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #0b0f19;
}

/* Widget de Demora Posicionado ARRIBA de la pista */
.client-status-board {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid #334155;
    border-radius: 12px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    box-sizing: border-box;
}

.client-status-board .status-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-status-board .status-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 1px;
}

.client-status-board .status-time {
    font-size: 1.25rem;
    font-weight: 900;
    color: #fff;
    font-family: 'Racing Sans One', sans-serif;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.client-status-board .status-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.badge-libre {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid #22c55e;
}

.badge-normal {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid #0ea5e9;
}

.badge-alta {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid #f59e0b;
}

.badge-critica {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid #ef4444;
}

/* Grilla Responsiva para el Lienzo del Cliente */
.live-track-container {
    position: relative;
    width: 100%;
    height: 390px;
    margin: 12px 0 20px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1.5px solid rgba(225, 6, 0, 0.4);
    box-shadow: 0 0 20px rgba(225, 6, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.scaled-track-wrapper {
    /* Reduced admin size (4 columns instead of 6) */
    width: 580px;
    height: 520px;
    position: relative;
    /* Escala ajustada para aprovechar el ancho disponible de la tarjeta */
    transform: scale(0.72);
    transform-origin: center top;
}

.track-base {
    stroke-width: 110px; /* Igual al admin */
    stroke: #4b4b4b;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.track-line {
    transition: opacity 0.3s;
}

.client-canvas-area {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Removemos los !important que rompían la proporción, ahora usamos las medidas del admin */
.client-canvas-area .canvas-grid {
    display: grid;
    grid-template-columns: repeat(4, 3.6cm);
    grid-template-rows: 40px repeat(8, 2.4cm);
    justify-content: space-evenly;
    align-content: space-evenly;
    width: 100%;
    height: 100%;
    padding: 1rem;
    box-sizing: border-box;
}

.client-canvas-area .grid-box {
    width: 3.6cm;
    height: 2.4cm;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.8));
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    font-weight: bold;
    backdrop-filter: blur(4px);
}

.client-canvas-area .zone-title {
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    color: #fff;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: 8px;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 6px 6px 0 0;
    padding: 4px;
}

/* Pantalla Digital LED de Publicidad adaptada al cliente (Ubicación limpia en área libre izquierda) */
.client-canvas-area .sponsor-screen-container {
    width: 170px !important;
    height: 100px !important;
    top: 73% !important;
    left: 25% !important;
    transform: translate(-50%, -50%) !important;
    position: absolute !important;
    z-index: 5 !important;
}

.sponsor-screen-frame {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    border: 1.2px solid rgba(56, 189, 248, 0.5);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2), 0 5px 15px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.screen-badge {
    font-family: 'Racing Sans One', 'Montserrat', sans-serif;
    font-size: 0.55rem;
    letter-spacing: 0.5px;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.screen-media-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-media-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.screen-footer {
    padding: 3px 8px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.98));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sponsor-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.sponsor-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.6rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.2px;
}

.sponsor-progress-bar {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.sponsor-progress-fill {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #38bdf8, #f59e0b);
}

.client-canvas-area .screen-header {
    padding: 2px 4px !important;
}

.client-canvas-area .screen-badge {
    font-size: 0.5rem !important;
}

.client-canvas-area .screen-footer {
    padding: 2px 6px !important;
}

.client-canvas-area .sponsor-title {
    font-size: 0.6rem !important;
}

/* Vehículos en el Cliente */
.car-wrapper {
    position: absolute;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    z-index: 20;
    transition: left 0.8s ease-in-out, top 0.8s ease-in-out;
}

.car-wrapper.solo-secado .auto-icon {
    filter: hue-rotate(270deg) drop-shadow(0 0 10px #a855f7);
}

.car-wrapper.completo .auto-icon {
    filter: drop-shadow(0 0 10px #3b82f6);
}

.car-wrapper.solo-lavado .auto-icon {
    filter: hue-rotate(90deg) drop-shadow(0 0 10px #22c55e);
}

.auto-icon {
    width: 150%;
    height: 150%;
    object-fit: contain;
    filter: brightness(1.1) contrast(1.2) drop-shadow(0 5px 5px rgba(0,0,0,0.5));
}

/* Underglow neón igual que admin */
.car-wrapper::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 2.5cm; height: 1.2cm;
    border-radius: 50%;
    filter: blur(15px);
    z-index: -1;
    opacity: 0.85;
}

/* Colores por tipo de servicio */
.car-wrapper.solo-lavado::before { background: #3b82f6; }
.car-wrapper.solo-secado::before { background: #22c55e; }
.car-wrapper.completo::before    { background: #f97316; }

/* Ocultar patentes en vista cliente por privacidad pero mostrar el timer superior */
.car-plate { display: none !important; }

.car-timer {
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 800;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.3);
    white-space: nowrap;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
    z-index: 30;
    pointer-events: none;
    display: block !important;
}

.car-wrapper.solo-lavado .car-timer { background: #3b82f6; box-shadow: 0 0 10px #3b82f6; }
.car-wrapper.solo-secado .car-timer { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.car-wrapper.completo .car-timer    { background: #f97316; box-shadow: 0 0 10px #f97316; }

