/* Theme MECASOS Premium */
:root {
    /* Couleurs principales (reprises de l'app) */
    --primary-gold: #E1A004;
    --primary-dark: #1D1D1B;
    --secondary-gold: #F5B800;
    
    /* Couleurs dashboard */
    --bg-dark: #0A0A0A;
    --bg-card: #1A1A1A;
    --bg-hover: #252525;
    
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;
    
    /* Status colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    
    /* Gradients premium */
    --gradient-gold: linear-gradient(135deg, #E1A004 0%, #F5B800 100%);
    --gradient-dark: linear-gradient(180deg, #1A1A1A 0%, #0A0A0A 100%);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(225, 160, 4, 0.1);
    --shadow-md: 0 4px 16px rgba(225, 160, 4, 0.15);
    --shadow-lg: 0 8px 32px rgba(225, 160, 4, 0.2);
    
    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Sidebar variables */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 70px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid rgba(225, 160, 4, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 80px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-gold);
    margin: 0;
    line-height: 1;
}

.brand-subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary-gold);
}

/* Sidebar Toggle Button (Desktop only) */
.sidebar-collapse-toggle {
    display: none;
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--primary-gold);
    color: var(--primary-gold);
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 993px) {
    .sidebar-collapse-toggle {
        display: flex;
    }
}

.sidebar-collapse-toggle:hover {
    background: var(--primary-gold);
    color: var(--primary-dark);
    transform: translateY(-50%) scale(1.1);
}

.sidebar-collapse-toggle i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

/* Sidebar States */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .search-wrapper,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-collapse-toggle::before {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-collapse-toggle i {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.sidebar.collapsed .nav-item-icon {
    margin: 0;
}

/* Collapsed sidebar tooltips */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1002;
    border: 1px solid var(--primary-gold);
    margin-left: 10px;
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

/* Search Bar */
.sidebar-search {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.75rem 2.5rem 0.75rem 2.75rem;
    border-radius: 10px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-gold);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px rgba(225, 160, 4, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-kbd {
    position: absolute;
    right: 0.75rem;
    background: var(--bg-hover);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: 'SF Mono', 'Monaco', monospace;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 0;
}

.nav-section-title {
    display: block;
    padding: 0.75rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Nav Items */
.nav-item,
.nav-item-wrapper {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    gap: 0.75rem;
}

.nav-item:hover,
.nav-item-wrapper:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(225, 160, 4, 0.15) 0%, transparent 100%);
    color: var(--primary-gold);
    border-left: 3px solid var(--primary-gold);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-gold);
    box-shadow: 0 0 10px var(--primary-gold);
}

.nav-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-item-text {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.nav-item.has-submenu.active .nav-arrow {
    transform: rotate(180deg);
}

/* Badges */
.nav-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 12px;
    background: var(--primary-gold);
    color: var(--primary-dark);
    margin-left: auto;
}

.badge-warning {
    background: #F59E0B;
}

.badge-danger {
    background: #EF4444;
}

.badge-pulse {
    animation: pulse 2s infinite;
}

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

/* Submenu */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.3);
}

.nav-item.has-submenu.active .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem 0.75rem 3.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-subitem:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-subitem.active {
    color: var(--primary-gold);
}

.nav-subitem i {
    font-size: 0.9rem;
}

.nav-subitem span {
    flex: 1;
}

/* Footer */
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-profile {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--bg-dark);
    transition: all 0.3s ease;
}

.user-profile:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-gold);
    object-fit: cover;
}

.user-info {
    flex: 1;
    min-width: 0;
}

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

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.user-menu-btn {
    padding: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.user-menu-btn:hover {
    color: var(--primary-gold);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary-gold);
    border-color: var(--primary-gold);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

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

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .brand-subtitle {
        display: none;
    }

    .search-kbd {
        display: none;
    }
}

/* ============================================
   DROPDOWN CUSTOMIZATION
   ============================================ */

.dropdown-menu-dark {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.dropdown-menu-dark .dropdown-item {
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.dropdown-menu-dark .dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-menu-dark .dropdown-item i {
    font-size: 1rem;
}

.dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   TOPBAR STYLES
   ============================================ */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 70px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 900;
    transition: left 0.3s ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.menu-toggle {
    display: none;
    background: rgba(225, 160, 4, 0.1);
    border: 2px solid rgba(225, 160, 4, 0.3);
    color: var(--primary-gold);
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.menu-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(225, 160, 4, 0.1) 0%, rgba(245, 184, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-toggle:hover {
    background: rgba(225, 160, 4, 0.2);
    border-color: var(--primary-gold);
    color: #F5B800;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 160, 4, 0.3);
}

.menu-toggle:hover::before {
    opacity: 1;
}

.menu-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(225, 160, 4, 0.2);
}

.menu-toggle:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(225, 160, 4, 0.2);
}

.menu-toggle i {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.menu-toggle:hover i {
    transform: scale(1.1);
}

.breadcrumb {
    margin: 0;
    background: transparent;
    padding: 0;
}

.breadcrumb-item {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: var(--primary-gold);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

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

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--primary-gold);
    border-color: var(--primary-gold);
}

.badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #EF4444;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    animation: pulse 2s infinite;
}

.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-gold);
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Notification Dropdown */
.notification-dropdown {
    width: 380px;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dropdown-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-list {
    overflow-y: auto;
    max-height: 350px;
}

.notification-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    text-decoration: none;
    transition: background 0.3s ease;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: rgba(225, 160, 4, 0.05);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.notification-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.dropdown-footer a {
    color: var(--primary-gold);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   SIDEBAR COLLAPSE SYNCHRONIZATION
   ============================================ */

/* Topbar position when sidebar is collapsed (desktop) */
@media (min-width: 993px) {
    .sidebar.collapsed ~ .main-wrapper .topbar {
        left: var(--sidebar-collapsed-width);
    }
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .topbar {
        left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
}

/* ============================================
   QUICK ACTIONS MODAL
   ============================================ */

.quick-action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    margin-bottom: 1rem;
}

.quick-action-card:last-child {
    margin-bottom: 0;
}

.quick-action-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(225, 160, 4, 0.15);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 1.25rem;
}

.action-content {
    flex: 1;
}

.action-content h6 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
    font-weight: 600;
}

.action-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.action-arrow {
    color: var(--primary-gold);
    font-size: 1.1rem;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.quick-action-card:hover .action-arrow {
    opacity: 1;
    transform: translateX(4px);
}