/*
 * Seolytix — 2026 Dashboard App Layout
 * Sidebar + Topbar + Content
 * Prefix: .dash-* (no conflict with existing .app-*)
 */

/* ==========================================================================
   VARIABLES
   ========================================================================== */
:root {
    --dash-sidebar-width: 240px;
    --dash-topbar-height: 60px;
    --dash-sidebar-bg: #ffffff;
    --dash-sidebar-border: #e8ecf0;
    --dash-sidebar-brand-color: #0f172a;
    --dash-nav-item-color: #4b5563;
    --dash-nav-item-hover-bg: #f1f5f9;
    --dash-nav-item-active-bg: #eff6ff;
    --dash-nav-item-active-color: #2563eb;
    --dash-nav-item-active-border: #2563eb;
    --dash-topbar-bg: #ffffff;
    --dash-topbar-border: #e8ecf0;
    --dash-content-bg: #f8fafc;
    --dash-text-primary: #0f172a;
    --dash-text-muted: #64748b;
    --dash-radius: 8px;
    --dash-transition: 0.22s ease;
    --dash-shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
}

[data-theme-style="dark"] {
    --dash-sidebar-bg: #0f172a;
    --dash-sidebar-border: #1e293b;
    --dash-sidebar-brand-color: #f8fafc;
    --dash-nav-item-color: #94a3b8;
    --dash-nav-item-hover-bg: #1e293b;
    --dash-nav-item-active-bg: rgba(37, 99, 235, 0.15);
    --dash-nav-item-active-color: #60a5fa;
    --dash-topbar-bg: #0f172a;
    --dash-topbar-border: #1e293b;
    --dash-content-bg: #060d1a;
    --dash-text-primary: #f8fafc;
    --dash-text-muted: #64748b;
}

/* ==========================================================================
   LAYOUT ROOT
   ========================================================================== */
body.app {
    background-color: var(--dash-content-bg);
    overflow: hidden;
}

.dash-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.dash-sidebar {
    width: var(--dash-sidebar-width);
    min-width: var(--dash-sidebar-width);
    height: 100vh;
    background-color: var(--dash-sidebar-bg);
    border-right: 1px solid var(--dash-sidebar-border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
    transition: all var(--dash-transition);
}

/* Desktop Collapsed Sidebar State */
body.dash-sidebar-closed .dash-sidebar {
    margin-left: calc(-1 * var(--dash-sidebar-width));
}

/* Brand / Logo */
.dash-sidebar-brand {
    height: var(--dash-topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--dash-sidebar-border);
    flex-shrink: 0;
}

.dash-sidebar-brand a {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--dash-sidebar-brand-color) !important;
    text-decoration: none !important;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-sidebar-brand img {
    max-height: 28px;
    width: auto;
}

/* Nav Scroll Area */
.dash-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
}

.dash-sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.dash-sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.dash-sidebar-scroll::-webkit-scrollbar-thumb {
    background: var(--dash-sidebar-border);
    border-radius: 4px;
}

/* Nav Section Label */
.dash-nav-label {
    padding: 0.5rem 1.25rem 0.25rem 1.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dash-text-muted);
}

/* Nav List */
.dash-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dash-nav-item {
    margin: 1px 0.6rem;
}

.dash-nav-item.d-flex {
    display: flex !important;
    align-items: center;
}

.dash-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.56rem 0.85rem;
    border-radius: var(--dash-radius);
    color: var(--dash-nav-item-color) !important;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: background-color var(--dash-transition), color var(--dash-transition);
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.dash-nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-nav-link i {
    font-size: 0.9rem;
    width: 16px;
    flex-shrink: 0;
    color: #94a3b8;
    transition: color var(--dash-transition);
}

.dash-nav-link:hover {
    background-color: var(--dash-nav-item-hover-bg);
    color: var(--dash-text-primary) !important;
}

.dash-nav-link:hover i {
    color: var(--dash-nav-item-active-color);
}

.dash-nav-item.active .dash-nav-link {
    background-color: var(--dash-nav-item-active-bg);
    color: var(--dash-nav-item-active-color) !important;
    font-weight: 600;
}

.dash-nav-item.active .dash-nav-link i {
    color: var(--dash-nav-item-active-color);
}

/* Notification Bell in nav */
.dash-nav-bell {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--dash-text-muted) !important;
    text-decoration: none !important;
    font-size: 0.85rem;
    transition: background-color var(--dash-transition);
    margin-right: 0.35rem;
}

.dash-nav-bell:hover {
    background-color: var(--dash-nav-item-hover-bg);
    color: var(--dash-text-primary) !important;
}

/* Archived audits icon */
.dash-nav-icon-action {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--dash-text-muted) !important;
    text-decoration: none !important;
    font-size: 0.8rem;
    transition: background-color var(--dash-transition);
    margin-right: 0.35rem;
}

.dash-nav-icon-action:hover,
.dash-nav-icon-action.bg-primary {
    background-color: var(--dash-nav-item-active-bg);
    color: var(--dash-nav-item-active-color) !important;
}

/* Sidebar User Footer */
.dash-sidebar-user {
    border-top: 1px solid var(--dash-sidebar-border);
    padding: 0.75rem 0.6rem;
    flex-shrink: 0;
}

.dash-sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--dash-radius);
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color var(--dash-transition);
    width: 100%;
    min-width: 0;
}

.dash-sidebar-user-btn:hover {
    background-color: var(--dash-nav-item-hover-bg);
}

.dash-sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

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

.dash-sidebar-user-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-sidebar-user-email {
    display: block;
    font-size: 0.72rem;
    color: var(--dash-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-sidebar-user-chevron {
    color: var(--dash-text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ==========================================================================
   BODY (RIGHT SIDE)
   ========================================================================== */
.dash-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.dash-topbar {
    height: var(--dash-topbar-height);
    min-height: var(--dash-topbar-height);
    background-color: var(--dash-topbar-bg);
    border-bottom: 1px solid var(--dash-topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
    z-index: 50;
}

.dash-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.dash-topbar-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--dash-sidebar-border);
    background: var(--dash-content-bg);
    border-radius: var(--dash-radius);
    color: var(--dash-text-muted);
    cursor: pointer;
    transition: all var(--dash-transition);
    flex-shrink: 0;
}

.dash-topbar-burger:hover {
    background-color: var(--dash-nav-item-hover-bg);
    color: var(--dash-text-primary);
    border-color: #cbd5e1;
}

.dash-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Search trigger (spotlight) */
.dash-search-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.9rem;
    height: 36px;
    background-color: var(--dash-content-bg);
    border: 1px solid var(--dash-sidebar-border);
    border-radius: var(--dash-radius);
    color: var(--dash-text-muted);
    font-size: 0.825rem;
    cursor: pointer;
    transition: border-color var(--dash-transition), box-shadow var(--dash-transition);
    text-decoration: none !important;
    white-space: nowrap;
}

.dash-search-trigger:hover {
    border-color: #94a3b8;
    color: var(--dash-text-muted);
}

.dash-search-trigger .dash-kbd {
    padding: 0.1rem 0.35rem;
    background: var(--dash-sidebar-border);
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: monospace;
}

/* Topbar icon buttons */
.dash-topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    color: var(--dash-text-muted) !important;
    text-decoration: none !important;
    transition: background-color var(--dash-transition), color var(--dash-transition);
    font-size: 0.9rem;
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.dash-topbar-btn:hover {
    background-color: var(--dash-nav-item-hover-bg);
    color: var(--dash-text-primary) !important;
}

.dash-lang-flag {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dash-topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

/* ==========================================================================
   CONTENT AREA
   ========================================================================== */
.dash-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--dash-content-bg);
    padding: 2rem 2rem;
}

.dash-content::-webkit-scrollbar {
    width: 6px;
}

.dash-content::-webkit-scrollbar-track {
    background: transparent;
}

.dash-content::-webkit-scrollbar-thumb {
    background: var(--dash-sidebar-border);
    border-radius: 4px;
}

/* Keep existing .container behavior inside dash-content */
.dash-content .container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Remove old content padding overrides */
.dash-content .pt-lg-5,
.dash-content .pl-lg-5,
.dash-content .pr-lg-5 {
    padding: 0 !important;
}

/* Docked Bottom Bar Footer (Collé en bas, 100% sur les côtés, fond blanc) */
.dash-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.5rem;
    margin: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid var(--dash-sidebar-border);
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.02);
    font-size: 0.8rem;
    color: var(--dash-text-muted);
    flex-shrink: 0;
    z-index: 40;
    gap: 0.75rem;
}

[data-theme-style="dark"] .dash-footer {
    background-color: var(--dash-topbar-bg);
    border-top-color: var(--dash-sidebar-border);
    box-shadow: none;
}

.dash-footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dash-footer-bullet {
    opacity: 0.35;
}

.dash-footer-version {
    font-weight: 600;
    font-size: 0.75rem;
    opacity: 0.75;
}

.dash-footer-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.dash-footer-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 500;
}

.dash-status-dot {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    display: inline-block;
}

.dash-footer-badge {
    display: inline-flex;
    align-items: center;
    background-color: var(--dash-content-bg);
    border: 1px solid var(--dash-sidebar-border);
    padding: 0.18rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dash-text-muted);
}



/* ==========================================================================
   404 NOT FOUND PAGE
   ========================================================================== */
.dash-404-card {
    background-color: #ffffff;
    border: 1px solid var(--dash-sidebar-border);
    border-radius: 16px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

[data-theme-style="dark"] .dash-404-card {
    background-color: var(--dash-topbar-bg);
    border-color: var(--dash-sidebar-border);
    box-shadow: none;
}

.dash-404-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0) 70%);
    margin: 0 auto;
}

.dash-404-number {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    line-height: 1;
}

[data-theme-style="dark"] .dash-404-card h1 {
    color: #f8fafc !important;
}

/* Mobile overlay */
.app-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    z-index: 99;
    display: none;
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 991.98px) {
    body.app {
        overflow: auto;
    }

    .dash-layout {
        flex-direction: row;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .dash-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(calc(-1 * var(--dash-sidebar-width)));
        z-index: 200;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    }

    .dash-body {
        width: 100%;
        min-height: 100vh;
    }

    .dash-topbar-burger {
        display: flex;
    }

    .dash-search-trigger .dash-kbd {
        display: none;
    }

    .dash-content {
        overflow-y: visible;
        padding: 1.25rem 1rem;
    }
}

body.app-sidebar-opened .dash-sidebar {
    transform: translateX(0);
}

body.app-sidebar-opened .app-overlay {
    display: block !important;
}
