/* Importamos una fuente moderna y elegante de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Variables de color para mantener la consistencia */
:root {
    --primary: #007bff;
    --primary-hover: #0056b3;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --bg-color: #f4f7f8;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
}

/* --- ESTILOS GENERALES --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    box-sizing: border-box;
}

.contenedor {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); /* Sombra suave y moderna */
    box-sizing: border-box;
}

/* --- ESTILO MEJORADO PARA EL LOGIN Y REGISTRO --- */
.contenedor.pequeno { max-width: 600px; }
.contenedor.login-box { 
    max-width: 380px; 
    margin: 8vh auto; 
    padding: 40px 30px;
    border-top: 5px solid var(--primary); /* Detalle de color superior */
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

h2, h3, h4 { color: #111; margin-top: 0; }

hr { border: 0; border-top: 1px solid var(--border-color); margin: 25px 0; }

/* --- BOTONES Y ENLACES --- */
button, .btn-accion, .btn-salir, .btn-unirse, .btn-submit, .btn-calc {
    display: inline-block;
    padding: 12px 18px; /* Más grandes para tocarlos fácil en el tlf */
    border: none;
    border-radius: 8px; /* Más redondeados */
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    text-align: center;
}

.btn-salir { background: var(--danger); color: white; }
.btn-salir:hover { background: #c82333; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(220,53,69,0.3); }

.btn-accion { margin-right: 5px; margin-bottom: 5px; }
.btn-accion:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }

.btn-submit { background: var(--primary); color: white; width: 100%; font-size: 16px; margin-top: 15px; }
.btn-submit:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,123,255,0.3); }

.volver { color: var(--text-muted); text-decoration: none; font-weight: 600; display: inline-block; margin-bottom: 20px; transition: color 0.3s ease; }
.volver:hover { color: var(--primary); }

/* --- MENÚ DE NAVEGACIÓN --- */
.menu-lista {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 15px;
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap; /* Para que bajen a la otra línea si no caben */
}
.menu-lista a { color: var(--primary); text-decoration: none; font-weight: 600; transition: color 0.3s ease; }
.menu-lista a:hover { color: var(--primary-hover); }

/* --- TABLAS ELEGANTES --- */
.tabla-sanes, .tabla-pagos {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 15px;
}
.tabla-sanes th, .tabla-sanes td, .tabla-pagos th, .tabla-pagos td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.tabla-sanes th, .tabla-pagos th { background-color: #f8f9fa; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.tabla-sanes tbody tr:hover, .tabla-pagos tbody tr:hover { background-color: #fbfbfc; }

/* --- ETIQUETAS (BADGES) --- */
.badge { padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; display: inline-block; }
.badge-abierto { background-color: rgba(40, 167, 69, 0.15); color: #1e7e34; }
.badge-activo { background-color: rgba(0, 123, 255, 0.15); color: #0056b3; }
.badge-finalizado { background-color: rgba(108, 117, 125, 0.15); color: #495057; }
.badge-pagado { background-color: rgba(40, 167, 69, 0.15); color: #1e7e34; }
.badge-pendiente { background-color: rgba(220, 53, 69, 0.15); color: #bd2130; }

/* --- TARJETAS (VITRINA) --- */
.grid-tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 15px; }
.tarjeta { border: 1px solid var(--border-color); padding: 25px; border-radius: 10px; text-align: center; background: white; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.tarjeta:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.tarjeta .precio { font-size: 28px; font-weight: 700; color: var(--success); margin-bottom: 10px; }

/* --- FORMULARIOS --- */
input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="password"], select {
    width: 100%;
    padding: 14px; /* Más espacio para dedos en móviles */
    margin: 8px 0 15px 0;
    border: 1px solid #ced4da;
    border-radius: 8px; /* Bordes suaves */
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-size: 15px;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,123,255,0.15); }

/* --- ALERTAS --- */
.alert { padding: 15px; border-radius: 8px; font-weight: 600; margin-bottom: 20px; text-align: center; }
.alert-success { color: #155724; background-color: #d4edda; border: 1px solid #c3e6cb; }
.alert-error { color: #721c24; background-color: #f8d7da; border: 1px solid #f5c6cb; }

/* --- MODAL --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(3px); overflow-y: auto; }
.modal-contenido { background-color: white; margin: 8% auto; padding: 30px; border-radius: 12px; width: 500px; max-width: 90%; box-shadow: 0 10px 30px rgba(0,0,0,0.2); position: relative; animation: deslizarAbajo 0.3s ease-out; }
.cerrar-modal { position: absolute; right: 20px; top: 15px; color: #aaa; font-size: 28px; font-weight: bold; cursor: pointer; transition: color 0.3s ease; }
.cerrar-modal:hover { color: var(--danger); }
@keyframes deslizarAbajo { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Utilidades para Cronograma y Creación */
.caja-generador { background: #f8f9fa; padding: 20px; border-radius: 8px; margin-bottom: 20px; border-left: 5px solid var(--success); }
.fila-doble { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.fechas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
details { background: #fff; border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 15px; padding: 15px; transition: all 0.3s ease; }
summary { font-weight: 600; font-size: 16px; cursor: pointer; outline: none; }


/* =======================================================
   REGLAS PARA TELÉFONOS MÓVILES (RESPONSIVE DESIGN)
   ======================================================= */
@media (max-width: 768px) {
    body { padding: 10px; }
    
    .contenedor { padding: 20px; }
    
    /* El header cambia de estar al lado a estar uno debajo del otro */
    .header { flex-direction: column; gap: 15px; text-align: center; }
    
    /* El menú de opciones se vuelve vertical */
    .menu-lista { flex-direction: column; text-align: center; padding: 15px; }
    
    /* Las tablas en móviles se rompen. Las volvemos deslizables horizontalmente */
    .tabla-sanes, .tabla-pagos {
        display: block;
        overflow-x: auto;
        white-space: nowrap; /* Evita que el texto se apelmace */
    }

    /* Grillas dobles pasan a ser de 1 sola columna */
    .fila-doble, .fechas-grid {
        grid-template-columns: 1fr;
    }
    
    /* Adaptaciones de la caja de generador de fechas */
    .caja-generador > div {
        grid-template-columns: 1fr !important;
    }

    /* El resumen del cronograma (Administrador) se adapta */
    details summary {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    /* Las tarjetas de participantes en el cronograma bajan el botón */
    details .badge-pendiente, details .badge-pagado { margin-bottom: 10px; display: block; text-align: center; }
    details > div > div { flex-direction: column; align-items: flex-start !important; gap: 10px; }
}