:root {
    --primary: #2C3E50;
    --accent: #8B7355;
    --cta: #8B1A1A;
    --bg: #FAF8F5;
    --bg-light: #F0EBE3;
    --text: #2C2C2C;
    --text-light: #666;
    --border: #D9D0C4;
    --white: #fff;
    --font-serif: Georgia, 'Times New Roman', serif;
    --font-sans: 'Segoe UI', system-ui, sans-serif;
    --radius: 4px;
    --shadow: 0 2px 12px rgba(0,0,0,.08);
    --transition: .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

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

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

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

/* ── HEADER ── */
.site-header {
    background: var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--white);
    text-decoration: none;
}

.logo-icon { font-size: 1.8rem; color: #C9A84C; }

.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: .95rem; letter-spacing: .02em; }
.logo-text em { font-size: .75rem; font-style: normal; color: rgba(255,255,255,.7); }

.site-nav { display: flex; align-items: center; gap: 1.5rem; }
.site-nav a { color: rgba(255,255,255,.85); font-size: .9rem; letter-spacing: .04em; transition: color var(--transition); }
.site-nav a:hover { color: var(--white); text-decoration: none; }

.btn-nav {
    background: var(--cta);
    color: var(--white) !important;
    padding: .45rem 1.1rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background var(--transition) !important;
}
.btn-nav:hover { background: #6B1414 !important; }

.nav-toggle { display: none; background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }

/* ── HERO ── */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #1a252f 100%);
    color: var(--white);
    padding: 6rem 0 5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content { position: relative; }
.hero-badge { display: inline-block; background: rgba(201,168,76,.2); color: #C9A84C; border: 1px solid rgba(201,168,76,.4); padding: .3rem 1rem; border-radius: 20px; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1.5rem; }
.hero h1 { font-family: var(--font-serif); font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 400; line-height: 1.2; margin-bottom: 1rem; }
.hero p { font-size: 1.1rem; color: rgba(255,255,255,.8); max-width: 600px; margin: 0 auto 2rem; }

.btn-primary {
    display: inline-block;
    background: var(--cta);
    color: var(--white);
    padding: .8rem 2rem;
    border-radius: var(--radius);
    font-weight: 600;
    letter-spacing: .04em;
    transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: #6B1414; transform: translateY(-1px); text-decoration: none; }

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--white);
    padding: .8rem 2rem;
    border-radius: var(--radius);
    font-weight: 600;
    border: 2px solid rgba(255,255,255,.4);
    transition: border-color var(--transition);
    margin-left: 1rem;
}
.btn-secondary:hover { border-color: white; text-decoration: none; }

/* ── SECTIONS ── */
section { padding: 5rem 0; }

.section-label {
    display: block;
    font-size: .75rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: .5rem;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 400;
    color: var(--primary);
    margin-bottom: 1rem;
}

.section-subtitle { color: var(--text-light); max-width: 600px; margin-bottom: 3rem; }

.section-header { margin-bottom: 3rem; }
.section-header.centered { text-align: center; }
.section-header.centered .section-subtitle { margin: 0 auto 3rem; }

.bg-light { background: var(--bg-light); }

/* ── FEATURES ── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--accent);
}

.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 { font-family: var(--font-serif); font-size: 1.1rem; color: var(--primary); margin-bottom: .5rem; }
.feature-card p { font-size: .9rem; color: var(--text-light); }

/* ── BOOKS GRID ── */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
}

.book-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}

.book-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }

.book-cover {
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--bg-light);
    position: relative;
}

.book-cover img { width: 100%; height: 100%; object-fit: cover; }

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 3rem;
}

.book-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--cta);
    color: white;
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.book-info { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.book-info h3 { font-family: var(--font-serif); font-size: 1rem; color: var(--primary); margin-bottom: .25rem; }
.book-author { font-size: .8rem; color: var(--accent); font-style: italic; margin-bottom: .5rem; }
.book-desc { font-size: .85rem; color: var(--text-light); margin-bottom: 1rem; flex: 1; }

.book-meta { display: flex; justify-content: space-between; align-items: center; margin-top: auto; border-top: 1px solid var(--border); padding-top: .75rem; }
.book-price { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.book-weight { font-size: .75rem; color: var(--text-light); }

.book-card .btn-order {
    display: block;
    background: var(--primary);
    color: white;
    text-align: center;
    padding: .6rem;
    font-size: .85rem;
    font-weight: 600;
    transition: background var(--transition);
}
.book-card .btn-order:hover { background: var(--cta); text-decoration: none; }

/* ── PRECOMMANDE ── */
.precommande-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 3rem;
    align-items: start;
}

.livre-select-list { display: flex; flex-direction: column; gap: 1rem; }

.livre-select-item {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    align-items: center;
    transition: border-color var(--transition);
}

.livre-select-item:hover { border-color: var(--accent); }
.livre-select-item.selected { border-color: var(--primary); background: #f0f4f8; }

.livre-select-cover { width: 80px; height: 106px; object-fit: cover; border-radius: 4px; background: var(--bg-light); }

.livre-select-info h3 { font-family: var(--font-serif); font-size: .95rem; color: var(--primary); margin-bottom: .2rem; }
.livre-select-info .author { font-size: .8rem; color: var(--accent); font-style: italic; margin-bottom: .4rem; }
.livre-select-info .price { font-weight: 700; color: var(--primary); }
.livre-select-info .weight-info { font-size: .75rem; color: var(--text-light); }

.qty-control {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.qty-btn {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
    color: var(--primary);
}
.qty-btn:hover { background: var(--bg-light); }

.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .25rem;
    font-size: .9rem;
}

/* ── RECAP ── */
.recap-panel {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: sticky;
    top: 90px;
}

.recap-panel h3 { font-family: var(--font-serif); font-size: 1.1rem; color: var(--primary); margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }

.recap-lines { margin-bottom: 1rem; min-height: 60px; }
.recap-line { display: flex; justify-content: space-between; font-size: .85rem; padding: .3rem 0; }
.recap-line.empty { color: var(--text-light); font-style: italic; font-size: .85rem; }

.recap-total { border-top: 2px solid var(--primary); padding-top: .75rem; margin-top: .75rem; }
.recap-total .recap-line { font-weight: 700; font-size: .95rem; }
.recap-frais { color: var(--text-light); font-size: .8rem !important; }

/* ── FORMULAIRE ── */
.form-section { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.form-section h3 { font-family: var(--font-serif); font-size: 1.1rem; color: var(--primary); margin-bottom: 1rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .75rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--primary); }
.form-group input, .form-group textarea, .form-group select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem .8rem;
    font-size: .9rem;
    font-family: var(--font-sans);
    transition: border-color var(--transition);
    background: var(--bg);
    width: 100%;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.btn-submit {
    width: 100%;
    background: var(--cta);
    color: white;
    border: none;
    padding: .9rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .03em;
    transition: background var(--transition);
    margin-top: .5rem;
}
.btn-submit:hover { background: #6B1414; }
.btn-submit:disabled { background: #aaa; cursor: not-allowed; }

/* ── ALERT ── */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: .9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── PAGE MERCI ── */
.merci-box {
    max-width: 600px;
    margin: 5rem auto;
    text-align: center;
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.merci-icon { font-size: 4rem; margin-bottom: 1rem; }
.merci-box h1 { font-family: var(--font-serif); color: var(--primary); margin-bottom: 1rem; }
.merci-box p { color: var(--text-light); margin-bottom: 1.5rem; }

/* ── ADMIN ── */
.admin-body { background: #f4f6f9; }

.admin-header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-header h1 { font-size: 1.1rem; font-weight: 600; }
.admin-nav a { color: rgba(255,255,255,.8); margin-left: 1.5rem; font-size: .85rem; }
.admin-nav a:hover { color: white; text-decoration: none; }
.admin-nav a.active { color: white; font-weight: 600; }

.admin-content { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }

.admin-card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card h2 { font-size: 1.1rem; color: var(--primary); margin-bottom: 1.25rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }

.stat-card { background: white; border-radius: 8px; box-shadow: var(--shadow); padding: 1.25rem; border-left: 4px solid var(--accent); }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .05em; }

.btn-action {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition);
    text-decoration: none;
}
.btn-add { background: var(--primary); color: white; }
.btn-add:hover { background: #1a252f; color: white; text-decoration: none; }
.btn-edit { background: var(--accent); color: white; }
.btn-edit:hover { background: #6d5b40; color: white; text-decoration: none; }
.btn-delete { background: var(--cta); color: white; }
.btn-delete:hover { background: #6B1414; color: white; text-decoration: none; }

.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { background: var(--bg-light); padding: .75rem; text-align: left; font-weight: 600; color: var(--primary); border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: #fafafa; }
.data-table .thumb { width: 50px; height: 66px; object-fit: cover; border-radius: 2px; }

/* ── LOGIN ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-card { background: white; border-radius: 8px; padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { font-family: var(--font-serif); font-size: 1.4rem; color: var(--primary); margin-bottom: .25rem; }
.login-card p { font-size: .85rem; color: var(--text-light); margin-bottom: 1.5rem; }
.login-card .form-group { margin-bottom: 1rem; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 3rem; color: var(--text-light); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── PAGINATION / BREADCRUMB ── */
.page-hero { background: var(--primary); color: white; padding: 3rem 0; text-align: center; }
.page-hero h1 { font-family: var(--font-serif); font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 400; }
.page-hero p { color: rgba(255,255,255,.7); margin-top: .5rem; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .site-nav { display: none; flex-direction: column; position: absolute; top: 70px; left: 0; right: 0; background: var(--primary); padding: 1rem; gap: .5rem; }
    .site-nav.open { display: flex; }
    .site-nav a { padding: .5rem 1rem; border-radius: 4px; }
    .nav-toggle { display: block; }

    .precommande-layout { grid-template-columns: 1fr; }
    .recap-panel { position: static; }
    .form-row { grid-template-columns: 1fr; }
    .livre-select-item { grid-template-columns: 60px 1fr; }
    .qty-control { grid-column: 1 / -1; justify-self: start; }

    .hero { padding: 4rem 0 3rem; }
    .btn-secondary { margin-left: 0; margin-top: .75rem; }
}
