/* =====================================================================
   Theme EbookStore
   Palette : bleu ardoise (primaire), neutres, ambre (accent)
   ===================================================================== */
:root {
    --primary:      #1e3a5f;
    --primary-600:  #274b78;
    --primary-700:  #16304f;
    --accent:       #d98324;
    --accent-600:   #bf7016;
    --bg:           #f4f6f9;
    --surface:      #ffffff;
    --border:       #e2e7ee;
    --text:         #1c2733;
    --muted:        #64748b;
    --success-bg:   #e7f6ec;
    --success-tx:   #1a7f45;
    --error-bg:     #fdeaea;
    --error-tx:     #b42318;
    --radius:       12px;
    --shadow:       0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
    --shadow-lg:    0 12px 32px rgba(16,24,40,.12);
    --font: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.page { flex: 1; padding-top: 32px; padding-bottom: 48px; }

/* ---------------- Header ---------------- */
.site-header {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand-name { font-size: 20px; font-weight: 500; letter-spacing: .3px; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.main-nav a { color: #dbe4ef; text-decoration: none; font-size: 15px; transition: color .15s; }
.main-nav a:hover { color: #fff; }
.nav-admin { color: var(--accent) !important; font-weight: 600; }
.nav-user { color: #aab8c9; font-size: 14px; }

/* ---------------- Boutons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; cursor: pointer; text-decoration: none;
    padding: 11px 20px; border-radius: 10px; font-size: 15px; font-weight: 600;
    transition: background .15s, transform .05s; font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-600); }
.btn-dark { background: var(--primary); color: #fff; }
.btn-dark:hover { background: var(--primary-600); }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }

/* ---------------- Flash ---------------- */
.flash { padding: 13px 18px; border-radius: 10px; margin-bottom: 18px; font-size: 15px; }
.flash-success { background: var(--success-bg); color: var(--success-tx); }
.flash-error   { background: var(--error-bg);   color: var(--error-tx); }
.flash-info    { background: #eaf1fb;           color: #1e40af; }

/* ---------------- Hero ---------------- */
.hero {
    background: var(--primary);
    color: #fff; border-radius: 16px;
    padding: 46px 40px; margin-bottom: 36px;
    display: flex; flex-direction: column; gap: 12px;
}
.hero h1 { font-size: 34px; font-weight: 700; max-width: 620px; line-height: 1.2; }
.hero p { color: #c6d2e0; max-width: 560px; font-size: 17px; }

/* ---------------- Grille ebooks ---------------- */
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 24px; }
@media (min-width: 560px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.card-cover {
    aspect-ratio: 3 / 4; background: #dbe2ec; overflow: hidden;
    display: grid; place-items: center;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cover .placeholder { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.card-author { font-size: 13px; color: var(--muted); }
.card-desc { font-size: 14px; color: var(--muted); flex: 1; }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { font-size: 18px; font-weight: 700; color: var(--primary); }
.badge-owned {
    background: var(--success-bg); color: var(--success-tx);
    font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}

/* ---------------- Detail ebook ---------------- */
.detail { display: grid; grid-template-columns: 1fr; gap: 32px; }
@media (min-width: 780px) { .detail { grid-template-columns: 320px 1fr; } }
.detail-cover { aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: #dbe2ec; box-shadow: var(--shadow); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail h1 { font-size: 30px; margin-bottom: 6px; }
.detail .price { font-size: 26px; margin: 18px 0; }
.detail-desc { color: #475569; margin: 16px 0; white-space: pre-line; }

/* ---------------- Formulaires ---------------- */
.auth-wrap { max-width: 440px; margin: 20px auto; }
.card-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.card-form h1 { font-size: 24px; margin-bottom: 6px; }
.card-form .sub { color: var(--muted); margin-bottom: 24px; font-size: 15px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.field input, .field textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.field textarea { min-height: 120px; resize: vertical; }
.form-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.form-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.form-foot a { color: var(--primary); font-weight: 600; }

/* ---------------- Tables admin ---------------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.status-approved { background: var(--success-bg); color: var(--success-tx); }
.status-pending  { background: #fff4e0; color: #a15c00; }
.status-declined, .status-canceled { background: var(--error-bg); color: var(--error-tx); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 18px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------------- Pages Auth (login / register) ---------------- */
.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 40px 0;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(30,58,95,.10), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(217,131,36,.12), transparent 55%),
        var(--bg);
}
.auth-card {
    background: var(--surface);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Panneau visuel */
.auth-aside {
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-700) 100%);
    color: #fff;
    position: relative;
}
.auth-aside::after {
    content: "";
    position: absolute;
    right: -60px; bottom: -60px;
    width: 200px; height: 200px;
    background: rgba(217,131,36,.18);
    border-radius: 50%;
}
.auth-aside-inner { padding: 44px 36px; display: flex; flex-direction: column; height: 100%; position: relative; z-index: 1; }
.auth-brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 20px; font-weight: 700; margin-bottom: auto; }
.auth-brand i { color: var(--accent); }
.auth-aside h2 { font-size: 26px; font-weight: 700; margin: 28px 0 12px; line-height: 1.25; }
.auth-aside p { color: #c6d2e0; font-size: 15px; margin-bottom: 24px; }
.auth-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #e4ecf5; }
.auth-features li i { color: var(--accent); font-size: 18px; }

/* Colonne formulaire */
.auth-form-col { display: flex; align-items: center; }
.auth-form-inner { padding: 44px 40px; width: 100%; }
.auth-brand-sm { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); text-decoration: none; font-size: 22px; font-weight: 700; }
.auth-brand-sm i { color: var(--accent); }
.auth-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 15px; margin-bottom: 26px; }
.auth-foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--muted); }
.auth-foot a { color: var(--accent-600); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* Champs Bootstrap surcharges */
.auth-form-inner .form-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.auth-form-inner .input-group-text { background: #f8fafc; border-color: var(--border); color: var(--muted); }
.auth-form-inner .form-control { border-color: var(--border); }
.auth-form-inner .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(217,131,36,.18); }
.auth-form-inner .btn-primary { background: var(--accent); border-color: var(--accent); }
.auth-form-inner .btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }

@media (max-width: 767.98px) {
    .auth-form-inner { padding: 32px 24px; }
}

/* ---------------- Page Checkout ---------------- */
.checkout-page {
    flex: 1;
    padding: 32px 0 56px;
    background:
        radial-gradient(1000px 400px at 100% -10%, rgba(30,58,95,.06), transparent 60%),
        var(--bg);
}
.checkout-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 18px;
}
.checkout-breadcrumb a { color: var(--muted); text-decoration: none; }
.checkout-breadcrumb a:hover { color: var(--accent-600); }
.checkout-breadcrumb i { font-size: 11px; opacity: .6; }
.checkout-breadcrumb span { color: var(--text); font-weight: 600; }

.checkout-title { font-size: 30px; font-weight: 700; margin-bottom: 4px; }
.checkout-lead { color: var(--muted); font-size: 15px; margin-bottom: 8px; }

.checkout-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px;
    box-shadow: var(--shadow);
}
.checkout-card-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; }
.checkout-card-title i { color: var(--accent); }

/* Article */
.checkout-item { display: flex; gap: 18px; align-items: flex-start; }
.checkout-item-cover { flex: 0 0 92px; }
.checkout-item-cover img {
    width: 92px; height: 130px; object-fit: cover;
    border-radius: 10px; box-shadow: var(--shadow);
}
.checkout-item-noimg {
    width: 92px; height: 130px; border-radius: 10px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.checkout-item-info { flex: 1; min-width: 0; }
.checkout-item-info h3 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.checkout-item-author { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.checkout-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: #eef2f7; color: var(--primary);
    font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; margin: 0 6px 6px 0;
}
.checkout-item-price { font-size: 20px; font-weight: 800; color: var(--primary); white-space: nowrap; }

.checkout-features { list-style: none; padding: 20px 0 0; margin: 20px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.checkout-features li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); }
.checkout-features li i { color: #16a34a; font-size: 17px; }

/* Resume */
.checkout-summary { position: sticky; top: 20px; }
.checkout-line { display: flex; justify-content: space-between; font-size: 15px; color: var(--text); margin-bottom: 12px; }
.checkout-line span:first-child { color: var(--muted); }
.checkout-total { font-size: 20px; font-weight: 800; }
.checkout-total span:first-child { color: var(--text); }
.checkout-total span:last-child { color: var(--primary); }

.checkout-buyer {
    display: flex; align-items: center; gap: 12px;
    background: #f8fafc; border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 14px; margin: 20px 0;
}
.checkout-buyer i { font-size: 30px; color: var(--primary); }
.checkout-buyer strong { display: block; font-size: 14px; }
.checkout-buyer span { display: block; font-size: 13px; color: var(--muted); }

.btn-pay {
    background: var(--accent); border: none; color: #fff;
    font-weight: 700; font-size: 16px; padding: 13px 20px;
    border-radius: 12px; transition: background .15s ease, transform .1s ease;
}
.btn-pay:hover { background: var(--accent-600); color: #fff; transform: translateY(-1px); }

.checkout-secure { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--muted); margin: 16px 0 6px; }
.checkout-secure i { color: #16a34a; font-size: 16px; margin-top: 1px; }
.checkout-cancel { display: block; text-align: center; font-size: 14px; color: var(--muted); text-decoration: none; }
.checkout-cancel:hover { color: var(--accent-600); text-decoration: underline; }

@media (max-width: 575.98px) {
    .checkout-item { flex-wrap: wrap; }
    .checkout-item-price { width: 100%; }
    .checkout-title { font-size: 24px; }
}
