/**
 * MONCARNETULM - Sidebar Layout CSS
 * Design avec menu latéral
 */

/* ===== Layout avec Sidebar ===== */
body.has-sidebar {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0c4a6e 0%, #0891b2 45%, #f59e0b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sidebar-header-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    width: 100%;
    text-align: center;
}

.sidebar-logo .logo-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.2s;
}

.sidebar-logo:hover .logo-img {
    transform: scale(1.1);
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-logo .logo-text {
    letter-spacing: -0.5px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* ── Standalone section (no collapse) */
.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    display: block;
    padding: 6px 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.75);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* ── Collapsible group */
.nav-group {
    margin-bottom: 2px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    cursor: pointer;
    user-select: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    transition: color 0.2s;
    border-left: 3px solid transparent;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.nav-group-header:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.12);
}

.nav-group-header.has-active {
    color: #fff;
}

.nav-group-icon {
    font-size: 0.95rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-group-label {
    flex: 1;
}

.nav-group-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: transform 0.22s ease;
}

.nav-group.open > .nav-group-header .nav-group-chevron {
    transform: rotate(90deg);
}

.nav-group-content {
    display: none;
    padding-bottom: 4px;
}

.nav-group.open > .nav-group-content {
    display: block;
}

/* Links inside groups are slightly indented */
.nav-group .sidebar-link {
    padding-left: 30px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    text-shadow: 0 1px 3px rgba(0,0,0,0.45);
}

.sidebar-link:hover {
    background: rgba(0, 0, 0, 0.12);
    color: white;
}

.sidebar-link.active {
    background: rgba(251, 191, 36, 0.25);
    color: white;
    border-left-color: #fbbf24;
}

.sidebar-link .link-icon {
    width: 22px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-link .link-text {
    flex: 1;
}

.sidebar-link-admin {
    color: #fbbf24;
}

.sidebar-link-admin:hover {
    color: #fcd34d;
}

/* User profile */
.sidebar-user {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.12);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar span {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

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

.user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.logout-btn {
    padding: 10px;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    transition: all 0.2s ease;
}

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

/* ===== Main Area ===== */
.main-area {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: #f1f5f9;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* ===== Mobile Header ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(90deg, #0c4a6e 0%, #0891b2 60%, #f59e0b 100%);
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.menu-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px;
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.mobile-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-decoration: none;
}

.mobile-profile {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mobile-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-profile span {
    font-size: 1.1rem;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .main-area {
        margin-left: 0;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .content-wrapper {
        padding: 80px 20px 30px;
    }
}

@media (max-width: 640px) {
    .content-wrapper {
        padding: 70px 15px 20px;
    }
    
    .sidebar {
        width: 280px;
    }
}

/* ===== Override old styles ===== */
body.has-sidebar .main-header {
    display: none;
}

body.has-sidebar .main-content {
    padding: 0;
}

body.has-sidebar .main-footer {
    display: none;
}

/* Adapter le container pour le nouveau layout */
body.has-sidebar .container {
    max-width: 100%;
    padding: 0;
}

/* ===== Dashboard Styles for Sidebar Layout ===== */
body.has-sidebar .dashboard-modern {
    max-width: 100%;
    padding: 0;
}

body.has-sidebar .profile-banner {
    margin-bottom: 25px;
}

body.has-sidebar .quick-stats {
    margin-bottom: 25px;
}

body.has-sidebar .dashboard-grid-modern {
    gap: 20px;
}

/* ===== Cards & Sections ===== */
.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
}

.page-header p {
    color: #64748b;
    margin: 0;
}

/* Scrollbar styling for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* Animation for active link */
.sidebar-link.active::after {
    content: '';
    position: absolute;
    right: 15px;
    width: 6px;
    height: 6px;
    background: #fbbf24;
    border-radius: 50%;
}

.sidebar-link {
    position: relative;
}

/* Hover effects */
.sidebar-link:hover .link-icon {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Version dans la sidebar */
.sidebar-version {
    display: none;
}

/* Badge de notification dans le menu */
.notification-badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    min-width: 18px;
    text-align: center;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
