/* ============================================
   LAYOUT.CSS - ANOON PRO Back-Office
   Layout principal avec sidebars et contenu
   ============================================ */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    --primary: #1B4F72;
    --primary-light: #2E6B8A;
    --accent: #E67E22;
    --sidebar-width: 220px;
    --sidebar-collapsed: 60px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: #f5f6fa;
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ============================================
   CONTENEUR PRINCIPAL
   ============================================ */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR 1 - NAVIGATION PRINCIPALE
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: width 0.3s ease;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    overflow: visible;
}

/* ============================================
   SIDEBAR 1 - HEADER AVEC LOGO
   ============================================ */
.sidebar-header {
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 60px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Logo icône : carré orange avec A blanc */
.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

/* Logo texte : ANOON avec OO en orange */
.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.logo-text .orange {
    color: var(--accent);
}

/* PRO : texte orange SANS fond */
.logo-pro {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    margin-left: 6px;
    vertical-align: middle;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-pro {
    display: none;
}

/* ============================================
   SIDEBAR 1 - NAVIGATION
   ============================================ */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.sidebar.collapsed .sidebar-nav {
    overflow: visible;
}

.nav-section {
    margin-bottom: 8px;
}

/* Titres des sections : gris clair */
.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 12px 6px 12px;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

/* Items de navigation */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Item actif : fond BLANC TRANSPARENT */
.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-item i.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item .nav-label {
    white-space: nowrap;
    overflow: hidden;
    flex: 1;
}

.nav-item .chevron {
    font-size: 11px;
    opacity: 0.5;
}

/* Modules verrouillés */
.nav-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-item.locked:hover {
    background: transparent;
    color: rgba(255,255,255,0.7);
}

.nav-item .lock-icon {
    font-size: 10px;
    opacity: 0.6;
}

.sidebar.collapsed .nav-item .nav-label,
.sidebar.collapsed .nav-item .chevron,
.sidebar.collapsed .nav-item .lock-icon {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

/* ============================================
   TOOLTIPS - Position fixed, visibles en collapsed
   ============================================ */
.nav-item .tooltip {
    position: fixed;
    left: 70px;
    background: #2c3e50;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
}

.nav-item .tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #2c3e50;
    border-left: none;
}

.sidebar.collapsed .nav-item:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

.sidebar:not(.collapsed) .nav-item .tooltip {
    display: none;
}

/* ============================================
   SIDEBAR 1 - FOOTER
   ============================================ */
.sidebar-footer {
    padding: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

/* Bouton réduire/étendre */
.sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar.collapsed .sidebar-toggle {
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle span {
    display: none;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* Profil utilisateur */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-top: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-profile:hover {
    background: rgba(255,255,255,0.1);
}

/* Avatar : ORANGE */
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.user-info {
    overflow: hidden;
}

.user-info .name {
    color: white;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

.user-info .role {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

.sidebar.collapsed .user-info {
    display: none;
}

/* ============================================
   DROPDOWN UTILISATEUR
   ============================================ */
.user-dropdown {
    position: absolute;
    bottom: 80px;
    left: 8px;
    right: 8px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px;
    display: none;
    z-index: 1000;
}

.user-dropdown.show {
    display: block;
}

.sidebar.collapsed .user-dropdown {
    left: 8px;
    right: auto;
    width: 200px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #2c3e50;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.user-dropdown-item:hover {
    background: #f5f6fa;
}

.user-dropdown-item i {
    width: 18px;
    text-align: center;
    color: #6c757d;
}

.user-dropdown-item.logout {
    color: var(--accent);
    border-top: 1px solid #e9ecef;
    margin-top: 4px;
    padding-top: 12px;
}

.user-dropdown-item.logout i {
    color: var(--accent);
}

/* ============================================
   SIDEBAR 2 - MENU SECONDAIRE
   ============================================ */
.sidebar2 {
    width: 0;
    background: white;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: width 0.3s ease;
    overflow: hidden;
    border-right: 1px solid #e9ecef;
}

.sidebar2.open {
    width: var(--sidebar-width);
}

.sidebar2-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    background: var(--primary-light);
    color: white;
}

.sidebar2-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.sidebar2-title i {
    font-size: 15px;
}

.sidebar2-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar2-close:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.sidebar2-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.sidebar2-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #495057;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    margin-bottom: 2px;
}

.sidebar2-item:hover {
    background: #f5f6fa;
    color: var(--primary);
}

.sidebar2-item.active {
    background: var(--primary);
    color: white;
}

.sidebar2-item.active i {
    color: white;
}

.sidebar2-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: #6c757d;
}

/* ============================================
   CONTENU PRINCIPAL
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   HEADER DU CONTENU
   ============================================ */
.content-header {
    background: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9ecef;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-modules {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
}

.header-modules:hover {
    background: #f5f6fa;
}

.content-header .page-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-title-icon {
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Recherche */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f6fa;
    padding: 8px 14px;
    border-radius: 8px;
    color: #6c757d;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 160px;
    color: #2c3e50;
}

.search-box input::placeholder {
    color: #adb5bd;
}

.search-box .shortcut {
    font-size: 11px;
    color: #adb5bd;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Notifications */
.header-notification {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    cursor: pointer;
    border-radius: 8px;
}

.header-notification:hover {
    background: #f5f6fa;
}

/* Sélecteur de société */
.header-company {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    background: #EBF5FB;
    border: 1px solid #D4E6F1;
}

.header-company:hover {
    background: #D4E6F1;
}

.header-company-avatar {
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid #D4E6F1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
}

.header-company-info {
    text-align: left;
}

.header-company-name {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-company-name i {
    font-size: 10px;
    color: #6c757d;
}

.header-company-city {
    font-size: 11px;
    color: #6c757d;
}

/* ============================================
   BODY DU CONTENU
   ============================================ */
.content-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   FOOTER DU CONTENU
   ============================================ */
.content-footer {
    background: white;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 12px;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
}

.content-footer .footer-datetime {
    margin-left: auto;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.nf525 {
    color: var(--accent);
}

/* ============================================
   PLACEHOLDER CONTENU
   ============================================ */
.content-placeholder {
    background: white;
    border-radius: 12px;
    padding: 60px;
    text-align: center;
    color: #6c757d;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}
