/* ============================================================
   1. VARIABLES, FUENTES Y RESET
   ============================================================ */
@import url('https://googleapis.com');

:root {
    --primary: #00f2ff;        /* Cyan para botones y acentos */
    --primary-hover: #00d4e0;
    --sky: #bfdbfe;           /* Azul cielo para enlaces */
    --bg-deep: #020617;       /* Fondo general */
    --bg-card: #1e293b;       /* Fondo tarjetas */
    --bg-input: #0f172a;      /* Fondo campos */
    --border: #334155;        /* Bordes sutiles */
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #facc15;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    line-height: 1.6;
}


/* ============================================================
   DISEÑO LOGIN (INDEX.PHP)
   ============================================================ */

.main-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    padding: 20px;
    margin: 0;
}

.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

.login-container .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-container .logo img {
    max-width: 200px;
    height: auto;
}

.login-container input {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    color: white;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 1rem;
}

.login-container button {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #000;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 1px;
    border-radius: 10px;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.2);
}

.login-container .error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--danger);
    margin-bottom: 20px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 20px;
    }
    
    .login-container .logo img {
        max-width: 160px;
    }
}


/* ============================================================
   2. ESTRUCTURA (MENU, SIDEBAR Y MAIN)
   ============================================================ */
.sidebar {
    width: 220px;
    height: 100vh;
    position: fixed;
    background: #01040f;
    padding: 25px;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 35px;
    text-align: center;
}

.sidebar a {
    display: block;
    color: #ccc;
    text-decoration: none;
    margin: 12px 0;
    padding: 10px;
    border-radius: 8px;
    transition: 0.3s;
}

.sidebar a:hover {
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary);
}

.main {
    margin-left: 220px;
    padding: 30px;
    transition: all 0.3s ease;
}

/* Menu Toggle para Móvil */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1999;
    background: var(--primary);
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: #000;
    cursor: pointer;
}

.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 900;
    display: none;
}

@media print {
    .info-factura {
        text-align: right; /* Normalmente el número de factura va a la derecha */
        margin-bottom: 30px;
    }
    .info-factura strong {
        font-size: 1.4em;
        color: #000;
    }
}

/* ============================================================
   3. ELEMENTOS COMUNES (CARDS, BOTONES, LINKS)
   ============================================================ */
.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

.btn, .btn-guardar, button {
    background: var(--primary);
    color: #000;
    font-family: 'Inter', system-ui, sans-serif; /* Más moderna para botones */
    letter-spacing: 0.5px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.btn:hover, button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.3);
}

.btn-cancelar { background: #374151; color: white; }

.link-cliente {
    color: var(--sky);
    font-weight: 600;
    text-decoration: none;
}

.link-cliente:hover { text-decoration: underline; }

.alert-ok {
    background: rgba(34, 197, 94, 0.2); /* Verde translúcido */
    color: #4ade80; /* Verde brillante */
    padding: 15px 20px;
    border-radius: 10px;
    border: 1px solid #22c55e;
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================
   4. FORMULARIOS E INPUTS
   ============================================================ */
label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: white;
    font-family: inherit;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* para modificar fecha de SALIDA */
/* Poner el icono del calendario en Cyan y hacerlo siempre visible */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(48%) sepia(100%) saturate(2400%) hue-rotate(155deg) brightness(100%) contrast(105%);
    cursor: pointer;
    opacity: 1;
    display: block;
    padding: 5px;
}

/* Hacer que todo el campo parezca un botón clicable */
input[type="datetime-local"] {
    cursor: pointer;
    min-height: 45px;
}


/* ============================================================
   5. TABLAS (DASHBOARD, REPARACIONES, CLIENTES)
   ============================================================ */
.tabla {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.tabla td {
    padding: 10px 12px; /* Más compactas */
    font-size: 0.85rem;  /* Letra más pequeña sugerida */
    border-bottom: 1px solid var(--border);
}

.tabla th {
    padding: 12px;
    font-size: 0.7rem; /* Labels de cabecera muy discretos */
    letter-spacing: 0.5px;
}

/* Ajuste para que los links en la tabla no se vean gigantes */
.link-cliente {
    font-size: 0.9rem;
}

.tabla th, .tabla td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.tabla th {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.tabla tr:hover { background: rgba(255,255,255,0.02); }

/* Colores de celdas */
.pagado { color: var(--success); font-weight: bold; }
.pendiente { color: var(--warning); font-weight: bold; }
.ben-positivo { color: var(--success); font-weight: bold; }
.ben-negativo { color: var(--danger); font-weight: bold; }

/* Acciones iconos */
.acciones a {
    margin: 0 8px;
    font-size: 1.1rem;
    display: inline-block;
    transition: 0.2s;
}
.acciones a:hover { transform: scale(1.2); }

/* ============================================================
   6. DASHBOARD ESPECÍFICO
   ============================================================ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.estado-card {
    text-align: center;
    padding: 25px;
    border-radius: 15px;
}

.estado-card h3 { font-size: 0.9rem; color: rgba(255,255,255,0.7); }
.estado-card p { font-size: 2.2rem; font-weight: 800; margin-top: 5px; color: white;}

/* Fondos de estados */
.estado-pendiente { background: #78350f; border-bottom: 4px solid #f59e0b; }
.estado-revision { background: #1e3a8a; border-bottom: 4px solid #3b82f6; }
.estado-ok { background: #065f46; border-bottom: 4px solid #10b981; }
.estado-error { background: #7f1d1d; border-bottom: 4px solid #ef4444; }

/* ============================================================
   7. BLOQUES MULTI-EQUIPO (NUEVA/EDITAR REPARACIÓN)
   ============================================================ */
.producto-bloque {
    position: relative;
    padding: 40px 20px 20px;
    background: #161e2d; /* Fondo ligeramente diferente para los items */
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
}

.fila-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.btn-remove {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
    display: flex;
    align-items: center; justify-content: center;
    cursor: pointer;
}

.resumen-caja {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 columnas para los 4 datos */
    background: #01040f; 
    padding: 20px;
    border-radius: 12px;
    margin: 25px 0;
    border: 1px solid var(--border);
    text-align: center;
    gap: 10px;
}

.resumen-caja div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.resumen-caja small {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.resumen-caja strong {
    font-size: 1.3rem;
    letter-spacing: -0.5px;
}

/* Colores específicos del resumen */
.resumen-caja .total-txt { color: var(--text-main); }
.resumen-caja .pagado-txt { color: var(--success); }
.resumen-caja .beneficio-txt { color: var(--primary); }
.resumen-caja .pendiente-txt { color: var(--warning); }

@media (max-width: 600px) {
    .resumen-caja { grid-template-columns: 1fr 1fr; gap: 20px; }
}

/* ============================================================
   8. BUSCADOR Y FILTROS
   ============================================================ */
.buscador-input {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 500px;
    margin-bottom: 20px;
}

.buscador-input input {
    margin-bottom: 0;
    background: transparent;
    border: none;
}

/* PAGINADOR ESTILO UNIFICADO */
/* PAGINADOR LLAMATIVO */
.paginacion-container {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.paginacion {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 50px; /* Forma de pastilla muy moderna */
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.paginacion-numeros {
    display: flex;
    gap: 5px;
    padding: 0 10px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.btn-pagi {
    padding: 8px 16px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: 0.3s;
    color: var(--text-muted);
}

/* Botones Anterior/Siguiente */
.btn-pagi.nav {
    color: var(--primary); /* Cyan */
}

.btn-pagi.nav:hover {
    background: rgba(0, 242, 255, 0.1);
}

/* Botones de números */
.btn-pagi.num {
    min-width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-pagi.num.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.4);
}

.btn-pagi.num:hover:not(.active) {
    color: var(--primary);
    background: rgba(255,255,255,0.05);
}

/* Botón deshabilitado */
.btn-pagi.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .paginacion {
        padding: 5px 10px;
        gap: 5px;
    }
    .btn-pagi.nav {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
}



/* ============================================================
   9. RESPONSIVE COMPLETO
   ============================================================ */
@media (max-width: 768px) {
    /* 1. Asegurar que el contenido use TODO el ancho */
    .main {
        margin-left: 0 !important; /* Eliminamos el espacio del sidebar de PC */
        width: 100% !important;   /* Forzamos ancho total */
        padding: 20px 15px 100px 15px !important; /* Padding inferior para el botón flotante */
        display: block; /* Evitamos que flex lo comprima */
    }

    /* 2. Botón Flotante (FAB) */
    .menu-toggle {
        display: flex;
        position: fixed;
        top: auto;      /* ANULA TOP PC */
        bottom: 20px;
        left: 20px;
        z-index: 9999; /* Por encima de todo */
        background: var(--primary);
        width: 60px;
        height: 60px;
        border-radius: 50%;
        color: #000;
        justify-content: center;
        align-items: center;
        font-size: 24px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    }

    /* 3. El Menú (Capa superior independiente) */
    .sidebar {
        position: fixed;
        width: 100vw; /* Ancho de la ventana */
        height: 100vh; /* Alto de la ventana */
        top: 0;
        left: 0;
        z-index: 9998; /* Un nivel debajo del botón */
        background: rgba(2, 6, 23, 0.98); /* Fondo casi opaco */
        transform: translateY(100%); /* Escondido abajo */
        display: flex;
        flex-direction: column;
        justify-content: center; /* Centrado vertical */
        align-items: center;    /* Centrado horizontal */
        padding: 0;
        margin: 0;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        visibility: hidden; /* Evita que los links sean clicables si está cerrado */
    }

    .sidebar.active {
        transform: translateY(0);
        visibility: visible;
    }

    /* 4. Letras grandes para el pulgar */
    .sidebar a {
        font-size: 1.5rem !important; 
        font-weight: 500;
        color: var(--primary) !important;
        margin: 5px 0;
        text-align: center;
        width: 100%;
    }

    .sidebar h2 {
        display: none; /* Ocultamos el logo en el menú móvil para ganar espacio */
    }

    body {
        font-size: 1.1rem; 
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }

    /* Ajuste de tablas para que no se compriman */
    .tabla {
        width: 100% !important;
        display: table;
    }

    /* Tablas modo tarjeta */
    .tabla thead { display: none; }
    .tabla tr {
        display: block;
        background: var(--bg-card);
        margin-bottom: 15px;
        padding: 15px;
        border-radius: 12px;
        border: 1px solid var(--border);
    }
    .tabla td {
        display: flex;
        justify-content: space-between;
        padding: 12px 0; /* Un poco más de aire para el texto grande */
        border-bottom: 1px solid var(--border);
        font-size: 1rem; /* Datos de la tabla legibles */
    }
    .tabla td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.9rem; /* Títulos de los datos un poco más grandes */
    }

    
    .grid {
        grid-template-columns: 1fr 1fr !important; 
        gap: 10px !important; /* Espacio más pequeño entre cuadros */
        margin-bottom: 20px;
    }

    /* Hacemos las tarjetas más compactas */
    .estado-card {
        padding: 15px 10px !important; /* Menos espacio interno */
        border-radius: 10px;
    }

    /* Reducimos los textos para que quepan en 2 columnas */
    .estado-card h3 {
        font-size: 0.75rem !important; /* Título del estado más pequeño */
        white-space: nowrap; /* Evita que el texto salte de línea si es corto */
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .estado-card p {
        font-size: 1.5rem !important; /* El número grande un poco más contenido */
        margin-top: 2px;
    }
    
    .form-grid { grid-template-columns: 1fr; }



    /* Forzamos que la celda de Equipos ocupe todo el ancho y sea vertical */
    .tabla td[data-label="Equipos"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        padding: 15px 0 !important;
    }

    /* El título "EQUIPOS" lo resaltamos arriba */
    .tabla td[data-label="Equipos"]::before {
        margin-bottom: 10px;
        font-size: 0.9rem; /* Consistente con el resto de labels */
        color: var(--primary);
        width: 100%;
        border-bottom: 1px solid var(--border);
        padding-bottom: 5px;
    }

    /* EXCEPCIÓN: Estilo de "Fila" para cada aparato (Mantenemos letra pequeña aquí) */
    .sub-equipo-dash {
        width: 100%;
        background: rgba(15, 23, 42, 0.6);
        padding: 10px;
        margin-bottom: 8px;
        border-radius: 8px;
        border: 1px solid var(--border);
        display: block !important;
    }

    .sub-equipo-dash strong {
        display: block;
        color: var(--text-main);
        font-size: 0.85rem !important; /* Letra pequeña solicitada */
        margin-bottom: 2px;
    }

    .sub-equipo-dash .muted {
        display: block;
        font-size: 0.75rem !important; /* Letra pequeña solicitada */
        color: var(--text-muted);
    }

    /* Inputs y botones más cómodos para el pulgar */
    input, select, textarea, .btn {
        font-size: 1.1rem !important;
        padding: 12px !important;
    }
}

/* Bloque Equipos en Móvil */
.sub-equipo-dash {
    padding: 8px;
    background: #0f172a;
    border-radius: 8px;
    margin-top: 5px;
}

/* ============================================================
   10. MODALES
   ============================================================ */

.modal {
    display: none; 
    position: fixed; 
    z-index: 9999; /* Máxima prioridad */
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Fondo oscuro profundo */
    backdrop-filter: blur(4px); /* Efecto desenfoque para enfoque total */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    border: 1px solid var(--primary); /* Borde Cyan para resaltar */
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.2);
}

.modal.active { display: flex; } /* Clase para disparar con JS */


.pago-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--success);
}

/* ============================================================
   11. PAGOS
   ============================================================ */


.pago-item span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.pago-item strong {
    font-size: 1.1rem;
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace; /* Estilo contable */
}

/* ============================================================
   12 MODAL GALERIA FOTOS
   ============================================================ */

/* LIGHTBOX DE FOTOS - VERSIÓN FINAL CORREGIDA */
.modal-galeria {
    display: none; 
    position: fixed; 
    z-index: 99999; 
    left: 0; 
    top: 0;
    width: 100vw; 
    height: 100vh; 
    background: rgba(0, 0, 0, 0.95);
    align-items: center; 
    justify-content: center; 
    flex-direction: column;
}

.contenido-galeria { 
    position: relative; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90%;
    margin-top: 40px; /* Espacio para que la X no tape la foto en pantallas pequeñas */
}

.contenido-galeria img { 
    width: auto;
    height: auto;
    max-width: 100%;   /* No se sale del contenedor */
    max-height: 70vh;  /* Deja espacio para los botones abajo */
    object-fit: contain; 
    border-radius: 12px; 
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.3);
}


.cerrar-galeria { 
    position: fixed; /* Cambiado de absolute a fixed */
    top: 20px; 
    right: 30px; 
    color: #fff; 
    font-size: 60px; /* Tamaño grande para que se vea bien */
    cursor: pointer; 
    line-height: 1;
    z-index: 100001; /* Un nivel por encima del fondo negro */
    text-shadow: 0 0 10px rgba(0,0,0,0.5); /* Sombra para que se vea sobre cualquier foto */
    transition: 0.3s;
}

.cerrar-galeria:hover {
    color: var(--primary);
    transform: scale(1.2);
}


.controles-galeria { 
    margin-top: 20px; 
    display: flex; 
    align-items: center; 
    gap: 20px; 
}

.controles-galeria button { 
    background: var(--bg-card); 
    color: var(--primary); 
    border: 1px solid var(--primary); 
    padding: 10px 20px; 
    border-radius: 8px; 
    font-weight: bold;
    cursor: pointer;
}

/* AJUSTES ESPECÍFICOS PARA MÓVIL */
@media (max-width: 768px) {
    .contenido-galeria {
        width: 95%;
    }
    
    .contenido-galeria img {
        max-height: 60vh; /* Más baja para que quepan botones en pantallas pequeñas */
    }

    .cerrar-galeria {
        top: 15px;
        right: 20px;
        font-size: 70px; /* Súper grande en móvil para el dedo */
    }

    .controles-galeria button {
        padding: 15px 25px; /* Más grandes para el dedo */
    }
}





