/* Header placé à droite de la sidebar */
.site-header {
    position: fixed;
    top: 0;
    left: 250px; /* par défaut sidebar ouverte */
    right: 0;
    height: 70px;
    background: white;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    z-index: 1001;
    padding: 0 20px;
    box-sizing: border-box;
    transition: left 0.3s ease;
}

/* Quand la sidebar est fermée (collapsed) */
body.sidebar-collapsed .site-header {
    left: 60px; /* se décale à gauche quand sidebar fermée */
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: none;
    padding: 0;
}

.site-header .logo {
    margin-left: 10px;
    transition: margin-left 0.3s ease;
}

.site-header .logo img {
    height: 40px;
}

.sidebar.collapsed ~ .site-header .logo {
    margin-left: 0;
}

.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.burger-menu span {
    width: 100%;
    height: 3px;
    background: #444;
    transition: all 0.3s ease;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-menu {
    display: flex;
    gap: 20px;
    margin-right: 10px;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    font-size: 14px;
    color: #444;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.nav-menu a:hover {
    color: linear-gradient(135deg, #2d5670 0%, #2f536d 60%, #27577a 90%);
}

/* Notifications Styles */
.notification-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: #444;
    transition: all 0.2s ease;
}
/* Animation au survol */
.notification-bell:hover {
  animation: ring 0.6s ease-in-out;
  color: #1e445c; 
}

/* Définition du mouvement de cloche */
@keyframes ring {
  0% { transform: rotate(0); }
  15% { transform: rotate(15deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(5deg); }
  60% { transform: rotate(-3deg); }
  75% { transform: rotate(2deg); }
  100% { transform: rotate(0); }
}


.notification-bell svg {
    width: 22px;
    height: 22px;
}

.notification-bell.has-new {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-5deg); }
    75% { transform: translateX(3px) rotate(5deg); }
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: white;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 5px;
    border: 2px solid white;
}

.notification-badge.has-new {
    animation: pulse 1s ease-in-out;
}

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

.notification-dropdown {
    position: absolute;
    top: 120%;
    right: -10px;
    background: white;
    width: 380px;
    max-height: 500px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    z-index: 1001;
    margin-top: 8px;
    overflow: hidden;
}

.notification-dropdown.show-animation {
    animation: slideDown 0.3s ease-out;
}

.notification-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    border-left: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
    transform: rotate(45deg);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.mark-all-read {
    background: transparent;
    border: 1px solid linear-gradient(180deg, #0f2c3e 0%, #081b27 60%, #000000 90%);
    color: linear-gradient(180deg, #0f2c3e 0%, #081b27 60%, #000000 90%);
    font-size: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mark-all-read:hover {
    background: linear-gradient(135deg, #1e445c 0%, #19384e 60%, #152e40 90%);
    color: white;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
    background: white;
}

.notification-list.has-scroll::-webkit-scrollbar {
    width: 6px;
}

.notification-list.has-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.notification-list.has-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.notification-list.has-scroll::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
    cursor: pointer;
    position: relative;
    background: white;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.marking-read {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.notification-content {
    flex: 1;
    padding-right: 12px;
}

.notification-message {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    font-weight: 500;
}

.notification-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: #6c757d;
    display: block;
}

.notification-meta {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.notification-item-body {
    flex: 1;
    min-width: 0;
}

.notification-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 10px;
}

.notification-action {
    background: linear-gradient(180deg, #0f2c3e 0%, #081b27 60%, #000000 90%);
    color: white;
    border: none;
    border-radius: 4px;
    min-width: 60px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 500;
}

.btn-view {
    background: transparent;
    border: 1px solid #1e445c;
    color: #1e445c !important;
    font-size: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none;
}

.btn-view:hover {
    background: linear-gradient(135deg, #1e445c 0%, #19384e 60%, #152e40 90%);
    color: white !important;
    color: white !important;
    box-shadow: 0 4px 8px rgba(30, 68, 92, 0.4);
}

.notification-action svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.notification-action span {
    white-space: nowrap;
}

.notification-action:hover {
    background: linear-gradient(180deg, #0f2c3e 0%, #081b27 60%, #000000 90%);
    transform: scale(1.05);
}

.notification-action:active {
    transform: scale(0.98);
}

.no-notifications {
    padding: 50px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
    margin: 0;
}

.notification-footer {
    border-top: 1px solid #eee;
    padding: 12px 18px;
    text-align: center;
    background: #f8f9fa;
}

.notification-footer a {
    color: linear-gradient(135deg, #1e445c 0%, #19384e 60%, #152e40 90%);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.notification-footer a:hover {
    color: linear-gradient(135deg, #568aaa 0%, #19384e 60%, #152e40 90%);
    text-decoration: underline;
}

.notification-icon-type {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f8f9fa;
    flex-shrink: 0;
    margin-right: 12px;
    transition: all 0.2s ease;
}

/* Settings Styles */
.settings-dropdown {
    position: relative;
    display: inline-block;
}

.settings-menu {
    display: none;
    position: absolute;
    top: 120%;
    right: -10px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    min-width: 180px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 5px 10px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    z-index: 1000;
    padding: 10px 0;
    margin-top: 8px;
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    transform: rotate(45deg);
    z-index: 10;
}

.settings-menu a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    text-decoration: none;
    color: #2c3e50;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    margin: 2px 8px;
    transition: background 0.3s ease, color 0.3s ease;
}

.settings-menu a:hover {
    background-color: #f0f0f0;
    color: linear-gradient(180deg, #0f2c3e 0%, #081b27 60%, #000000 90%);
    box-shadow: none;
}

.settings-menu a:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 4px;
    padding-bottom: 16px;
}

.settings-dropdown a img.settings-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.4s ease;
}

.settings-dropdown a:hover img.settings-icon {
    transform: rotate(360deg);
}

.settings-text {
    display: none;
}

/* Login Button */
.nav-link.btn-login {
    position: relative;
    padding: 8px 18px;
    border-radius: 25px;
    background: linear-gradient(90deg, #0a1419 0%, #1f2b38 50%, #0a1419 100%);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    overflow: hidden;
    display: inline-block;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nav-link.btn-login::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
    transition: none;
}

.nav-link.btn-login:hover::before {
    left: 100%;
    transition: left 1s ease;
}

.nav-link.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Logout Button */
.settings-menu a img.logout-icon {
    width: 16px;
    height: 16px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Contenu principal doit commencer sous le header */
.main-content .content {
    padding-top: 70px; /* hauteur du header */
}

/* Media Queries */
@media (max-width: 768px) {
    .site-header {
        left: 60px;
        padding: 0 15px;
        height: 60px;
    }
    
    body.sidebar-collapsed .site-header {
        left: 60px;
    }

    .burger-menu {
        display: flex;
    }
    
    /* Container flex pour garder les icônes visibles */
    .site-header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    
    /* Logo visible et bien dimensionné sur mobile */
    .site-header .logo {
        margin-left: 0;
        flex-shrink: 0;
    }
    
    .site-header .logo img {
        height: 35px;
        width: auto;
        display: block;
    }
    
    /* Zone des icônes toujours visible à droite */
    .nav-menu {
        display: flex !important;
        position: static;
        height: auto;
        width: auto;
        background: transparent;
        flex-direction: row;
        align-items: center;
        padding: 0;
        box-shadow: none;
        transform: none;
        opacity: 1;
        gap: 8px;
        margin-right: 0;
    }
    
    /* Les icônes notifications et settings restent visibles */
    .notification-icon-wrapper,
    .settings-dropdown {
        order: 0;
        width: auto;
        margin: 0;
    }
    
    /* Cache le texte "Paramètres" sur mobile */
    .settings-text {
        display: none !important;
    }
    
    /* Bouton login caché sur mobile (accessible via sidebar) */
    .nav-link.btn-login {
        display: none;
    }

    .notification-dropdown {
        width: calc(100vw - 40px);
        max-width: 400px;
        right: 10px;
        left: auto;
    }

    .notification-dropdown::before {
        right: 15px;
        left: auto;
    }

    .notification-item {
        padding: 12px 15px;
    }

    .notification-icon-type {
        width: 32px;
        height: 32px;
        font-size: 18px !important;
    }

    .settings-menu {
        right: -10px;
        width: 180px;
    }

    .settings-menu::before {
        right: 20px;
    }
}

@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 20px);
        max-width: none;
        right: 10px;
    }

    .notification-dropdown::before {
        right: 15px;
    }
    
    .settings-menu {
        width: 160px;
    }
}

@media (min-width: 769px) {
    .settings-dropdown a img.settings-icon {
        top: 2px;
    }
}

/* --- HEADER ET BURGER --- */
.sidebar-header {
    padding: 15px 15px 15px 3px; /* top right bottom left */
    text-align: left; /* Aligné à gauche */
}

.burger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 10px; /* espace à gauche */
}

.burger-menu span {
    width: 100%;
    height: 3px;
    background: white;
    transition: all 0.3s ease;
}

/* --- CROIX PAR DÉFAUT (menu ouvert) --- */
.burger-menu span:nth-child(2) {
    opacity: 0;
}

.burger-menu span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* --- Quand le menu est fermé (sidebar.collapsed) → icône burger classique --- */
.sidebar.collapsed .burger-menu span {
    transform: none;
    opacity: 1;
}

/* --- USER INFO --- */
.user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #6c63ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.user-role {
    font-size: 14px;
    text-transform: uppercase;
    color: white;
}

.sidebar.collapsed .user-info .user-role,
.sidebar.collapsed .nav-text {
    display: none;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .main-content {
        margin-left: 60px;
    }

    .user-role,
    .nav-text {
        display: none;
    }
}

/* Dark mode overrides for header and notifications */
.dark .site-header {
    background: #151b2b;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dark .site-header .logo img { 
    filter: brightness(1.1) contrast(1.05); 
}

.dark .burger-menu span {
    background: #e6eef8;
}

.dark .nav-menu a {
    color: #e6eef8;
}

.dark .nav-menu a:hover { 
    color: #22c55e;
}

/* Settings icon visibility improvement */
.dark .settings-dropdown a img.settings-icon {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.dark .settings-dropdown a:hover img.settings-icon {
    filter: brightness(0) invert(1) drop-shadow(0 0 8px #22c55e);
    opacity: 1;
}

.dark .settings-menu {
    background: linear-gradient(135deg, #1a2332 0%, #151b2b 100%);
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.1);
}

.dark .settings-menu::before {
    background-color: #1a2332;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.dark .settings-menu a {
    color: #e6eef8;
}

.dark .settings-menu a:hover {
    background-color: #1f2937;
    color: #22c55e;
}

.dark .logout-icon {
    filter: brightness(0) invert(1);
}

/* Notification bell */
.dark .notification-bell {
    color: #e6eef8;
}

.dark .notification-bell:hover {
    color: #22c55e;
}

.dark .notification-bell svg {
    filter: drop-shadow(0 0 2px rgba(230, 238, 248, 0.3));
}

.dark .notification-dropdown,
.dark .notification-list,
.dark .notification-item {
    background: #1a2332;
    color: #e6eef8;
    border-color: rgba(255,255,255,0.1);
}

.dark .notification-dropdown::before {
    background: #1a2332;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.dark .notification-header {
    background: #151b2b;
    border-bottom-color: rgba(255,255,255,0.1);
}

.dark .notification-header h3 {
    color: #e6eef8;
}

.dark .mark-all-read {
    border-color: #22c55e;
    color: #22c55e;
}

.dark .mark-all-read:hover {
    background: #22c55e;
    color: #ffffff;
}

.dark .notification-footer {
    background: #151b2b;
    border-top-color: rgba(255,255,255,0.1);
}

.dark .notification-footer a {
    color: #22c55e;
}

.dark .notification-footer a:hover {
    color: #16a34a;
}

.dark .notification-item:hover {
    background: #1f2937;
}

.dark .notification-message {
    color: #e6eef8;
}

.dark .notification-time {
    color: #9ca3af;
}

.dark .notification-action {
    background: #22c55e;
    color: #ffffff;
}

.dark .notification-action:hover {
    background: #16a34a;
}

.dark .no-notifications {
    color: #9ca3af;
}

.dark .notification-badge { 
    background: #ef4444; 
    color: #fff; 
    border-color: #151b2b; 
}

.dark .notification-icon-type {
    background: #1f2937;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
}

.theme-toggle label { font-size: 14px; color: var(--muted-text); }

.theme-toggle input[type="checkbox"] { width: 18px; height: 18px; }
