/* ============================================================
   GlassOne ERP — Styles globaux
   Mobile-first, Bootstrap 5 étendu
   ============================================================ */

:root {
    --glass-primary:    #0d6efd;
    --glass-primary-dark: #0a58ca;
    --glass-accent:     #00b4d8;
    --glass-dark:       #0f172a;
    --glass-sidebar-w:  260px;
    --glass-sidebar-bg: #0f172a;
    --glass-sidebar-text: #cbd5e1;
    --glass-sidebar-active: #1e40af;
    --glass-topbar-h:   60px;
    --glass-radius:     12px;
    --glass-shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    height: var(--glass-topbar-h);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1030;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--glass-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.topbar-brand span { color: #64748b; font-weight: 400; font-size: .85rem; }

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--glass-sidebar-w);
    background: var(--glass-sidebar-bg);
    position: fixed;
    top: var(--glass-topbar-h);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1020;
    transition: transform .25s ease;
    padding-bottom: 2rem;
}

.sidebar-section {
    padding: 1.25rem 1rem .25rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #475569;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    color: var(--glass-sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    border-radius: 0;
    transition: background .15s, color .15s;
    position: relative;
}

.sidebar-link i { width: 18px; text-align: center; opacity: .8; }

.sidebar-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.sidebar-link.active {
    background: var(--glass-sidebar-active);
    color: #fff;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--glass-accent);
    border-radius: 0 2px 2px 0;
}

/* ── Main content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--glass-sidebar-w);
    margin-top: var(--glass-topbar-h);
    padding: 1.5rem;
    min-height: calc(100vh - var(--glass-topbar-h));
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: var(--glass-radius);
    box-shadow: var(--glass-shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    border-radius: var(--glass-radius) var(--glass-radius) 0 0 !important;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
    border-radius: var(--glass-radius);
    padding: 1.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: .2;
    position: absolute;
    right: 1rem;
    bottom: .5rem;
}

.stat-card .stat-value { font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { font-size: .8rem; opacity: .85; }

.stat-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.stat-green  { background: linear-gradient(135deg, #047857, #10b981); }
.stat-orange { background: linear-gradient(135deg, #b45309, #f59e0b); }
.stat-red    { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.stat-purple { background: linear-gradient(135deg, #6d28d9, #a78bfa); }
.stat-teal   { background: linear-gradient(135deg, #0f766e, #14b8a6); }

/* ── Boutons ─────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 6px; }

/* ── Tables ──────────────────────────────────────────────── */
.table { margin-bottom: 0; }
.table th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #64748b; border-bottom: 2px solid #e2e8f0; }
.table td { vertical-align: middle; font-size: .875rem; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { font-weight: 500; border-radius: 6px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: .875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--glass-primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,.12);
}

.form-label { font-size: .8rem; font-weight: 600; color: #475569; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { border-radius: var(--glass-radius); border: none; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.breadcrumb { font-size: .8rem; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    :root { --glass-sidebar-w: 0px; }

    .sidebar {
        transform: translateX(-260px);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.3);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem .75rem;
    }

    .stat-card .stat-value { font-size: 1.5rem; }

    .table-responsive { font-size: .8rem; }

    .page-header h1 { font-size: 1.1rem; }
}

/* ── Sidebar overlay mobile ──────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1019;
}

.sidebar-overlay.show { display: block; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--glass-primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ── Scrollbar custom ────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* ── Animations ──────────────────────────────────────────── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
