/* Variables spécifiques au dashboard */
:root {
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --content-padding: 2rem;
}

/* ===============================
   LAYOUT PRINCIPAL
   =============================== */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

/* Empêcher le scroll sur mobile */
body.sidebar-open {
    overflow: hidden;
}

/* ===============================
   SIDEBAR
   =============================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: white;
    border-right: 1px solid #e0e0e0;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar.show {
    transform: translateX(0);
}

.sidebar-brand {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.sidebar-brand img {
    max-height: 40px;
}

/* Navigation sidebar - utilise les styles de boutons de style.css */
.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: var(--navy);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    font-weight: 500;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: var(--gold);
    background-color: rgba(212, 175, 121, 0.1);
    border-right-color: var(--gold);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    color: var(--gold);
}

/* ===============================
   TOPBAR
   =============================== */
.topbar {
    height: var(--topbar-height);
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1040;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--navy);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: #f8f9fa;
}

.topbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    text-decoration: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--navy);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    margin-left: 0.5rem;
}

.user-profile:hover {
    background-color: #f8f9fa;
    color: var(--navy);
}

.user-profile i {
    font-size: 1.5rem;
    margin-right: 0.25rem;
}

.user-profile .user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===============================
   ZONE DE CONTENU
   =============================== */
.content-area {
    flex: 1;
    padding: var(--content-padding);
    background-color: white;
    overflow-y: auto;
}

.content-header h1 {
    color: var(--navy);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.content-description {
    color: #6c757d;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* ===============================
   OVERLAY MOBILE
   =============================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

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

/* Desktop - sidebar toujours visible */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
    }
    .main-content {
        margin-left: var(--sidebar-width);
    }
    .sidebar-overlay {
        display: none;
    }
    .sidebar-toggle {
        display: none;
    }
}

@media (max-width: 991px) {
    .sidebar-toggle {
        display: block;
    }
}

@media (max-width: 575px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
    .content-area {
        padding: 1rem;
    }
    .content-header h1 {
        font-size: 1.5rem;
    }
    .topbar {
        padding: 0 1rem;
    }
    .topbar-brand {
        font-size: 1rem;
    }
    .user-profile span {
        display: none;
    }
}

@media (min-width: 576px) and (max-width: 991px) {
    .sidebar {
        width: 280px;
    }
    .content-area {
        padding: 1.5rem;
    }
}

/* ===============================
   SUPPORT RTL (Arabe)
   =============================== */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid #e0e0e0;
    transform: translateX(100%);
}

[dir="rtl"] .sidebar.show {
    transform: translateX(0);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"] .sidebar-nav .nav-link {
    border-right: none;
    border-left: 3px solid transparent;
    text-align: right;
    flex-direction: row-reverse;
}

[dir="rtl"] .sidebar-nav .nav-link:hover,
[dir="rtl"] .sidebar-nav .nav-link.active {
    border-left-color: var(--gold);
    border-right: none;
}

[dir="rtl"] .sidebar-nav .nav-link i {
    margin-right: 0;
    margin-left: 0.75rem;
}

/* RTL Desktop */
@media (min-width: 992px) {
    [dir="rtl"] .sidebar {
        transform: translateX(0);
    }
    [dir="rtl"] .main-content {
        margin-left: 0;
        margin-right: var(--sidebar-width);
    }
}

/* ===============================
   TOPBAR LANGUAGE SWITCHER
   =============================== */
.topbar .lang-switcher {
    display: flex;
    gap: 0.25rem;
    margin-right: 1rem;
}

[dir="rtl"] .topbar .lang-switcher {
    margin-right: 0;
    margin-left: 1rem;
}

[dir="rtl"] .user-profile i {
    margin-right: 0;
    margin-left: 0.25rem;
}

[dir="rtl"] .user-profile {
    margin-left: 0;
    margin-right: 0.5rem;
}
