/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ink:      #1a1a2e;
    --ink-soft: #4a4a6a;
    --surface:  #f8f8fc;
    --white:    #ffffff;
    --accent:   #0057b8;
    --accent-h: #003d82;
    --accent-t: #e8f0fb;
    --danger:   #c0392b;
    --success:  #1a7a4a;
    --border:   #dde1ee;
    --radius:   10px;
    --shadow:   0 2px 16px rgba(0,40,120,.09);
    --font:     'Inter', system-ui, sans-serif;
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Layout ───────────────────────────────────────────────────── */
.site-header {
    background: var(--ink);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -.01em;
}

.site-logo span.badge {
    background: var(--accent);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 50px;
}

.site-header nav a {
    color: rgba(255,255,255,.75);
    font-size: .9rem;
    margin-left: 1.5rem;
    transition: color .2s;
}
.site-header nav a:hover { color: #fff; text-decoration: none; }

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--ink) 0%, #0a2a5e 100%);
    color: #fff;
    padding: 3.5rem 1.5rem 3rem;
    text-align: center;
}
.hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: .5rem;
}
.hero p {
    font-size: 1.05rem;
    color: rgba(255,255,255,.7);
    max-width: 480px;
    margin: 0 auto;
}

/* ── Grille produits ──────────────────────────────────────────── */
.products-section { padding: 3rem 0 4rem; }
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0,40,120,.14);
}

.product-card__img {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #eef0f8;
    position: relative;
}
.product-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.product-card:hover .product-card__img img {
    transform: scale(1.04);
}
.product-card__img .no-photo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b8d0;
    font-size: 2.5rem;
}

.product-card__body {
    padding: 1.2rem 1.3rem 1.4rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.product-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .5rem;
    line-height: 1.3;
}
.product-card__excerpt {
    color: var(--ink-soft);
    font-size: .9rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
}
.product-card__excerpt p { margin: 0; }

.product-card__footer {
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid var(--border);
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--accent);
    font-size: .875rem;
    font-weight: 600;
    transition: gap .2s;
}
.btn-link:hover { gap: .55rem; text-decoration: none; }
.btn-link svg { flex-shrink: 0; }

/* ── Page produit ─────────────────────────────────────────────── */
.product-detail { padding: 2.5rem 0 4rem; }
.breadcrumb {
    font-size: .85rem;
    color: var(--ink-soft);
    margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 .4rem; }

.product-detail__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}
@media (max-width: 700px) {
    .product-detail__layout { grid-template-columns: 1fr; }
}

.gallery { position: sticky; top: 80px; }
.gallery__main {
    border-radius: var(--radius);
    overflow: hidden;
    background: #eef0f8;
    aspect-ratio: 4/3;
    margin-bottom: .75rem;
}
.gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery__thumbs {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.gallery__thumb {
    width: 70px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s;
}
.gallery__thumb.active { border-color: var(--accent); }
.gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail__info h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin-bottom: 1.2rem;
}
.product-detail__desc {
    font-size: .975rem;
    color: var(--ink-soft);
    line-height: 1.7;
}
.product-detail__desc h2, .product-detail__desc h3 { color: var(--ink); margin: 1rem 0 .4rem; }
.product-detail__desc ul, .product-detail__desc ol { padding-left: 1.4rem; }
.product-detail__desc p { margin-bottom: .75rem; }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2rem;
    transition: background .15s;
}
.back-btn:hover { background: var(--accent-t); text-decoration: none; }

/* ── Forms / Auth ─────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--ink) 0%, #0a2a5e 100%);
}
.auth-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0,0,0,.25);
}
.auth-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-card .logo strong {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--ink);
}
.auth-card .logo small {
    color: var(--ink-soft);
    font-size: .8rem;
}
.auth-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--ink);
}

.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: .825rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: .35rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.form-control {
    width: 100%;
    padding: .65rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: var(--font);
    background: var(--surface);
    color: var(--ink);
    transition: border-color .2s;
    outline: none;
}
.form-control:focus { border-color: var(--accent); background: var(--white); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .7rem 1.4rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-secondary {
    background: var(--white);
    color: var(--ink);
    border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--surface); }
.btn-sm { padding: .4rem .9rem; font-size: .825rem; }
.btn-block { width: 100%; }

.alert {
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1rem;
}
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c3; }
.alert-success { background: #e8f8f0; color: var(--success); border: 1px solid #b2e0c8; }
.alert-info { background: var(--accent-t); color: var(--accent); border: 1px solid #b8d0f5; }

/* ── Admin ────────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: calc(100vh - 60px); }
.admin-sidebar {
    width: 220px;
    background: var(--ink);
    padding: 1.5rem 0;
    flex-shrink: 0;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 1.5rem;
    color: rgba(255,255,255,.65);
    font-size: .9rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}
.admin-sidebar .sidebar-section {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.3);
    padding: 1.2rem 1.5rem .4rem;
}

.admin-main { flex: 1; padding: 2rem; overflow-x: auto; }
.admin-main h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.admin-table th {
    background: var(--surface);
    padding: .75rem 1rem;
    text-align: left;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: .9rem;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface); }

.badge-active {
    background: #dcf5ea;
    color: var(--success);
    padding: 2px 10px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 700;
}
.badge-inactive {
    background: #f5e0df;
    color: var(--danger);
    padding: 2px 10px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 700;
}

/* ── Éditeur riche ────────────────────────────────────────────── */
.editor-wrap {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--white);
    transition: border-color .2s;
}
.editor-wrap:focus-within { border-color: var(--accent); }
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: .4rem .5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.editor-btn {
    background: none;
    border: none;
    border-radius: 5px;
    padding: .3rem .5rem;
    cursor: pointer;
    font-size: .85rem;
    color: var(--ink-soft);
    transition: background .15s, color .15s;
    font-family: var(--font);
}
.editor-btn:hover { background: var(--border); color: var(--ink); }
.editor-content {
    min-height: 200px;
    padding: .8rem 1rem;
    outline: none;
    font-size: .95rem;
    line-height: 1.65;
    color: var(--ink);
}
.editor-content p { margin-bottom: .5rem; }

/* ── Upload photos ────────────────────────────────────────────── */
.photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--surface);
}
.photo-upload-area:hover, .photo-upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-t);
}
.photo-upload-area input { display: none; }
.photo-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}
.photo-preview-item {
    position: relative;
    width: 100px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
}
.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-preview-item .remove-photo {
    position: absolute;
    top: 3px; right: 3px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px; height: 20px;
    font-size: .75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── MFA setup ────────────────────────────────────────────────── */
.qr-wrap {
    text-align: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 1rem 0;
}
.qr-wrap img { margin: 0 auto .75rem; border-radius: 8px; }
.qr-secret {
    font-family: monospace;
    font-size: .95rem;
    letter-spacing: .15em;
    background: var(--white);
    padding: .4rem .8rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: inline-block;
    word-break: break-all;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .admin-sidebar { width: 60px; }
    .admin-sidebar a span { display: none; }
    .admin-sidebar .sidebar-section { display: none; }
    .admin-sidebar a { justify-content: center; padding: .8rem; }
}
@media (max-width: 640px) {
    .site-header { padding: 0 1rem; }
    .hero { padding: 2.5rem 1rem 2rem; }
    .products-grid { grid-template-columns: 1fr; }
}

.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--ink-soft);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: 1rem; }

.site-footer {
    background: var(--ink);
    color: rgba(255,255,255,.45);
    text-align: center;
    padding: 1.5rem;
    font-size: .82rem;
    margin-top: auto;
}
