/* public/css/style.css */

:root {
    --neo-muro: #334155;      
    --neo-azul: #0284c7;      
    --neo-azul-claro: #e0f2fe;
    --neo-arena: #f8fafc;     
    --neo-pelota: #d9f99d;    
    --neo-pelota-hover: #bef264; 
    --borde: #e2e8f0;
    --texto-oscuro: #1e293b;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--neo-arena);
    color: var(--texto-oscuro);
    margin: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ================= COMPONENTES GENERALES ================= */

.alert-error {
    width: 100%;
    max-width: 1100px;
    background-color: #fef2f2;
    color: #991b1b;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #fecaca;
    font-size: 13px;
    box-sizing: border-box;
}

.header-container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--neo-muro);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.brand-container { display: flex; flex-direction: column; }

.brand-title {
    margin: 0;
    font-size: 28px;
    letter-spacing: -1px;
    color: white;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.brand-neo { font-weight: 800; }
.brand-med { font-weight: 300; font-size: 18px; color: #38bdf8; letter-spacing: 0; }

.user-info { font-size: 13px; color: #94a3b8; margin-top: 2px; }
.user-info strong { color: white; }

.logout-btn {
    color: #f87171;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 8px;
    background-color: rgba(239, 68, 68, 0.1);
    transition: all 0.2s;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.logout-btn:hover { background-color: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* ================= TABLA DE RESERVAS (ULTRA-COMPACTA Y RESPONSIVE) ================= */

.table-wrapper {
    width: 100%;
    max-width: 1100px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    border: 1px solid var(--borde);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table { 
    border-collapse: collapse; 
    width: 100%; 
    min-width: 850px; 
}

th { 
    border-bottom: 2px solid var(--borde); 
    border-right: 1px solid var(--borde);
    padding: 10px 8px; 
    text-align: center; 
    font-weight: 600;
    background-color: #f8fafc;
}
th:last-child { border-right: none; }

/* Celdas ultra ajustadas en vertical */
td { 
    border: 1px solid var(--borde); 
    text-align: center; 
    padding: 3px 2px; 
    vertical-align: middle; 
    font-size: 12px; 
}

/* Columna de hora fija (Sticky) */
.hora-celda { 
    padding: 6px; 
    background-color: #f8fafc; 
    font-weight: bold; 
    color: #64748b;
    vertical-align: middle; 
    font-size: 12px; 
    white-space: nowrap; 
    width: 80px;
    min-width: 80px;
    
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid var(--borde);
    box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}

/* Celdas Libres */
.celda-libre { 
    background-color: var(--neo-azul-claro); 
    transition: all 0.2s; 
}

.celda-libre a { 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none; 
    width: 100%; 
    height: 100%; 
    padding: 4px 2px; 
    box-sizing: border-box; 
}

.btn-reservar {
    background-color: var(--neo-pelota);
    color: #3f6212;
    padding: 3px 10px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.1s, background-color 0.2s;
    margin-bottom: 1px;
}
.celda-libre:hover .btn-reservar { background-color: var(--neo-pelota-hover); transform: scale(1.03); }
.celda-libre small { color: var(--neo-azul); font-weight: 600; font-size: 10px; }

/* Celdas Ocupadas */
.celda-ocupada { background-color: white; padding: 3px; }

.lista-jugadores { 
    margin: 0 0 2px 0; 
    padding: 2px 4px; 
    list-style: none; 
    text-align: left; 
    background: #f1f5f9; 
    border-radius: 4px; 
    border: 1px solid var(--borde);
}
.lista-jugadores li { 
    font-size: 10px; 
    color: #475569; 
    margin-bottom: 1px; 
    font-weight: 500;
    line-height: 1.1;
}
.lista-jugadores li:last-child { margin-bottom: 0; }

/* Botones de acción en tabla */
.celda-ocupada a { 
    text-decoration: none; 
    display: inline-block; 
    font-weight: 600; 
    padding: 2px 4px; 
    border-radius: 4px;
    font-size: 10px;
    transition: all 0.2s;
    width: calc(100% - 4px);
    box-sizing: border-box;
}

.btn-unirme { color: #3f6212; background-color: var(--neo-pelota); margin-top: 1px;}
.btn-unirme:hover { background-color: var(--neo-pelota-hover); }

.btn-editar { color: var(--neo-azul); background-color: var(--neo-azul-claro); margin-bottom: 1px; }
.btn-editar:hover { background-color: #bae6fd; }

.btn-baja { color: #c2410c; background-color: #ffedd5; }
.btn-baja:hover { background-color: #fed7aa; }

.btn-cancelar { color: #dc2626; background-color: #fee2e2; }
.btn-cancelar:hover { background-color: #fecaca; }

.span-completo { 
    display:block; 
    margin-top:2px; 
    font-size:9px; 
    font-weight:700; 
    color: #94a3b8; 
    background: #f8fafc;
    padding: 2px;
    border-radius: 3px;
    border: 1px dashed #cbd5e1;
}

.th-hoy { background-color: #f8fafc !important; color: var(--neo-azul); font-size: 13px; }
.th-manana { background-color: #f1f5f9 !important; color: #64748b; font-size: 13px; }

/* ================= FORMULARIOS (CREAR Y EDITAR) ================= */

.form-container { 
    width: 100%;
    max-width: 500px; 
    margin: 30px auto; 
    background: white; 
    padding: 25px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--borde);
    box-sizing: border-box;
}

.form-container h2 { color: var(--neo-muro); margin-top: 0; margin-bottom: 15px; font-size: 20px; }
.form-container p { color: #475569; font-size: 13px; margin-bottom: 12px; }

.form-group { margin: 12px 0; }

label { 
    font-weight: 600; 
    color: #475569; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 13px; 
    margin-bottom: 6px;
    cursor: pointer;
}

input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--neo-azul); }

input[type="text"], select, input[type="date"] { 
    width: 100%; 
    padding: 8px 10px; 
    border: 1px solid var(--borde); 
    border-radius: 8px; 
    box-sizing: border-box; 
    font-family: inherit; 
    font-size: 13px;
    color: var(--texto-oscuro);
    background-color: #f8fafc;
    transition: border-color 0.2s;
}
input[type="text"]:focus, select:focus { outline: none; border-color: var(--neo-azul); background-color: white; }

button[type="submit"] { 
    background-color: var(--neo-azul); 
    color: white; 
    border: none; 
    padding: 10px 15px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 700; 
    width: 100%; 
    font-size: 14px; 
    transition: background 0.2s; 
    margin-top: 8px;
}
button[type="submit"]:hover { background-color: #0369a1; }

.btn-volver { 
    display: inline-block; 
    margin-top: 15px; 
    color: #64748b; 
    text-decoration: none; 
    font-size: 13px; 
    font-weight: 600; 
    transition: color 0.2s;
}
.btn-volver:hover { color: var(--neo-azul); }

/* ================= CUADRÍCULA 2x2 PARA JUGADORES ================= */
.celda-ocupada {
    background-color: white; 
    padding: 6px !important; /* Le damos un poco más de aire a la celda */
    vertical-align: top;
}

ul.lista-jugadores-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* Forzamos exactamente 2 columnas */
    gap: 4px; 
    list-style: none;
    padding: 0;
    margin: 0 0 6px 0; /* Separación por debajo para dejar sitio a los botones */
    width: 100%;
}

ul.lista-jugadores-grid li {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px;
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    height: 24px; /* Forzamos una altura fija para que queden alineados */
    box-sizing: border-box;
}

ul.lista-jugadores-grid li.slot-libre {
    background: #fef2f2;
    border: 1px dashed #fca5a5;
    color: #ef4444;
}

.truncar-texto {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
    flex-grow: 1;
    text-align: left;
}