/* ==========================================================================
   1. ESTILOS GENERALES Y LAYOUT
   ========================================================================== */

/* Contenedores principales */
.gv-container, .gv-wrap {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Tarjetas (Card System) */
.card, .gv-card, .gv-sale-card {
    background: #ffffff;
    border: 1px solid #dcdcde; /* Color borde nativo WP */
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    box-sizing: border-box;
}

/* Separadores */
.sep, .gv-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 20px 0;
}

/* Sistema de Grid (CSS Grid) */
.grid, .gv-grid-2, .gv-grid-3, .gv-grid-4, .gv-grid-5 {
    display: grid;
    gap: 15px;
    box-sizing: border-box;
}

/* Columnas Responsivas */
.g-2, .gv-grid-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.g-3, .gv-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g-4, .gv-grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.gv-grid-5       { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* Corrección de anchos dentro del grid */
.gv-grid-2 > .gv-field,
.gv-grid-3 > .gv-field,
.gv-grid-4 > .gv-field,
.gv-grid-5 > .gv-field {
    width: auto; 
    min-width: 0; /* Evita desbordamientos en grid */
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }


/* ==========================================================================
   2. FORMULARIOS E INPUTS
   ========================================================================== */

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    margin-bottom: 5px;
}

input[type="text"], 
input[type="date"], 
input[type="time"], 
input[type="number"], 
input[type="tel"], 
input[type="email"], 
select, 
textarea, 
.gv-input, 
.gv-select, 
.gv-textarea {
    width: 100%;
    padding: 0 8px;
    line-height: 2;
    min-height: 30px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    background-color: #fff;
    color: #2c3338;
    box-shadow: 0 0 0 transparent;
    transition: box-shadow .1s linear;
}

textarea, .gv-textarea {
    padding: 8px;
    line-height: 1.5;
}

/* Estados Focus */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2271b1; /* Azul WP */
    box-shadow: 0 0 0 1px #2271b1;
}

/* Estados Readonly/Disabled */
input[readonly], select[disabled], textarea[readonly] {
    background: #f0f0f1;
    color: #646970;
    border-color: #dcdcde;
    cursor: not-allowed;
}


/* ==========================================================================
   3. BOTONES (Estilo Nativo WP mejorado)
   ========================================================================== */

.btn, .gv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15384615;
    min-height: 30px;
    margin: 0;
    padding: 0 10px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    -webkit-appearance: none;
    border-radius: 3px;
    white-space: nowrap;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Botón Secundario (Default) */
.btn, .gv-btn, .btn.light, .gv-btn-secondary {
    color: #2271b1;
    border-color: #2271b1;
    background: #f6f7f7;
}
.btn:hover, .gv-btn:hover, .btn.light:hover, .gv-btn-secondary:hover {
    background: #f0f0f1;
    border-color: #0a4b78;
    color: #0a4b78;
}

/* Botón Primario */
.btn.primary, .gv-btn-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}
.btn.primary:hover, .gv-btn-primary:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

/* Botón Peligro */
.btn.danger, .gv-btn-danger {
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
}
.btn.danger:hover, .gv-btn-danger:hover {
    background: #fee2e2;
    border-color: #dc2626;
    color: #b91c1c;
}


/* ==========================================================================
   4. TABLAS DE DATOS (Estilo WP List Table)
   ========================================================================== */

.table, .gv-excel-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.table thead th, .gv-excel-table thead th {
    border-bottom: 1px solid #c3c4c7;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #1d2327;
    background: #f6f7f7; /* Fondo cabecera WP */
    font-size: 11px;
    text-transform: uppercase;
}

.table td, .gv-excel-table td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f1;
    color: #50575e;
}

.gv-excel-table td { padding: 0 !important; height: 30px; position: relative; border-right: 1px solid #e2e8f0; }

.table tr:last-child td { border-bottom: none; }
.table tr:nth-child(odd) { background-color: #fff; }
.table tr:nth-child(even) { background-color: #fcfcfc; }

.table .right { text-align: right; }
.table .text-center { text-align: center; }

/* Inputs dentro de tablas */
.table input, .table select {
    padding: 2px 6px;
    min-height: 28px;
    font-size: 13px;
    border-color: #dcdcde;
}

.gv-excel-table input, .gv-excel-table select, .gv-excel-table textarea { 
    width: 100%; border: none; padding: 0 6px; font-size: 12px; margin: 0; 
    background: transparent; height: 100%; display: block; box-sizing: border-box; color: #334155;
    outline: none; box-shadow: none !important;
}
.gv-excel-table input:focus, .gv-excel-table select:focus { box-shadow: inset 0 0 0 1px #0ea5e9 !important; background: #fff; }

/* =========================================================================
   SOLUCIÓN 1: FILA ROJA TOTAL (SI FALTA PAGO)
   ========================================================================= */
tr.gv-row-unpaid { background-color: #fee2e2 !important; }
tr.gv-row-unpaid td { background-color: #fee2e2 !important; border-color: #fca5a5 !important; }

/* Pintamos los inputs también para que no queden blancos */
tr.gv-row-unpaid input, 
tr.gv-row-unpaid select, 
tr.gv-row-unpaid textarea { 
    background-color: #fee2e2 !important; 
    color: #991b1b !important; /* Texto rojo oscuro */
    font-weight: 600;
}
/* Al hacer focus, volvemos a blanco para escribir cómodo */
tr.gv-row-unpaid input:focus, 
tr.gv-row-unpaid select:focus { 
    background-color: #fff !important; 
    color: #334155 !important; 
}

/* =========================================================================
   SOLUCIÓN 2: ARREGLO DE CELDAS HOTEL (FINANZAS) - BLINDADO
   ========================================================================= */
/* La celda contenedora (td) */
.gv-finance-cell { 
    padding: 0 !important; 
    height: 60px !important; /* Altura fija aumentada (30px + 30px) */
    min-width: 220px;       /* ANCHO MÍNIMO CRÍTICO para que quepan fecha y monto */
    vertical-align: top;
    position: relative;
    border-right: 1px solid #cbd5e1 !important;
}

/* Fila Superior (Fecha | Monto) */
.gv-finance-grid {
    display: flex;
    width: 100%;
    height: 30px !important; /* Mitad exacta de 60px */
    border-bottom: 1px solid #cbd5e1;
    box-sizing: border-box;
    background: transparent;
}

/* Inputs de la fila superior */
.gv-finance-grid input {
    width: 50% !important;
    height: 30px !important;
    border: none !important;
    border-right: 1px solid #cbd5e1 !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 5px !important;
    font-size: 11px !important;
    text-align: center;
    background: transparent !important;
    box-shadow: none !important;
    line-height: 30px !important;
    min-height: 0 !important;
}
.gv-finance-grid input:last-child { border-right: none !important; }

/* Fila Inferior (Cuenta) */
.gv-account-input {
    width: 100% !important;
    height: 30px !important; /* Mitad exacta de 60px */
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    background: transparent !important;
    box-shadow: none !important;
    display: block;
    line-height: 30px !important;
    min-height: 0 !important;
}

/* Ajustes headers colores */
.gv-excel-header-ops { background: #1e3a8a !important; color: #fff !important; padding: 8px; margin-top: 20px; font-weight:700; }
.gv-excel-header-hotel { background: #0ea5e9 !important; color: #fff !important; padding: 8px; margin-top: 20px; font-weight:700; }
.gv-excel-header-tren { background: #374151 !important; color: #fff !important; padding: 8px; margin-top: 20px; font-weight:700; }
.gv-excel-header-vuelo { background: #0f766e !important; color: #fff !important; padding: 8px; margin-top: 20px; font-weight:700; }


/* ==========================================================================
   5. COMPONENTES UI ESPECÍFICOS (Pills, Cards headers)
   ========================================================================== */

/* Pills / Badges */
.gv-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: #e0e0e0;
    color: #444;
    border: 1px solid transparent;
}

.gv-pill-green { background: #d1fcd3; color: #005a04; border-color: #c6eeb9; }
.gv-pill-open { background: #dcfce7; color: #166534; border-color: #86efac; }
.gv-pill-locked { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* Cabecera de Tarjetas */
.gv-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 12px;
    margin-bottom: 15px;
}
.gv-card-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1d2327;
}
.gv-card-header-pills { display: flex; gap: 5px; }

/* Cuerpo de Tarjeta */
.gv-card-field label {
    color: #646970;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.gv-card-field span {
    font-size: 14px;
    font-weight: 500;
    color: #2c3338;
}

/* Acciones de Tarjeta */
.gv-card-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Botones Link (Eliminar) */
.button.button-link-delete {
    background: none;
    border: none;
    color: #d63638;
    text-decoration: underline;
    box-shadow: none;
    padding: 0 5px;
}
.button.button-link-delete:hover {
    background: none;
    color: #a00;
}

/* ==========================================================================
   6. MODALES
   ========================================================================== */

.gv-modal {
    display: none;
    position: fixed;
    z-index: 100100; /* Superior a WP Admin Bar (99999) */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.gv-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #ccd0d4;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.gv-close-button {
    color: #787c82;
    float: right;
    font-size: 24px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 20px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.gv-close-button:hover { color: #d63638; }

.gv-code-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f6f7f7;
    padding: 15px;
    border: 1px dashed #8c8f94;
    border-radius: 4px;
    margin: 20px 0;
}

.gv-code-box strong {
    font-size: 1.4em;
    font-family: monospace;
    color: #2271b1;
    letter-spacing: 1px;
}

/* ==========================================================================
   7. HISTORIAL Y DETALLES
   ========================================================================== */

.gv-details-section {
    display: none; /* Oculto por defecto */
    background: #fbfbfc;
    border-top: 1px solid #e2e4e7;
    margin: 0 -20px -20px -20px; /* Expandir a bordes de tarjeta */
    padding: 20px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.gv-history-table {
    width: 100%;
    border-collapse: collapse;
}
.gv-history-table th { background: #f0f0f1; text-align: left; padding: 8px; font-size: 12px; }
.gv-history-table td { border-bottom: 1px solid #f0f0f1; padding: 8px; font-size: 12px; }

/* Mensajes de Carga/Error */
.gv-message {
    padding: 10px 15px;
    border-left: 4px solid #72aee6;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-top: 15px;
}
.gv-message.error {
    border-left-color: #d63638;
    color: #d63638;
}