/**
 * turnetes.css — Estilos compartidos de Turnetes
 * 
 * Se carga en todas las páginas. Los estilos específicos de cada página
 * van en <style> dentro de la propia página o en ficheros separados.
 *
 * Variables CSS principales:
 *   --t-primary:       #2B5797
 *   --t-primary-dark:  #1e3f6f
 *   --t-primary-light: #3a6fba
 *   --t-primary-bg:    #e8f0fe
 *   --t-success:       #198754
 *   --t-danger:        #dc3545
 *   --t-warning:       #fd7e14
 *   --t-info:          #0dcaf0
 *   --t-bg:            #f0f2f5
 */

/* ══════════════════════════════════════════════════════════════════ */
/* VARIABLES GLOBALES                                                */
/* ══════════════════════════════════════════════════════════════════ */

:root {
    /* Colores principales */
    --t-primary: #2B5797;
    --t-primary-dark: #1e3f6f;
    --t-primary-light: #3a6fba;
    --t-primary-bg: #e8f0fe;
    --t-bg: #f0f2f5;
    
    /* Colores de estado */
    --t-success: #198754;
    --t-danger: #dc3545;
    --t-warning: #ffc107;
    --t-info: #0dcaf0;
    
    /* Tipografía */
    --t-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Espaciado */
    --t-spacing-xs: 0.25rem;
    --t-spacing-sm: 0.5rem;
    --t-spacing-md: 1rem;
    --t-spacing-lg: 1.5rem;
    --t-spacing-xl: 2rem;
    
    /* Bordes y sombras */
    --t-border-radius: 0.5rem;
    --t-shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --t-shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --t-shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
}

/* ══════════════════════════════════════════════════════════════════ */
/* RESET Y BASE                                                       */
/* ══════════════════════════════════════════════════════════════════ */

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--t-bg);
    font-family: var(--t-font-family);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Foco accesible ──────────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--t-primary);
    outline-offset: 2px;
}

/* ── Scrollbar personalizado (Chrome/Edge) ───────────────────────────── */
::-webkit-scrollbar { 
    width: 6px; 
}

::-webkit-scrollbar-track { 
    background: transparent; 
}

::-webkit-scrollbar-thumb { 
    background: #ccc; 
    border-radius: 3px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: #aaa; 
}

/* ── Safe area para móviles con notch ────────────────────────────────── */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ══════════════════════════════════════════════════════════════════ */
/* LAYOUT                                                             */
/* ══════════════════════════════════════════════════════════════════ */

.t-content {
    flex: 1;
    padding: var(--t-spacing-md);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.t-footer {
    text-align: center;
    padding: 0.75rem;
    font-size: 0.75rem;
    color: #bbb;
    margin-top: auto;
}

/* ══════════════════════════════════════════════════════════════════ */
/* TÍTULOS DE SECCIÓN                                                */
/* ══════════════════════════════════════════════════════════════════ */

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: var(--t-spacing-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════════ */
/* CARDS (genéricas)                                                 */
/* ══════════════════════════════════════════════════════════════════ */

.t-card {
    background: white;
    border-radius: var(--t-border-radius);
    box-shadow: var(--t-shadow-sm);
    padding: var(--t-spacing-md);
    margin-bottom: 0.75rem;
}

.t-card-hover {
    transition: all 0.2s;
}

.t-card-hover:hover {
    box-shadow: var(--t-shadow-md);
}

/* Cards con borde izquierdo */
.t-card-border-left {
    border-left: 4px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.t-card-border-left:hover {
    border-left-color: var(--t-primary);
}

/* ══════════════════════════════════════════════════════════════════ */
/* CARDS DE ACCIÓN (estilo index.php)                                */
/* ══════════════════════════════════════════════════════════════════ */

.t-action-card {
    background: white;
    border-radius: var(--t-border-radius);
    box-shadow: var(--t-shadow-sm);
    padding: var(--t-spacing-md);
    margin-bottom: 0.75rem;
    border-left: 4px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.t-action-card:hover {
    border-left-color: var(--t-primary);
    box-shadow: var(--t-shadow-md);
    color: inherit;
}

.t-action-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.t-action-card.disabled:hover {
    border-left-color: transparent;
    box-shadow: var(--t-shadow-sm);
}

.t-action-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.t-action-card p {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

/* ══════════════════════════════════════════════════════════════════ */
/* BADGES                                                             */
/* ══════════════════════════════════════════════════════════════════ */

.t-badge-soon {
    font-size: 0.65rem;
    background: #fd7e14;
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 0.2rem;
    font-weight: 600;
    text-transform: uppercase;
}

.t-badge-notify {
    font-size: 0.7rem;
    background: var(--t-danger);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    font-weight: 600;
    margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════════ */
/* PANELES DE INFORMACIÓN                                            */
/* ══════════════════════════════════════════════════════════════════ */

.t-info-panel {
    background: white;
    border-radius: var(--t-border-radius);
    box-shadow: var(--t-shadow-sm);
    padding: var(--t-spacing-md);
    margin-bottom: 0.75rem;
}

.t-info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}

.t-info-row:last-child {
    border-bottom: none;
}

.t-info-label {
    color: #888;
}

.t-info-value {
    font-weight: 500;
    text-align: right;
}

/* ══════════════════════════════════════════════════════════════════ */
/* ESTADOS VACÍOS                                                    */
/* ══════════════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #aaa;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.3;
    display: block;
}

.empty-state h5 {
    color: #999;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════════════════ */
/* ALERTAS                                                            */
/* ══════════════════════════════════════════════════════════════════ */

#alertContainer {
    margin-bottom: var(--t-spacing-md);
}

/* ══════════════════════════════════════════════════════════════════ */
/* BOTONES PERSONALIZADOS                                            */
/* ══════════════════════════════════════════════════════════════════ */

.btn-autorizar,
.btn-validar {
    background: var(--t-success);
    border-color: var(--t-success);
    color: white;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.btn-autorizar:hover,
.btn-validar:hover {
    background: #157347;
    border-color: #146c43;
    color: white;
}

.btn-rechazar {
    background: var(--t-danger);
    border-color: var(--t-danger);
    color: white;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.btn-rechazar:hover {
    background: #bb2d3b;
    border-color: #b02a37;
    color: white;
}

/* ══════════════════════════════════════════════════════════════════ */
/* FILTROS                                                            */
/* ══════════════════════════════════════════════════════════════════ */

.filters-card {
    background: white;
    border-radius: var(--t-border-radius);
    box-shadow: var(--t-shadow-sm);
    padding: var(--t-spacing-md);
    margin-bottom: var(--t-spacing-md);
}

.filters-card .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.3rem;
}

.filters-card .form-control,
.filters-card .form-select {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
}

/* ══════════════════════════════════════════════════════════════════ */
/* PAGINACIÓN                                                         */
/* ══════════════════════════════════════════════════════════════════ */

.pagination {
    margin-top: 1.5rem;
    justify-content: center;
}

.pagination .page-link {
    color: var(--t-primary);
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--t-primary);
    border-color: var(--t-primary);
}

/* ══════════════════════════════════════════════════════════════════ */
/* CAMBIOS DE SALDO (colores)                                        */
/* ══════════════════════════════════════════════════════════════════ */

.saldo-change {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.saldo-positive {
    background: #d4edda;
    color: #155724;
}

.saldo-negative {
    background: #f8d7da;
    color: #721c24;
}

/* ══════════════════════════════════════════════════════════════════ */
/* EVITAR ZOOM EN INPUTS EN iOS (tamaño mínimo 16px)                */
/* ══════════════════════════════════════════════════════════════════ */

@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ══════════════════════════════════════════════════════════════════ */
/* RESPONSIVE                                                         */
/* ══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .t-content {
        padding: 0.75rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .t-action-card h3 {
        font-size: 0.95rem;
    }
    
    .t-action-card p {
        font-size: 0.8rem;
    }
}

@media (max-width: 400px) {
    .t-content {
        padding: 0.5rem;
    }
}

/* ══════════════════════════════════════════════════════════════════ */
/* UTILIDADES                                                         */
/* ══════════════════════════════════════════════════════════════════ */

.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: var(--t-primary) !important;
}

.text-success {
    color: var(--t-success) !important;
}

.text-danger {
    color: var(--t-danger) !important;
}

/* Ocultar elementos en móvil */
@media (max-width: 576px) {
    .hide-mobile {
        display: none !important;
    }
}