/*
Theme Name: lebonlivre
Theme URI: https://lebonlivre.fr
Author: lebonlivre.fr
Description: Thème WooCommerce pour la vente de livres d'occasion. Accueil avec hero + recherche, catégories, coups de cœur, réassurance.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: lebonlivre
WC requires at least: 8.0
*/

:root {
  --red: #e30613;
  --red-dark: #b8050f;
  --ink: #111111;
  --grey: #5b5b5b;
  --line: #ececec;
  --soft: #f6f4f2;
  --cream: #fbf8f5;
  --radius: 14px;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --script: "Caveat", cursive;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: #fff; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; font-weight: 700; }
.container { width: min(1200px, 100% - 40px); margin-inline: auto; }
.screen-reader-text { position: absolute; left: -9999px; }

/* Boutons */
.btn, .button, button.button, a.button, .woocommerce a.button, .woocommerce button.button,
.woocommerce #respond input#submit, .woocommerce input.button, .woocommerce a.button.alt,
.woocommerce button.button.alt, .woocommerce input.button.alt {
  background: var(--red); color: #fff; border: 0; border-radius: 999px; padding: .85em 1.6em;
  font-weight: 600; font-family: var(--font); cursor: pointer; transition: background .2s, transform .2s;
  display: inline-block; font-size: 1rem; line-height: 1.2;
}
.btn:hover, .button:hover, .woocommerce a.button:hover, .woocommerce button.button:hover,
.woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover { background: var(--red-dark); color: #fff; transform: translateY(-1px); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; }
.site-logo img, .site-logo svg { height: 52px; width: auto; }
.main-nav ul { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; }
.main-nav a { font-size: .86rem; font-weight: 500; padding: 8px 0; position: relative; }
.main-nav .current-menu-item > a, .main-nav .current_page_item > a { color: var(--red); }
.main-nav .current-menu-item > a::after, .main-nav .current_page_item > a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -24px; height: 2px; background: var(--red); }
.header-actions { display: flex; align-items: center; gap: 22px; font-size: .85rem; }
.header-actions a { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.header-actions svg { width: 22px; height: 22px; }
.cart-count { position: absolute; top: -9px; left: 12px; background: var(--red); color: #fff; border-radius: 50%; min-width: 18px; height: 18px; font-size: .68rem; display: grid; place-items: center; font-weight: 700; }
.nav-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.nav-toggle svg { width: 26px; height: 26px; }

/* Hero */
.hero { position: relative; background: linear-gradient(100deg, #fff 0%, #fbf3ee 55%, #f1e2d6 100%) right center/auto 100% no-repeat; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,.88) 38%, rgba(255,255,255,0) 70%); pointer-events: none; }
.hero-inner { position: relative; padding: 56px 0 44px; min-height: 440px; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { color: var(--red); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 30px; height: 2px; background: var(--red); }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); max-width: 640px; letter-spacing: -.02em; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero p.lead { font-size: 1.1rem; color: #333; max-width: 520px; margin-bottom: 26px; }
.hero-search { display: flex; background: #fff; border-radius: 999px; box-shadow: 0 6px 28px rgba(0,0,0,.12); padding: 6px; max-width: 640px; border: 1px solid var(--line); }
.hero-search svg { width: 20px; height: 20px; margin: auto 10px auto 16px; flex: none; }
.hero-search input[type=search] { flex: 1; border: 0; outline: 0; font: inherit; font-size: .95rem; min-width: 0; background: transparent; }
.popular { margin-top: 18px; font-size: .78rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: #333; }
.popular a { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: .74rem; }
.popular a:hover { border-color: var(--red); }
.hero-quote { position: absolute; right: 6%; top: 40px; font-family: var(--script); font-size: 1.6rem; color: var(--ink); text-align: center; transform: rotate(-6deg); line-height: 1.1; display: none; }
@media (min-width: 980px) { .hero-quote { display: block; } }

/* Catégories */
.cat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin: 22px auto; }
.cat-card { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; min-height: 108px; display: flex; flex-direction: column; justify-content: space-between; font-weight: 600; font-size: .9rem; transition: box-shadow .2s, transform .2s; background-size: cover; background-position: right center; }
.cat-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.1); transform: translateY(-2px); }
.cat-card .go { width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.cat-card.promo { background: linear-gradient(135deg, #e30613, #b8050f); color: #fff; }
.cat-card.promo .go { background: #fff; color: var(--red); }

/* Sections */
.section-title { display: flex; align-items: center; gap: 16px; margin: 34px 0 16px; }
.section-title h2 { font-size: 1.35rem; margin: 0; }
.section-title .line { width: 56px; height: 2px; background: var(--red); }
.section-title a.all { margin-left: auto; color: var(--red); font-size: .78rem; font-weight: 500; }

/* Cartes produit (accueil) */
.pick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.pick { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; transition: box-shadow .2s; }
.pick:hover { box-shadow: 0 8px 24px rgba(0,0,0,.09); }
.pick .cover { aspect-ratio: 2/3; background: var(--soft); border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.pick .cover img { width: 100%; height: 100%; object-fit: cover; }
.pick h3 { font-size: .86rem; margin: 0; font-weight: 600; }
.pick .author { font-size: .74rem; color: var(--grey); margin-top: -4px; }
.pick .meta { display: flex; align-items: center; gap: 6px; font-size: .7rem; color: var(--grey); }
.stars { color: #f5a623; letter-spacing: 1px; }
.pick .buy { display: flex; align-items: flex-end; justify-content: space-between; margin-top: auto; }
.price del { display: block; font-size: .72rem; color: #888; }
.price ins, .price .amount { text-decoration: none; }
.pick .price ins, .pick .price > .woocommerce-Price-amount { color: var(--red); font-weight: 700; font-size: 1.05rem; }
.pick .add { width: 38px; height: 38px; border-radius: 8px; background: var(--red); display: grid; place-items: center; color: #fff; padding: 0; }
.pick .add:hover { background: var(--red-dark); color: #fff; }
.pick .add svg { width: 18px; height: 18px; }

/* Réassurance */
.trust { background: var(--soft); border-radius: var(--radius); display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 22px 28px; margin: 34px auto 20px; }
.trust-item { display: flex; gap: 16px; align-items: center; }
.trust-item svg { width: 44px; height: 44px; color: var(--red); flex: none; }
.trust-item strong { display: block; font-size: .9rem; }
.trust-item span { font-size: .76rem; color: var(--grey); line-height: 1.3; display: block; }
.tagline { text-align: center; font-family: var(--script); font-size: 1.5rem; color: var(--red); display: flex; align-items: center; gap: 18px; justify-content: center; margin: 30px 0 40px; }
.tagline::before, .tagline::after { content: ""; height: 1px; width: 70px; background: var(--red); }

/* Footer */
.site-footer { background: #111; color: #ddd; padding: 48px 0 20px; font-size: .88rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.site-footer h4 { color: #fff; font-size: .95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer a:hover { color: #fff; }
.copyright { border-top: 1px solid #2a2a2a; margin-top: 30px; padding-top: 16px; font-size: .78rem; color: #999; text-align: center; }

/* Pages & WooCommerce */
.page-wrap { padding: 36px 0 60px; }
.page-wrap h1.entry-title, .woocommerce-products-header__title { font-size: 2rem; }
.woocommerce ul.products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 0 0 30px; padding: 0; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none; }
.woocommerce ul.products li.product { width: auto !important; margin: 0 !important; float: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff; display: flex; flex-direction: column; position: relative; }
.woocommerce ul.products li.product img { aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; margin-bottom: 10px; width: 100%; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: .92rem; padding: 0; }
.woocommerce ul.products li.product .price { color: var(--red); font-weight: 700; margin: 6px 0 12px; display: block; }
.woocommerce ul.products li.product .price del { color: #888; font-weight: 400; }
.woocommerce ul.products li.product .button { margin-top: auto; text-align: center; }
.woocommerce span.onsale { background: var(--red); min-height: auto; min-width: auto; line-height: 1; padding: 8px 12px; border-radius: 999px; top: 10px; left: 10px; right: auto; }
.woocommerce div.product .product_title { font-size: 1.9rem; }
.woocommerce div.product p.price, .woocommerce div.product span.price { color: var(--red); font-weight: 700; font-size: 1.6rem; }
.woocommerce div.product div.images img { border-radius: var(--radius); }
.woocommerce-tabs ul.tabs li.active { border-bottom-color: #fff; }
.woocommerce .woocommerce-ordering select, .woocommerce-page input[type=text], .woocommerce-page input[type=email], .woocommerce-page input[type=tel], .woocommerce-page input[type=password], .woocommerce-page textarea, .woocommerce-page select { border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; font: inherit; }
.woocommerce-message, .woocommerce-info { border-top-color: var(--red); }
.woocommerce-message::before, .woocommerce-info::before { color: var(--red); }
.lbl-condition { display: inline-block; background: #f0fff4; color: #14733a; border: 1px solid #bfe8cd; border-radius: 999px; font-size: .74rem; padding: 3px 12px; margin-bottom: 10px; font-weight: 600; }

/* ===================== Responsive ===================== */
img, video, iframe { max-width: 100%; }
body { overflow-x: hidden; }
.woocommerce table.shop_table_responsive, .woocommerce table.cart { width: 100%; }

@media (max-width: 1100px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
  .woocommerce ul.products { grid-template-columns: repeat(3, 1fr); }
  .trust { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .main-nav ul { gap: 18px; }
}

/* Tablette / mobile : menu burger */
@media (max-width: 860px) {
  .container { width: calc(100% - 32px); }
  .header-inner { min-height: 64px; gap: 12px; flex-wrap: nowrap; }
  .site-logo { margin-right: auto; }
  .site-logo img, .site-logo svg, .custom-logo { height: 40px; width: auto; max-width: 62vw; object-fit: contain; }
  .nav-toggle { display: grid; place-items: center; order: 3; width: 44px; height: 44px; }
  .header-actions { order: 2; gap: 6px; }
  .header-actions a { width: 44px; height: 44px; justify-content: center; }
  .header-actions .label { display: none; }
  .cart-count { top: 4px; left: auto; right: 2px; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 14px 24px rgba(0,0,0,.08); padding: 6px 16px 16px; max-height: calc(100vh - 64px); overflow-y: auto; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav li { border-bottom: 1px solid var(--line); }
  .main-nav li:last-child { border-bottom: 0; }
  .main-nav a { display: block; padding: 14px 4px; font-size: 1rem; }
  .main-nav .current-menu-item > a::after, .main-nav .current_page_item > a::after { display: none; }

  .hero { background-position: 72% center; background-size: cover; }
  .hero::before { background: linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(255,255,255,.86) 60%, rgba(255,255,255,.7) 100%); }
  .hero-inner { padding: 34px 0 30px; min-height: 0; }
  .hero h1 { font-size: clamp(1.85rem, 8vw, 2.4rem); }
  .hero p.lead { font-size: 1rem; margin-bottom: 20px; }
  .hero-quote { display: none !important; }

  .section-title { flex-wrap: wrap; gap: 8px 12px; margin: 26px 0 14px; }
  .section-title h2 { font-size: 1.2rem; }
  .section-title .line { width: 36px; }
  .section-title a.all { margin-left: 0; width: 100%; }

  .woocommerce div.product div.images, .woocommerce div.product div.summary,
  .woocommerce-page div.product div.images, .woocommerce-page div.product div.summary { float: none; width: 100%; }
  .woocommerce div.product .product_title { font-size: 1.5rem; }
  .woocommerce div.product form.cart .button { width: 100%; padding: 1em; }
  .woocommerce div.product form.cart div.quantity { margin-right: 10px; }
  .woocommerce-tabs ul.tabs { padding-left: 0; }
  .woocommerce-checkout .col2-set .col-1, .woocommerce-checkout .col2-set .col-2,
  .woocommerce-page .col2-set .col-1, .woocommerce-page .col2-set .col-2 { float: none; width: 100%; }
  .woocommerce form .form-row-first, .woocommerce form .form-row-last,
  .woocommerce-page form .form-row-first, .woocommerce-page form .form-row-last { width: 100%; float: none; }
  .woocommerce .cart-collaterals .cart_totals, .woocommerce-page .cart-collaterals .cart_totals { float: none; width: 100%; }
  .woocommerce-cart table.cart td.actions .coupon { float: none; display: flex; gap: 8px; margin-bottom: 10px; }
  .woocommerce-cart table.cart td.actions .coupon input { flex: 1; width: auto !important; min-width: 0; }
  .woocommerce-cart table.cart td.actions > .button { width: 100%; }
  .woocommerce .woocommerce-ordering, .woocommerce .woocommerce-result-count { float: none; display: block; margin: 0 0 12px; }
  .woocommerce .woocommerce-ordering select { width: 100%; }
  .woocommerce-MyAccount-navigation, .woocommerce-MyAccount-content { float: none !important; width: 100% !important; }
}

/* Mobile */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .container { width: calc(100% - 28px); }
  .page-wrap { padding: 22px 0 40px; }
  .page-wrap h1.entry-title, .woocommerce-products-header__title { font-size: 1.5rem; }

  /* Recherche : champ puis bouton pleine largeur */
  .hero-search { flex-wrap: wrap; border-radius: 18px; padding: 8px; }
  .hero-search svg { margin: auto 6px auto 10px; }
  .hero-search input[type=search] { flex: 1 1 calc(100% - 44px); padding: 10px 4px; font-size: 16px; }
  .hero-search .btn { width: 100%; margin-top: 6px; padding: 13px; }
  .popular { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; margin-right: -14px; scrollbar-width: none; }
  .popular::-webkit-scrollbar { display: none; }
  .popular span, .popular a { flex: none; white-space: nowrap; }

  /* Catégories : 2 colonnes */
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
  .cat-card { min-height: 84px; padding: 14px 12px; font-size: .85rem; }

  /* Coups de cœur : défilement horizontal */
  .pick-grid { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; margin-right: -14px; padding: 0 14px 10px 0; scrollbar-width: none; }
  .pick-grid::-webkit-scrollbar { display: none; }
  .pick { flex: 0 0 44%; scroll-snap-align: start; }
  .pick .add { width: 42px; height: 42px; }

  /* Réassurance compacte */
  .trust { grid-template-columns: 1fr 1fr; gap: 16px 12px; padding: 18px 14px; margin: 24px 0 14px; }
  .trust-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .trust-item svg { width: 34px; height: 34px; }
  .tagline { font-size: 1.2rem; gap: 10px; margin: 22px 0 28px; text-align: center; }
  .tagline::before, .tagline::after { width: 24px; flex: none; }

  /* Boutique */
  .woocommerce ul.products { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .woocommerce ul.products li.product { padding: 8px; }
  .woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: .85rem; }
  .woocommerce ul.products li.product .button { padding: .75em .6em; font-size: .85rem; }

  /* Panier : lignes lisibles */
  .woocommerce table.shop_table_responsive tr td { padding: 10px 8px; }
  .woocommerce-cart .cart-collaterals .cart_totals h2 { font-size: 1.2rem; }

  /* Pied de page */
  .site-footer { padding: 34px 0 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }

  /* Champs : 16px pour éviter le zoom automatique sur iPhone */
  input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=search], select, textarea { font-size: 16px; }
  .btn, .button { min-height: 44px; }
}

@media (max-width: 360px) {
  .pick { flex-basis: 62%; }
  .trust { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
