/* ============================================================
   GODDESS ERP — Feuille de style principale
   Thème : dark élégant, épuré, professionnel
   ============================================================ */

:root {
    --bg-main:       #0f1117;
    --bg-card:       #1a1d27;
    --bg-input:      #232636;
    --bg-sidebar:    #12151f;
    --bg-hover:      #252839;
    --border:        #2e3248;
    --accent:        #7c5cbf;
    --accent-light:  #9d7fe0;
    --accent-glow:   rgba(124, 92, 191, 0.25);
    --text-primary:  #e8e9f0;
    --text-secondary:#9699b0;
    --text-muted:    #5c6080;
    --success:       #3ecf8e;
    --warning:       #f0c040;
    --danger:        #e05a5a;
    --info:          #4ab8e0;
    --radius:        8px;
    --radius-lg:     12px;
    --shadow:        0 2px 12px rgba(0,0,0,0.4);
    --sidebar-w:     220px;
    --topbar-h:      56px;
    --font:          'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg-main); color: var(--text-primary); min-height: 100vh; }

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: #fff; }

/* ============================================================
   LAYOUT
   ============================================================ */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100; overflow-y: auto;
    transition: transform .25s ease;
}

.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left .25s ease;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 1.1rem;
}
.brand-icon { font-size: 1.4rem; }
.brand-name { color: var(--accent-light); letter-spacing: 0.5px; }

.sidebar-menu { list-style: none; padding: 10px 0; flex: 1; }
.sidebar-menu li a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 16px; border-radius: 0;
    color: var(--text-secondary);
    transition: background .15s, color .15s;
    font-size: .9rem;
}
.sidebar-menu li a:hover, .sidebar-menu li.active a {
    background: var(--bg-hover); color: var(--text-primary);
}
.sidebar-menu li.active a {
    border-left: 3px solid var(--accent);
    color: var(--accent-light);
}
.menu-icon { width: 20px; text-align: center; font-size: 1rem; }
.menu-label { flex: 1; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center;
    justify-content: space-between; font-size: .8rem;
    color: var(--text-muted);
}
.btn-logout { font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }
.btn-logout:hover { color: var(--danger); }

/* TOPBAR */
.topbar {
    height: var(--topbar-h); background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 1.05rem; font-weight: 600; flex: 1; }
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.4rem; cursor: pointer; }
.alerte-stock { color: var(--warning); font-size: .85rem; }

/* CONTENU */
.content { padding: 24px; flex: 1; }

/* ============================================================
   QUICK-ADD BAR (zone saisie discrète en haut de page)
   ============================================================ */
.quick-add-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}
.quick-add-toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; cursor: pointer;
    color: var(--text-muted); font-size: .82rem;
    user-select: none;
}
.quick-add-toggle:hover { color: var(--accent-light); }
.quick-add-toggle .toggle-arrow { transition: transform .2s; }
.quick-add-toggle.open .toggle-arrow { transform: rotate(90deg); }
.quick-add-form {
    display: none; padding: 14px 16px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
}
.quick-add-form.open { display: block; }

/* ============================================================
   CARTES / PANNEAUX
   ============================================================ */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 600; font-size: 1rem; }

/* ============================================================
   TABLEAUX
   ============================================================ */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
    background: var(--bg-sidebar); color: var(--text-secondary);
    font-weight: 600; padding: 10px 12px;
    border-bottom: 1px solid var(--border); text-align: left;
    white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 9px 12px; vertical-align: middle; }
.td-img img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.td-img .no-img { width: 40px; height: 40px; background: var(--bg-input); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: .7rem; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
label { display: block; margin-bottom: 5px; font-size: .82rem; color: var(--text-secondary); }
.form-control {
    width: 100%; padding: 7px 10px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary); font-size: .9rem;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
select.form-control option { background: var(--bg-input); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-control-sm { padding: 5px 8px; font-size: .82rem; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--radius);
    border: none; cursor: pointer; font-size: .88rem; font-weight: 500;
    transition: opacity .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-success   { background: var(--success); color: #0f1117; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #0f1117; }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-sm        { padding: 4px 10px; font-size: .8rem; }
.btn-block     { width: 100%; justify-content: center; }
.btn-group     { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.badge-success   { background: rgba(62,207,142,.2);  color: var(--success); }
.badge-danger    { background: rgba(224,90,90,.2);   color: var(--danger); }
.badge-warning   { background: rgba(240,192,64,.2);  color: var(--warning); }
.badge-info      { background: rgba(74,184,224,.2);  color: var(--info); }
.badge-secondary { background: var(--bg-input);      color: var(--text-muted); }

/* ============================================================
   ALERTES
   ============================================================ */
.alert {
    padding: 10px 16px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: .88rem;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.alert-success { background: rgba(62,207,142,.15); border: 1px solid rgba(62,207,142,.3); color: var(--success); }
.alert-danger  { background: rgba(224,90,90,.15);  border: 1px solid rgba(224,90,90,.3);  color: var(--danger); }
.alert-warning { background: rgba(240,192,64,.15); border: 1px solid rgba(240,192,64,.3); color: var(--warning); }
.close-btn     { background: none; border: none; cursor: pointer; color: inherit; font-size: 1.1rem; }
.flash-message { margin: 0 24px 0; border-radius: 0 0 var(--radius) var(--radius); }

/* ============================================================
   STATS / DASHBOARD
   ============================================================ */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px;
}
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.stat-sub   { font-size: .78rem; color: var(--text-secondary); }
.stat-accent { border-top: 3px solid var(--accent); }
.stat-success { border-top: 3px solid var(--success); }
.stat-warning { border-top: 3px solid var(--warning); }
.stat-info    { border-top: 3px solid var(--info); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--bg-main); }
.login-wrapper { width: 100%; max-width: 380px; padding: 20px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 32px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.logo-text { font-size: 1.8rem; font-weight: 800; color: var(--accent-light); }
.logo-sub  { display: block; font-size: .85rem; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; }

/* ============================================================
   UTILITAIRES
   ============================================================ */
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.gap-1         { gap: 8px; }
.gap-2         { gap: 16px; }
.flex-wrap     { flex-wrap: wrap; }
.w-100         { width: 100%; }
.separator     { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.section-title { font-size: .95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; font-size: .78rem; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .form-row { flex-direction: column; }
}