/* dashboard.css - Estilos del Dashboard principal GYM-Nevitec360 */

/* ============================================
   LAYOUT PRINCIPAL: SIDEBAR + CONTENIDO
   ============================================ */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    animation: fadeIn var(--transition-smooth);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 260px;
    min-width: 260px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-main);
}

.nav-item.active {
    background: rgba(0, 229, 255, 0.1);
    color: var(--color-primary);
}

.nav-item.active svg {
    stroke: var(--color-primary);
}

/* Sidebar Footer - Perfil de usuario */
.sidebar-footer {
    padding: 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #000;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 1px 8px;
    border-radius: 10px;
    display: inline-block;
    width: fit-content;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-trainer {
    background: rgba(129, 140, 248, 0.15);
    color: #818cf8;
}

.badge-client {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.btn-logout {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
}

/* Header */
.content-header {
    padding: 20px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 50;
    justify-content: space-between;
}

.header-titles {
    flex: 1;
}

/* ============================================
   NOTIFICACIONES
   ============================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notifications-wrapper {
    position: relative;
    margin-left: auto;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-main);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.btn-icon:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.notification-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-error);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    height: 18px;
    min-width: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--color-bg-card);
}

.notifications-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 340px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.notifications-dropdown.show {
    display: flex;
}

.notif-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-header h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--color-text-main);
}

.btn-small {
    background: var(--color-primary);
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-small:hover {
    box-shadow: 0 0 10px var(--color-primary);
}

.notif-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.notif-empty {
    padding: 30px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.notif-item {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-text {
    font-size: 0.9rem;
    color: var(--color-text-main);
    line-height: 1.4;
    margin-bottom: 8px;
}

.notif-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: flex;
    justify-content: space-between;
}

/* Modal Simple para Notificaciones (Admin) */
.admin-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.admin-modal-overlay.show {
    display: flex;
}

.admin-modal {
    background: var(--color-bg-card);
    width: 100%;
    max-width: 450px;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.admin-modal h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--color-text-main);
}

.admin-modal textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    color: white;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 16px;
}

.admin-modal select {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    color: white;
    font-family: inherit;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.header-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: capitalize;
}

.btn-toggle-sidebar {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-main);
    transition: var(--transition-fast);
}

.btn-toggle-sidebar:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Dashboard Content */
.dashboard-content {
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Banner de bienvenida */
.welcome-banner {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(124, 58, 237, 0.1));
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: var(--border-radius-lg);
    padding: 28px 32px;
    animation: fadeIn 0.5s ease;
}

.welcome-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: 6px;
}

.welcome-text p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-clients .stat-icon {
    background: rgba(0, 229, 255, 0.1);
    color: var(--color-primary);
}

.stat-active .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.stat-today .stat-icon {
    background: rgba(129, 140, 248, 0.1);
    color: #818cf8;
}

.stat-inactive .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text-main);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Paneles de información */
.info-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.panel {
    background: var(--color-bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.panel h3 {
    padding: 18px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-main);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-body {
    padding: 16px 24px;
}

.panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.panel-row:last-child {
    border-bottom: none;
}

.panel-value {
    font-weight: 600;
    color: var(--color-text-main);
}

/* Acciones rápidas */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: var(--border-radius-md);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-action:hover {
    background: rgba(0, 229, 255, 0.15);
    transform: translateX(4px);
}

.btn-action-secondary {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.btn-action-secondary:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
        padding-bottom: 0;
    }

    /* Ocultar el sidebar off-canvas por defecto */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        width: 260px;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        z-index: 1100; /* Por encima del header y overlay */
        padding-bottom: 20px; /* Para que haya scroll libre si caben muchas opciones */
        overflow-y: auto;
    }

    /* Clase que se agregará por JS para mostrar el sidebar */
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-header {
        display: block; /* Volver a mostrar logo en móvil */
        padding: 20px;
    }

    .sidebar-nav {
        flex: 1;
        flex-direction: column;
        padding: 10px;
        justify-content: flex-start;
        align-items: stretch;
    }

    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .sidebar-footer {
        padding: 16px;
        justify-content: space-between;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        border-left: none;
    }

    .user-info {
        display: flex; /* Mostrar de nuevo datos del usuario en sidebar */
    }

    /* Mostrar botón hamburguesa */
    .btn-toggle-sidebar {
        display: flex !important;
        align-items: center;
        justify-content: center;
        margin-right: 12px;
    }

    .content-header {
        padding: 16px 20px;
        justify-content: flex-start;
    }

    .content-header h1 {
        font-size: 1.15rem;
    }

    .header-titles {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0; /* Para elipsis si es necesario */
    }
    
    .header-date {
        font-size: 0.75rem;
    }

    .notifications-wrapper {
        margin-left: auto; /* Mantener notificaciones a la derecha */
    }

    .dashboard-content {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .info-panels {
        grid-template-columns: 1fr;
    }

    .welcome-banner {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Background overlay shadow for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-smooth);
}
.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}