/* css/style.css - GymSystem Dashboard Layout */
:root {
    --primary: #06b6d4; --dark: #0f172a; --darker: #020617; --light: #f1f5f9;
    --white: #ffffff; --green: #22c55e; --red: #ef4444; --gray: #64748b;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--light); color: #334155; display: flex; min-height: 100vh; }

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--darker);
    color: white;
    display: flex; 
    flex-direction: column;
    position: fixed; 
    height: 100vh; /* Ocupa toda la altura */
    left: 0; 
    top: 0; 
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    transition: 0.3s;
    
    /* 💥 LA CORRECCIÓN: */
    overflow-y: auto; /* Permite hacer scroll si el contenido es muy largo */
    
    /* Opcional: Estilo para que la barra de scroll sea finita y elegante */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--darker);
}

/* Para asegurar que el calendario no se aplaste si hay poco espacio */
.calendar-widget {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    flex-shrink: 0; /* Esto evita que el calendario se achique */
    margin-bottom: 40px; /* Un poco de aire al final */
}

.brand { padding: 20px; font-size: 1.4rem; font-weight: 800; border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 10px; color: var(--primary); }
.brand span { color: white; font-size: 0.8rem; background: var(--primary); padding: 2px 6px; border-radius: 4px; }

.nav-menu { list-style: none; padding: 20px 0; flex-grow: 1; }
.nav-item a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; color: #94a3b8; text-decoration: none;
    transition: 0.2s; border-left: 4px solid transparent;
}
.nav-item a:hover, .nav-item a.active {
    background: rgba(255,255,255,0.05); color: white; border-left-color: var(--primary);
}

/* Widget Calendario en Sidebar */
.cal-header { font-weight: bold; margin-bottom: 10px; color: var(--primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; font-size: 0.8rem; color: #64748b; }
.cal-day { padding: 4px; }
.cal-today { background: var(--primary); color: white; border-radius: 50%; font-weight: bold; }

/* --- MAIN CONTENT --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    width: calc(100% - var(--sidebar-width));
    transition: 0.3s;
}

/* Hero Section del Dashboard */
.dashboard-hero {
    height: 200px;
    background-image: linear-gradient(to right, rgba(15,23,42,0.9), rgba(15,23,42,0.6)), url('../../img/hero-gym.jpg');
    background-size: cover; background-position: center;
    color: white; padding: 40px;
    display: flex; flex-direction: column; justify-content: center;
}
.dashboard-hero h2 { font-size: 2rem; margin-bottom: 5px; }
.dashboard-hero p { opacity: 0.8; }

.container { max-width: 1200px; margin: -30px auto 20px auto; padding: 0 20px; position: relative; z-index: 10; }

/* --- RESTO DE ESTILOS (Tarjetas, Buscador) --- */
.search-bar-container { background: white; padding: 15px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 20px; display:flex; gap: 10px; }
.search-box { flex-grow: 1; display: flex; gap: 10px; }
.search-input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; }

.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.member-card { background: white; border-radius: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow: hidden; border-left: 5px solid #ccc; }
.status-active { border-left-color: var(--green); }
.status-expired { border-left-color: var(--red); }
.card-header { padding: 15px; display:flex; justify-content:space-between; align-items:flex-start; border-bottom: 1px solid #f0f0f0;}
.member-name { font-weight: 700; font-size: 1.1rem; margin:0;}
.card-body { padding: 15px; }
.card-actions { padding: 15px; background: #f8fafc; display:flex; gap:10px;}
/* Botones de acción flotantes (Edición/Borrado) */
.card-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    background: rgba(255,255,255,0.9);
    padding: 4px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-mini {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; text-decoration: none; color: var(--gray);
    transition: 0.2s; font-size: 0.9rem;
}
.btn-mini:hover { background: #f1f5f9; color: var(--primary); }
.btn-mini.delete:hover { background: #fee2e2; color: var(--red); }
/* Botones */
.btn { padding: 8px 15px; border-radius: 6px; text-decoration: none; font-weight: 600; border: none; cursor: pointer; color: white; font-size: 0.9rem; display:inline-flex; align-items:center; gap:5px;}
.btn-add { background: var(--primary); }
.btn-search { background: var(--dark); }
.btn-pay { background: var(--dark); width:100%; justify-content:center;}
.btn-icon { width: 35px; height: 35px; display:flex; justify-content:center; align-items:center; border-radius:6px; }
.btn-whatsapp { background: #dcfce7; color: #16a34a; }

/* =========================================
   ESTILOS DEL MODAL (Pop-up)
   ========================================= */

.modal-overlay {
    position: fixed;        /* Fijo respecto a la pantalla */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Fondo negro semitransparente */
    backdrop-filter: blur(3px);     /* Efecto borroso de fondo */
    z-index: 3000;          /* Por encima de todo (Sidebar tiene 1000) */
    
    /* Centrado del contenido */
    display: flex;
    justify-content: center;
    align-items: center;

    /* ESTADO INICIAL: OCULTO */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Para que no bloquee clics cuando está oculto */
    transition: all 0.3s ease;
}

/* ESTADO ACTIVO: VISIBLE (Se activa con JS) */
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* La cajita blanca del modal */
.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transform: translateY(-20px); /* Efecto de entrada */
    transition: transform 0.3s ease;
    position: relative;
}

/* Animación al entrar */
.modal-overlay.active .modal-content {
    transform: translateY(0);
}

/* =========================================
   ESTILOS PARA TABLA DE DATOS (BASE DE DATOS)
   ========================================= */

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid #cbd5e1; /* Borde exterior más visible */
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Estilo de Tabla "Grilla" (con líneas) */
.data-table {
    width: 100%;
    border-collapse: collapse; /* Une los bordes para que se vean finos */
    min-width: 900px;
    font-size: 0.9rem;
}

/* Cabeceras con borde */
.data-table th {
    background: var(--dark); /* O usa #1e293b si prefieres */
    color: white;
    text-align: left;
    padding: 12px 15px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    border: 1px solid #334155; /* Borde oscuro para separar cabeceras */
}

/* Celdas con borde (Líneas de separación) */
.data-table td {
    padding: 10px 15px;
    border: 1px solid #e2e8f0; /* Borde gris claro en todas las celdas */
    vertical-align: middle;
    color: #334155;
}

/* Efecto Hover en filas */
.data-table tr:hover {
    background-color: #f1f5f9;
}

/* --- CORRECCIÓN DE FOTOS --- */
/* Forzamos el tamaño en cualquier imagen dentro de la tabla */
.data-table img, 
.table-avatar {
    width: 50px !important;  /* Ancho fijo */
    height: 50px !important; /* Alto fijo */
    object-fit: cover;       /* Recorta la imagen para que no se estire */
    border-radius: 50%;      /* Círculo perfecto */
    border: 2px solid #e2e8f0;
    display: block;
}

/* Badges pequeños */
.badge-sm {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
}

/* Ajuste para pantallas muy chicas */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

/* Mobile Toggle */
.menu-toggle { display: none; position: fixed; top: 15px; right: 15px; z-index: 2000; background: var(--primary); border:none; color:white; padding:10px; border-radius:5px;}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .menu-toggle { display: block; }
}