// Bootstrap
@import "bootstrap/scss/bootstrap";

// Select2
@import "select2/dist/css/select2.min.css";
@import "select2-bootstrap-5-theme/dist/select2-bootstrap-5-theme.min.css";

// DataTables Bootstrap 5
@import "datatables.net-bs5/css/dataTables.bootstrap5.min.css";

// ─── Variables ───────────────────────────────────────────────────────────────
:root {
    --gf-accent:        #4ade80;        // vert clair accent
    --gf-accent-dark:   #22c55e;
    --gf-sidebar-bg:    #0f1f10;        // très sombre, quasi-noir végétal
    --gf-sidebar-width: 260px;
    --gf-topbar-h:      60px;
}

// ─── Base ─────────────────────────────────────────────────────────────────────
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f0f4f1;
    color: #1a1a1a;
}

// ─── Sidebar ──────────────────────────────────────────────────────────────────
.sidebar {
    width: var(--gf-sidebar-width);
    height: 100vh;
    background: var(--gf-sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);

    // ── Brand ──────────────────────────────────────────────────────────────
    .sidebar-brand {
        flex-shrink: 0;
        padding: 1.25rem 1.25rem 1rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        border-bottom: 1px solid rgba(255,255,255,0.07);
        background: rgba(0,0,0,0.2);

        .brand-icon {
            width: 38px; height: 38px;
            border-radius: 10px;
            background: linear-gradient(135deg, var(--gf-accent-dark), #16a34a);
            display: flex; align-items: center; justify-content: center;
            font-size: 1.2rem; color: #fff;
            flex-shrink: 0;
            box-shadow: 0 2px 8px rgba(74,222,128,0.3);
        }

        .brand-logo {
            width: 38px; height: 38px;
            border-radius: 10px;
            object-fit: contain;
            flex-shrink: 0;
            background: #fff;
            padding: 2px;
        }

        .brand-text {
            h5 {
                margin: 0;
                color: #fff;
                font-weight: 700;
                font-size: 1rem;
                letter-spacing: 0.3px;
            }
            small {
                color: rgba(255,255,255,0.4);
                font-size: 0.7rem;
            }
        }
    }

    // ── Scroll area ────────────────────────────────────────────────────────
    .sidebar-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 0.5rem 0 1rem;

        &::-webkit-scrollbar { width: 4px; }
        &::-webkit-scrollbar-track { background: transparent; }
        &::-webkit-scrollbar-thumb {
            background: rgba(255,255,255,0.12);
            border-radius: 4px;
        }
    }

    // ── Dashboard link direct ──────────────────────────────────────────────
    .nav-dashboard {
        padding: 0.25rem 0.75rem 0.25rem;

        a {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.6rem 0.85rem;
            border-radius: 10px;
            color: rgba(255,255,255,0.65);
            font-size: 0.875rem;
            text-decoration: none;
            transition: all 0.2s;

            i { font-size: 1rem; width: 20px; text-align: center; }

            &:hover {
                background: rgba(255,255,255,0.07);
                color: #fff;
            }
            &.active {
                background: linear-gradient(135deg, rgba(74,222,128,0.2), rgba(34,197,94,0.1));
                color: var(--gf-accent);
                font-weight: 600;
                box-shadow: inset 3px 0 0 var(--gf-accent);
            }
        }
    }

    // ── Section ────────────────────────────────────────────────────────────
    .nav-section {
        padding: 0.15rem 0.75rem;
        margin-top: 0.1rem;
    }

    // ── Section toggle ─────────────────────────────────────────────────────
    .nav-section-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.55rem 0.85rem;
        border-radius: 10px;
        color: rgba(255,255,255,0.45);
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.8px;
        text-decoration: none;
        cursor: pointer;
        transition: background 0.2s, color 0.2s;
        border: none;
        background: transparent;

        .toggle-left {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            i { font-size: 0.9rem; }
        }

        .toggle-icon {
            font-size: 0.65rem;
            transition: transform 0.25s ease;
            opacity: 0.6;
        }

        &:hover {
            background: rgba(255,255,255,0.06);
            color: rgba(255,255,255,0.8);
        }

        &:not(.collapsed) {
            color: rgba(255,255,255,0.75);
            .toggle-icon { transform: rotate(0deg); }
        }

        &.collapsed {
            .toggle-icon { transform: rotate(-90deg); }
        }
    }

    // ── Sub-links ──────────────────────────────────────────────────────────
    .nav-sub-link {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        padding: 0.48rem 0.85rem 0.48rem 1.5rem;
        border-radius: 8px;
        margin: 0.08rem 0;
        color: rgba(255,255,255,0.55);
        font-size: 0.845rem;
        text-decoration: none;
        transition: all 0.18s;
        position: relative;

        i {
            font-size: 0.9rem;
            width: 18px;
            text-align: center;
            flex-shrink: 0;
        }

        &:hover {
            background: rgba(255,255,255,0.07);
            color: rgba(255,255,255,0.9);
            padding-left: 1.75rem;
        }

        &.active {
            background: linear-gradient(135deg, rgba(74,222,128,0.18), rgba(34,197,94,0.08));
            color: var(--gf-accent);
            font-weight: 600;
            box-shadow: inset 3px 0 0 var(--gf-accent);
        }
    }

    // ── Collapse inner padding ─────────────────────────────────────────────
    .collapse, .collapsing {
        padding: 0.1rem 0 0.2rem;
    }
}

// ─── Top Navbar ───────────────────────────────────────────────────────────────
.main-content {
    margin-left: var(--gf-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-navbar {
    height: var(--gf-topbar-h);
    background: #fff;
    border-bottom: 1px solid #e5e9e6;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.content-wrapper {
    padding: 1.5rem;
    flex: 1;
}

// ─── KPI Cards ────────────────────────────────────────────────────────────────
.kpi-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;

    &:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    }

    .kpi-icon {
        width: 50px; height: 50px;
        border-radius: 12px;
        display: flex; align-items: center; justify-content: center;
        font-size: 1.3rem;
    }

    .kpi-value {
        font-size: 1.6rem;
        font-weight: 700;
        line-height: 1.2;
    }

    .kpi-label {
        color: #6c757d;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}

// ─── Cards globales ───────────────────────────────────────────────────────────
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef1ee;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.25rem;
}

// ─── Status badges ────────────────────────────────────────────────────────────
.badge-actif   { background-color: #16a34a; }
.badge-vendu   { background-color: #1d4ed8; }
.badge-abattu  { background-color: #ea580c; }
.badge-reforme { background-color: #6b7280; }
.badge-archive { background-color: #374151; }

// ─── Alert severity ───────────────────────────────────────────────────────────
.alert-severity-info     { border-left: 4px solid #0284c7; }
.alert-severity-warning  { border-left: 4px solid #d97706; }
.alert-severity-critical { border-left: 4px solid #dc2626; }

// ─── DataTables ───────────────────────────────────────────────────────────────
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
}

// ─── Responsive ───────────────────────────────────────────────────────────────
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        &.show { transform: translateX(0); }
    }
    .main-content { margin-left: 0; }
}
