:root {
    --primary:    #2563eb;
    --primary-dk: #1d4ed8;
    --success:    #16a34a;
    --danger:     #dc2626;
    --warning:    #d97706;
    --bg:         #f8fafc;
    --surface:    #ffffff;
    --border:     #e2e8f0;
    --text:       #1e293b;
    --muted:      #64748b;
    --radius:     8px;
    --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg:  0 10px 25px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ── Navbar ── */
.navbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--primary);
    color: #fff;
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.nav-icon { width: 24px; height: 24px; fill: #fff; }

.nav-links {
    display: flex;
    gap: .25rem;
    list-style: none;
    flex: 1;
}

.nav-links a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    padding: .4rem .8rem;
    border-radius: var(--radius);
    transition: background .15s, color .15s;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,.2);
    color: #fff;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
    font-size: .9rem;
}

/* ── Pages ── */
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

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

/* ── Filtres ── */
.filters {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filters .input { flex: 1; min-width: 180px; }

/* ── Grille produits ── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* ── Boutons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
}

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }

.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-ghost { background: transparent; color: rgba(255,255,255,.85); }
.btn-ghost:hover { background: rgba(255,255,255,.15); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Inputs ── */
.input {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.input-group { display: flex; gap: .5rem; }
.input-group .input { flex: 1; }

/* ── Modal ── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    width: min(680px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.1rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
    padding: .25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .85rem; font-weight: 500; color: var(--muted); }
.form-group--full { grid-column: 1 / -1; }

.photo-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: .5rem;
}

/* ── Auth ── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    width: min(400px, 95vw);
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo svg { fill: var(--primary); display: block; margin: 0 auto .5rem; }
.auth-logo h1 { font-size: 1.4rem; color: var(--primary); }

.tab-bar {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius);
    padding: .25rem;
    margin-bottom: 1.5rem;
    gap: .25rem;
}

.tab {
    flex: 1;
    padding: .45rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
    transition: background .15s, color .15s;
}

.tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.auth-form { display: flex; flex-direction: column; gap: .75rem; }

/* ── Alertes ── */
.alert {
    padding: .65rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
}

.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

/* ── Toast ── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.toast {
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    color: #fff;
    font-size: .9rem;
    box-shadow: var(--shadow-lg);
    animation: slide-in .2s ease;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }

@keyframes slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.loading { text-align: center; color: var(--muted); padding: 2rem; }

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
}
