/* Importación de fuentes locales */
@font-face {
    font-family: 'Gontserrat';
    src: url('/fonts/Gontserrat-Light.ttf') format('truetype');
    font-weight: 300;
}
@font-face {
    font-family: 'Gontserrat';
    src: url('/fonts/Gontserrat-Regular.ttf') format('truetype');
    font-weight: 400;
}
@font-face {
    font-family: 'Gontserrat';
    src: url('/fonts/Gontserrat-Medium.ttf') format('truetype');
    font-weight: 500;
}
@font-face {
    font-family: 'Gontserrat';
    src: url('/fonts/Gontserrat-SemiBold.ttf') format('truetype');
    font-weight: 600;
}
@font-face {
    font-family: 'Gontserrat';
    src: url('/fonts/Gontserrat-Black.ttf') format('truetype');
    font-weight: 900;
}

:root {
    --gnv-green: #159d49;
    --gnv-dark-text: #004d40;
    --gnv-label-gray: #6d6f71;
    --gnv_blue:#193761;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Ajuste de Body para centrar Login verticalmente sin romper el scroll del Dashboard */
body {
    font-family: 'Gontserrat', sans-serif;
    background-color: var(--gnv-green);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center; /* Centrado vertical por defecto (para el Login) */
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- LOGIN: SE MANTIENE TU DISEÑO DE 850px --- */
.login-card {
    background: var(--white);
    /* En móviles ocupará el 95% de la pantalla */
    width: 95%;
    /* Pero en computadoras nunca superará los 850px */
    max-width: 850px;
    padding: 40px;
    border-radius: 40px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Aseguramos que el login no se pegue al techo */
    margin: auto; 
}

.logo-container { margin-bottom: 20px; text-align: center; }
.logo-container img { width: 400px; height: auto; }

.form-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group {
    display: flex;
    align-items: center;
    justify-content: flex-end; 
    margin-bottom: 25px;
    width: 100%;
}

.input-group label {
    font-weight: 600;
    color: var(--gnv-label-gray);
    font-size: 2rem;
    margin-right: 25px;
}

.input-group input {
    width: 280px;
    padding: 12px 15px;
    border: 1.5px solid #d1d1d1;
    border-radius: 12px;
    font-family: 'Gontserrat', sans-serif;
    font-weight: 500;
    font-size: 1.3rem;
    color: #333;
    text-align: center;
    outline: none;
}

.btn-ingresar {
    background-color: var(--gnv-green);
    color: var(--white);
    border: none;
    padding: 12px 65px;
    border-radius: 15px;
    font-family: 'Gontserrat', sans-serif;
    font-weight: 900; 
    font-size: 1.8rem;
    cursor: pointer;    
    margin-top: 20px;
}

/* --- DASHBOARD: RÉPLICA YAPE --- */

.dashboard-wrapper {
    display: none; 
    width: 100%;
    justify-content: center;
    padding: 40px 0;
}

/* Card Principal de 850px */
.app-card {
    background-color: var(--white);
    /* En móviles ocupará el 95% de la pantalla */
    width: 95%;
    /* Pero en computadoras nunca superará los 850px */
    max-width: 850px;
    border-radius: 40px; /* Bordes redondeados por defecto */
    padding: 45px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: border-radius 0.3s ease;
}

/* EFECTO YAPE: Al abrir movimientos, quitamos redondeo inferior */
.dashboard-wrapper.active-movements .app-card {
    border-radius: 40px 40px 0 0;
}

.app-header {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    margin-bottom: 30px;
}

.logo-app { width: 250px; height: auto; }

.driver-card-green {
    background-color: var(--gnv-green);
    width: 80%;
    border-radius: 25px;
    padding: 25px 40px;
    color: var(--white);
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 35px;
}

.white-box {
    background-color: var(--white);
    color: var(--gnv-label-gray);
    padding: 3px 12px;
    border-radius: 8px;
    font-weight: 900;
    margin-left: 10px;
}

.driver-card-green .top-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 500;
}

.driver-card-green .placa-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    font-weight: 500;
    flex-wrap: nowrap;
}

/* Asegura que cada par (label + white-box) se comporte como una unidad horizontal */
.driver-card-green .placa-row > * {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.driver-card-green .white-box.large {
    font-size: 2rem;
    padding: 5px 20px;
    border-radius: 12px;
}

.balances-section {
    width: 80%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    margin-bottom: 30px;
}

.balance-item {
    display: flex;
    align-items: center; /* Alinea texto y caja de saldo en la misma línea */
    gap: 15px;
    color: var(--gnv-green);
    font-weight: 900;
    font-size: 1.1rem;
    text-align: left;
}

.balance-box {
    background-color: var(--white);
    color: var(--gnv-label-gray);
    padding: 8px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.balance-box strong { font-size: 2.5rem; font-weight: 900; }

/* Grifo Asignado */
.grifo-section {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--gnv-green);
    font-weight: 900;
    margin-bottom: 30px;
}

.grifo-label{
    color: var(--gnv-label-gray);
    font-weight: 900;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.grifo-box {
    background-color: var(--white);
    color: var(--gnv-label-gray);
    padding: 10px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: 900;
}

/* Mapa y Ubicación */
.map-section {
    width: 80%;
    display: flex;
    gap: 20px;
    margin-bottom: 35px;
}

.btn-ver-ubicacion {
    background-color: var(--white);
    color: var(--gnv-green);
    border: 3px solid var(--gnv-green);
    border-radius: 20px;
    padding: 15px 25px;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    line-height: 1.2;
}


.btn-icon-location {
    background-color: var(--white);
    color: var(--gnv-green); /* Esto da color al SVG gracias a fill="currentColor" */
    border: 3px solid var(--gnv-green);
    border-radius: 20px;
    width: 65px;  /* Ancho fijo para hacerlo cuadrado */
    height: 65px; /* Alto fijo para hacerlo cuadrado */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0; /* Quitamos padding para que el centrado sea exacto */
    margin-left: 10px;
}

/* Efecto hover opcional para que se sienta interactivo */
.btn-icon-location:hover {
    background-color: #f0fdf4; /* Un verde muy clarito de fondo */
    transform: scale(1.05);
}

/* Ajuste del tamaño del SVG dentro del botón */
.btn-icon-location svg {
    width: 30px;
    height: 30px;
}

.map-container {
    flex: 1;
    height: 180px;
    background-color: #f5f5f5;
    border-radius: 20px;
    border: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Selector de Monto 
-----
------
------
*/

.amount-selector {
    width: 85%;
    margin-bottom: 25px;
    text-align: center;
}

.selector-label {
    color: var(--gnv-label-gray);
    font-weight: 900;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.amount-options {
    width: 80%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    justify-items: center;
}

.amount-btn {
    flex: 1;
    background-color: var(--white);
    color: var(--gnv_blue);
    border: 2px solid var(--gnv_blue);
    padding: 12px 5px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Estado cuando se selecciona uno */
.amount-btn.selected {
    background-color: var(--gnv_blue);
    color: var(--white);
}

/* Estilo para el botón de generar cuando está deshabilitado */
.btn-generar-cupon:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-generar-cupon {
    width: 70%;
    background-color: var(--gnv-green);
    color: var(--white);
    border: none;
    padding: 18px;
    border-radius: 15px;
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 20px;
}

/* --- SECCIÓN MOVIMIENTOS (CORREGIDO) --- */

.movements-container {
    width: 70%; /* Mismo ancho que botón cupón */
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
}

.btn-movimientos {
    width: 100%; /* Ocupa todo el contenedor (70%) */
    background-color: var(--gnv_blue);
    color: var(--white);
    border: none;
    padding: 18px 30px;
    border-radius: 15px;
    font-size: 1.6rem;
    font-weight: 900;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-radius 0.3s ease;
}

.btn-movimientos.active {
    border-radius: 15px 15px 0 0;
}

.arrow-icon {
    transition: transform 0.4s ease;
    display: inline-block;
    font-size: 1.3rem;
    transform: rotate(90deg); /* Abajo cuando está cerrado */
}

.btn-movimientos.active .arrow-icon {
    transform: rotate(-90deg); /* Arriba cuando está abierto */
}

.movements-list { 
    width: 100%; /* Ocupa todo el contenedor (70%) */
    background-color: var(--white);
    border-radius: 0 0 15px 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    border-top: none;
    
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.3s ease;
    opacity: 0;
}

.movements-list.active {
    max-height: 1000px; 
    opacity: 1;
    padding: 10px 25px 30px 25px;
}

.movement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1.5px solid #f9f9f9;
}

/* Contenedor extra para alinear código y estado en la misma línea */
.code-header {
    display: flex;
    align-items: center; /* Centrado vertical interno */
    gap: 8px; /* Espacio entre código y etiqueta */
    margin-bottom: 2px; /* Pequeño espacio con la fecha */
}

/* CLASE BASE: Etiquetas de Estado (Estética tipo botón de icono) */
.status-label {
    background-color: var(--white);
    border: 2px solid; /* Grosor del borde */
    border-radius: 8px; /* Bordes redondeados sutiles */
    padding: 3px 10px; /* Padding pequeño y compacto */
    font-size: 0.8rem; /* Fuente pequeña */
    font-weight: 900; /* Texto en negrita */
    line-height: 1; /* Sin interlineado extra */
    text-transform: uppercase; /* Todo en mayúsculas (opcional) */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    /* Margin top/bottom sutil para separarlo un poco de la fecha, pero muy poco */
    margin: 2px 0; 
}

/* ESTADOS ESPECÍFICOS DE COLOR */

/* Estado Consumido (Rojo) */
.status-label.consumed {
    color: #ef4444; /* Rojo tipo Yape */
    border-color: #ef4444;
}

/* Estado Disponible (Verde) */
.status-label.available {
    color: var(--gnv-green); /* Verde tipo GNV/Ver ubicación */
    border-color: var(--gnv-green);
}

.movement-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.movement-info strong { 
    font-size: 1.2rem; 
    font-weight: 900; 
    color: var(--gnv_blue); 
    margin: 0;
}

.movement-info span { 
    font-size: 0.9rem; 
    color: var(--gnv_blue); 
    font-weight: 500;
    opacity: 0.8;
}

.movement-amount { 
    font-size: 1.8rem; 
    font-weight: 900; 
    color: var(--gnv_blue); 
}



/* --- SECCIÓN RESPONSIVE CORREGIDA (REEMPLAZAR TODO EL BLOQUE AL FINAL) --- */

/* Cuando la pantalla sea de 768px o menos (Tablets y la mayoría de Celulares) */
@media (max-width: 768px) {
    
    /* 1. Ajustes de Contenedores Principales */
    .login-card, .app-card {
        padding: 25px 15px; /* Reducimos padding interno lateral */
        border-radius: 30px; /* Bordes un poco más sutiles en móvil */
    }

    .input-group {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .input-group label {
        font-size: 1.4rem; /* Reducción de fuente de labels */
        margin-right: 0px;
        margin-right: 0;
        text-align: center;
        width: 100%;
    }

    .input-group input {
        width: 100%;
        max-width: 320px;
        text-align: center;
    }

    .btn-ingresar {
        font-size: 1.5rem;
        padding: 10px 50px;
    }

    /* --- 3. Dashboard: Tarjeta Verde (Ajustado) --- */
    .driver-card-green {
        width: 100%;
        padding: 12px 15px; /* Más compacto */
        border-radius: 18px;
    }

    .driver-card-green .top-row {
        font-size: 0.75rem; /* Labels DNI/DATOS más pequeños */
        margin-bottom: 8px;
    }

    .driver-card-green strong.white-box {
        font-size: 0.8rem; /* Nombres y DNI real */
        padding: 2px 6px;
        border-radius: 5px;
    }

    .driver-card-green .placa-row span {
        font-size: 0.8rem; /* Label "PLACA" */
    }

    .driver-card-green .white-box.large {
        font-size: 1.6rem; /* Tamaño de placa mucho más equilibrado */
        padding: 4px 15px;
        border-radius: 10px;
    }
    /* 4. Dashboard: Secciones Intermedias (image_21.png) */
    .balances-section, .map-section, .amount-selector, .movements-container {
        width: 100%; /* Aprovechar todo el ancho */
    }

    /* Balances Verticales (ajustado para reducir espacios y centrar) */
    .balances-section {
        flex-direction: column;
        padding: 0;
        margin-bottom: 8px;
        align-items: center; /* centrar la sección */
    }

    /* Cada item: label al inicio, box al final; controlamos separación con márgenes */
    .balance-item {
        display: flex;
        align-items: center;
        justify-content: space-between; /* label al start, box al end */
        width: 100%;
        max-width: 360px; /* evita que crezca demasiado en pantallas anchas */
        font-size: 1rem; /* Labels más compactos */
        padding: 4px 0; /* pequeño espaciado vertical para separación */
        margin-left: 35px; /* margen izquierdo para crear espacio en el extremo */
    }

    .balance-item > .balance-label {
        margin: 0;
        font-weight: 900;
        color: var(--gnv-label-gray);
        flex: 0 0 auto;
        text-align: left;
        min-width: 90px; /* espacio mínimo para el label sin empujar la caja */
    }

    .balance-box {
        padding: 6px 10px;
        font-size: 1rem;
        min-width: 100px; /* evita colapso extremo */
        display: flex;
        align-items: baseline;
        justify-content: center;
        border-radius: 10px;
        margin-right: 35px; /* margen derecho para crear espacio en el extremo */
    }

    .balance-box strong {
        font-size: 1.8rem; /* monto principal más pequeño en móvil */
        line-height: 1;
    }

    /* Grifo Asignado: label en su propia línea, luego fila con valor + posible icono, todo centrado */
    .grifo-section {
        display: flex;
        flex-wrap: wrap; /* permite salto de línea automático */
        gap: 6px;
        align-items: center;
        justify-content: center; /* centra la sección */
        margin-bottom: 8px;
        width: 100%;
    }
    
    .grifo-box {
        background-color: var(--white);
        color: var(--gnv-label-gray);
        padding: 8px 18px;
        border: 2px solid #e0e0e0;
        border-radius: 12px;
        font-size: 1.6rem;
        font-weight: 900;
    }

    /* Botón/icono compacto alineado junto al valor */
    .btn-icon-location {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        padding: 0;
        margin-left: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-icon-location svg {
        width: 22px;
        height: 22px;
    }

    /* Selector de Montos (image_21.png) */
    .selector-label {
        font-size: 1rem;
    }

    /* Los botones de monto se ponen en 2 columnas para que queden mejor */
    .amount-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        justify-content: center;
    }

    .amount-btn {
        font-size: 1.1rem; /* Texto "S/ 10", etc. */
        padding: 10px 5px;
    }

    /* Botón Generar Cupón */
    .btn-generar-cupon {
        width: 100%;
        font-size: 1.6rem;
        padding: 15px;
    }

    /* 5. Dashboard: Movimientos (image_22.png) */
    .btn-movimientos {
        font-size: 1.4rem;
        padding: 12px 20px;
    }

    .arrow-icon {
        font-size: 1.1rem;
    }

    .movements-list.active {
        padding: 10px 15px 25px 15px; /* Menos padding lateral */
    }

    .movement-info strong {
        font-size: 1.1rem; /* Código de movimiento */
    }

    .movement-info span {
        font-size: 0.85rem; /* Fecha y hora */
    }

    .status-label {
        font-size: 0.75rem; /* ETIQUETA DISPONIBLE/CONSUMIDO */
        padding: 2px 8px;
        border-radius: 6px;
    }

    .movement-amount {
        font-size: 1.6rem; /* Monto de movimiento (S/ 15) */
    }
}

/* --- OPTIMIZACIÓN EXTRA PARA CELULARES MUY PEQUEÑOS (max-width: 380px) --- */
/* Ejemplo: iPhone SE, etc. image_20.png se ve muy apretado */
@media (max-width: 380px) {
    .logo-container img {
        width: 150px;
    }

    .logo-app {
        width: 100px;
    }

    .driver-card-green .white-box.large {
        font-size: 1.8rem; /* Placa aún más pequeña */
        padding: 5px 15px;
    }

    .balance-box strong {
        font-size: 1.8rem;
    }

    .grifo-box {
        font-size: 1.4rem;
    }
}