/**
 * lib-leftbar - Sidebar de navigation reutilisable
 * @author Emmanuel Daunizeau / ACME
 * @copyright 2026 All rights reserved
 * @version 1.0.0
 *
 * Toutes les dimensions et couleurs sont parametrables via CSS custom properties.
 * Definir dans :root ou body du projet parent pour surcharger.
 *
 * Variables disponibles :
 *
 *   Layout
 *   --lb-width              : largeur sidebar (defaut: 220px)
 *   --lb-header-height      : hauteur header (defaut: 64px)
 *   --lb-header-padding     : padding header (defaut: 0 24px)
 *   --lb-nav-padding        : padding zone nav (defaut: 16px 0)
 *   --lb-link-padding       : padding liens (defaut: 10px 20px)
 *   --lb-link-font-size     : taille police liens (defaut: 14px)
 *   --lb-icon-size          : taille icones (defaut: 20px)
 *   --lb-icon-gap           : espace icone-label (defaut: 12px)
 *   --lb-brand-icon-size    : taille icone brand (defaut: 32px)
 *   --lb-brand-font-size    : taille titre brand (defaut: 20px)
 *   --lb-version-font-size  : taille version (defaut: 12px)
 *   --lb-active-border      : largeur bord actif (defaut: 3px)
 *
 *   Couleurs
 *   --lb-bg                 : fond sidebar (defaut: --sidebar-bg ou #16213e)
 *   --lb-border             : bordure droite (defaut: --border ou #0f3460)
 *   --lb-link-color         : couleur liens (defaut: --nav-link-color ou #c8c8c8)
 *   --lb-link-hover-bg      : fond hover (defaut: --bg ou #1a1a2e)
 *   --lb-link-hover-color   : couleur hover (defaut: --heading ou #fff)
 *   --lb-active-color       : couleur lien actif (defaut: --accent ou #e94560)
 *   --lb-active-border-color: couleur bord actif (defaut: --accent ou #e94560)
 *   --lb-brand-color        : couleur titre brand (defaut: --accent ou #e94560)
 *   --lb-brand-icon-color   : couleur icone brand (defaut: --accent ou #e94560)
 *   --lb-version-color      : couleur version (defaut: #888)
 *   --lb-hostname-color     : couleur hostname footer (defaut: #888)
 *   --lb-logout-color       : couleur deconnexion (defaut: #e74c3c)
 *   --lb-logout-hover-color : couleur deconnexion hover (defaut: #ff6b6b)
 *   --lb-logout-hover-bg    : fond deconnexion hover (defaut: rgba(231,76,60,0.15))
 *   --lb-toggle-size        : taille bouton theme (defaut: 40px)
 */

/* ---- Sidebar container ---- */

.lb-sidebar {
    width: var(--lb-width, 220px);
    background: var(--lb-bg, var(--sidebar-bg, #16213e));
    border-right: 1px solid var(--lb-border, var(--border, #0f3460));
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 100;
    font-family: inherit;
}

/* ---- Header ---- */

.lb-header {
    display: flex;
    align-items: center;
    height: var(--lb-header-height, 64px);
    min-height: var(--lb-header-height, 64px);
    padding: var(--lb-header-padding, 0 24px);
    border-bottom: 1px solid var(--lb-border, var(--border, #0f3460));
    text-align: left;
}

.lb-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--lb-icon-gap, 12px);
    text-decoration: none;
    color: inherit;
}

.lb-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--lb-brand-icon-color, var(--accent, #e94560));
}

.lb-brand-icon svg {
    width: var(--lb-brand-icon-size, 32px);
    height: var(--lb-brand-icon-size, 32px);
}

.lb-brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
}

.lb-brand-title {
    color: var(--lb-brand-color, var(--accent, #e94560));
    font-size: var(--lb-brand-font-size, 20px);
    font-weight: 600;
    letter-spacing: 1px;
    margin: 0;
    line-height: 1.2;
}

.lb-brand-version {
    color: var(--lb-version-color, #888);
    font-size: var(--lb-version-font-size, 12px);
}

/* ---- Navigation ---- */

.lb-nav {
    padding: var(--lb-nav-padding, 16px 0);
    flex: 1;
    overflow-y: auto;
}

.lb-link {
    display: flex;
    align-items: center;
    padding: var(--lb-link-padding, 10px 20px);
    color: var(--lb-link-color, var(--nav-link-color, #c8c8c8));
    text-decoration: none;
    font-size: var(--lb-link-font-size, 14px);
    border-left: var(--lb-active-border, 3px) solid transparent;
    transition: all 0.2s;
}

.lb-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--lb-icon-size, 20px);
    height: var(--lb-icon-size, 20px);
    flex-shrink: 0;
    margin-right: var(--lb-icon-gap, 12px);
    font-size: 16px;
    line-height: 1;
}

.lb-link-icon svg {
    width: var(--lb-icon-size, 20px);
    height: var(--lb-icon-size, 20px);
    flex-shrink: 0;
}

.lb-link-label {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.lb-link:hover {
    background: var(--lb-link-hover-bg, var(--bg, #1a1a2e));
    color: var(--lb-link-hover-color, var(--heading, #fff));
    border-left-color: var(--lb-active-border-color, var(--accent, #e94560));
}

.lb-link.active {
    background: var(--lb-link-hover-bg, var(--bg, #1a1a2e));
    color: var(--lb-active-color, var(--accent, #e94560));
    border-left-color: var(--lb-active-border-color, var(--accent, #e94560));
    font-weight: 600;
}

/* ---- Footer ---- */

.lb-footer {
    padding: 0;
}

.lb-hostname {
    color: var(--lb-hostname-color, #888);
    font-size: 11px;
    padding: 8px 16px;
    word-break: break-all;
    text-align: center;
}

.lb-footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--lb-border, var(--border, #0f3460));
}

/* ---- Logout link ---- */

.lb-link-logout {
    font-size: 13px !important;
    color: var(--lb-logout-color, #e74c3c) !important;
    font-weight: 500;
}

.lb-link-logout:hover {
    color: var(--lb-logout-hover-color, #ff6b6b) !important;
    background: var(--lb-logout-hover-bg, rgba(231, 76, 60, 0.15)) !important;
}

/* ---- Theme toggle button ---- */

.lb-theme-toggle {
    width: var(--lb-toggle-size, 40px);
    height: var(--lb-toggle-size, 40px);
    min-width: var(--lb-toggle-size, 40px);
    border-radius: 50%;
    border: 1px solid var(--lb-border, var(--border, #0f3460));
    background: var(--lb-bg, var(--card-bg, #16213e));
    color: var(--lb-link-color, var(--text, #e0e0e0));
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.lb-theme-toggle:hover {
    border-color: var(--lb-active-color, var(--accent, #e94560));
    color: var(--lb-active-color, var(--accent, #e94560));
}

/* ---- Main content offset ---- */

.lb-content {
    margin-left: var(--lb-width, 220px);
}
