/* ============================================================
   TripCooking — INDEX (CSS COMPLET basé sur index.php)
   - Layout grid (sidebar + main)
   - Sidebar arrondie + scroll interne (index-sidebar__inner)
   - Pills thèmes/pays TOUJOURS visibles
   - Sections recettes arrondies
   - Carousel + flèches
   - Responsive desktop -> smartphone
   ============================================================ */

/* =========================
   RESET / BASE
   ========================= */
*{box-sizing:border-box}
html,body{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
  margin:0;
  padding:0;
}
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:#1f1f2b;
  background:
    radial-gradient(1100px 700px at 14% 0%, rgba(122,75,255,.16) 0%, transparent 60%),
    radial-gradient(1100px 700px at 92% 8%, rgba(255,106,162,.14) 0%, transparent 55%),
    linear-gradient(180deg, #fbfaff 0%, #f3eeff 100%);
}
img{display:block;max-width:100%}
a{color:inherit;text-decoration:none}
button{font:inherit}
:focus-visible{outline:3px solid rgba(122,75,255,.35);outline-offset:2px}

.clamp-1{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.muted{color:rgba(31,31,43,.58)}
.empty{padding:10px;color:rgba(31,31,43,.55);font-weight:900}

/* =========================
   VARIABLES
   ========================= */
:root{
  --text:#1f1f2b;
  --muted:rgba(31,31,43,.58);
  --primary:#7a4bff;
  --primary2:#ff6aa2;

  --card:#ffffff;
  --stroke:rgba(40,20,80,.08);

  --shadow:0 18px 40px rgba(31,31,43,.10);
  --shadow2:0 12px 26px rgba(31,31,43,.08);

  --r-xxl:30px;
  --r-xl:24px;
  --r-lg:20px;
  --r-md:14px;

  --cover-h:175px;
  --recipe-w:260px;
  --recipe-h:320px;
}

/* =========================
   CARD BASE
   ========================= */
.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--r-xxl);
  box-shadow:var(--shadow);
}

/* ============================================================
   TOPBAR (tc-topbar) — FULL WIDTH / collé en haut
   ============================================================ */
.tc-topbar{
  position: sticky;
  top: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  gap: 16px;

  width: 100%;
  margin: 0;                 /* ✅ plus de marge */
  padding: 14px 20px;        /* padding interne */

  background: rgba(255,255,255,.95);
  border-bottom: 1px solid rgba(40,20,80,.08); /* séparation douce */
  border-radius: 0;          /* ✅ plus d’arrondi */
  box-shadow: 0 10px 22px rgba(31,31,43,.08);
  backdrop-filter: blur(10px);
}
.tc-topbar > *{
  max-width: 1440px;
}

/* Brand */
.tc-brand{flex:0 0 auto}
.tc-brand-link{display:flex;gap:10px;align-items:center}
.tc-logo{
  width:40px;height:40px;border-radius:14px;
  display:grid;place-items:center;
  font-weight:900;color:#fff;
  -webkit-text-fill-color:#fff;
  background:linear-gradient(135deg, var(--primary), #b8a6ff);
  box-shadow:0 12px 22px rgba(122,75,255,.18);
}
.tc-brand-text strong{font-size:16px;letter-spacing:.2px}

/* Search */
.tc-search{flex:1 1 auto;min-width:260px;min-width:0}
.tc-topbar .search{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;

  padding:11px 14px;
  border-radius:999px;

  background:rgba(122,75,255,.05);
  border:1px solid rgba(122,75,255,.10);
  box-shadow:none;
}
.tc-topbar .search input{
  width:100%;
  border:none;
  outline:none;
  background:transparent;
  font-size:14px;
  font-weight:800;
  color:var(--text);
  min-width:0;
}
.tc-topbar .search input::placeholder{color:rgba(31,31,43,.45);font-weight:800}
.tc-topbar .search:focus-within{
  background:rgba(255,255,255,.90);
  border-color:rgba(122,75,255,.28);
  box-shadow:0 0 0 4px rgba(122,75,255,.12);
}

/* Dropdown */
.search-dropdown{
  position:absolute;
  left:0; right:0;
  top:calc(100% + 10px);

  border-radius:22px;
  background:rgba(255,255,255,.98);
  border:1px solid rgba(40,20,80,.08);
  box-shadow:0 18px 38px rgba(31,31,43,.14);
  overflow:hidden;
}
.search-dropdown ul{list-style:none;margin:0;padding:8px}
.search-dropdown li,
.search-dropdown a{
  display:block;
  padding:10px 12px;
  border-radius:16px;
  font-weight:900;
  color:var(--text);
}
.search-dropdown li:hover,
.search-dropdown a:hover{background:rgba(122,75,255,.08)}

/* Actions */
.tc-topbar-actions{display:flex;align-items:center;gap:10px;flex:0 0 auto}
.icon-btn{
  width:44px;height:44px;border-radius:999px;
  display:grid;place-items:center;
  background:rgba(122,75,255,.06);
  border:1px solid rgba(122,75,255,.12);
}
.icon-btn:hover{background:rgba(122,75,255,.10)}
.icon-btn .icon{
  width:22px;height:22px;border-radius:999px;
  background:rgba(122,75,255,.30);
}
.tc-topbar .btn.primary{
  border:none;
  border-radius:999px;
  padding:12px 16px;
  font-weight:900;
  color:#fff;
  -webkit-text-fill-color:#fff;
  background:linear-gradient(90deg, var(--primary2), var(--primary));
  box-shadow:0 14px 26px rgba(122,75,255,.18);
  cursor:pointer;
}
.tc-topbar .btn.primary:hover{box-shadow:0 16px 32px rgba(122,75,255,.22)}

/* ============================================================
   LAYOUT INDEX (index-app)
   ============================================================ */
.index-app{
  display:grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap:18px;
  padding:0 16px 16px;
  align-items:start;
  margin-top: 24px;
}
/* Overlay */
#overlayCapture{
  position:fixed;
  inset:0;
  background:rgba(15, 10, 30, .45);
  backdrop-filter: blur(6px);
  z-index:9990;
  display:none; /* affiché en JS */
}

/* Modal container */
.indexCapture{
  position:fixed;
  left:50%;
  top:50%;
  transform:translate(-50%, -50%);

  width:min(760px, calc(100vw - 28px));
  max-height:calc(100vh - 28px);

  background:rgba(255,255,255,.96);
  border:1px solid rgba(122,75,255,.14);
  box-shadow:0 24px 60px rgba(31,31,43,.22);

  border-radius:28px;
  overflow:hidden;
  z-index:9991;

  display:none; /* affiché en JS */
}

/* Header */
.modalHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;

  padding:16px 18px;

  background:
    radial-gradient(600px 240px at 20% 0%, rgba(122,75,255,.12), transparent 60%),
    rgba(255,255,255,.96);

  border-bottom:1px solid rgba(40,20,80,.08);
}

.modalHeader h2{
  margin:0;
  font-size:18px;
  font-weight:900;
  color:#1f1f2b;
}

/* Close */
#closeCapture{
  width:38px;
  height:38px;
  border-radius:999px;
  display:grid;
  place-items:center;
  cursor:pointer;

  color:rgba(31,31,43,.75);
  background:rgba(122,75,255,.08);
  border:1px solid rgba(122,75,255,.14);
  user-select:none;
}
#closeCapture:hover{
  background:rgba(122,75,255,.12);
  color:rgba(31,31,43,.9);
}

/* Body scrollable */
#formulaireRecetteContainer{
  display:block;
}
.modal-body{
  padding:16px 18px 6px;
  overflow:auto;
  max-height:calc(100vh - 28px - 70px - 84px); /* viewport - modal padding - header - footer */
}
.modal-body::-webkit-scrollbar{width:10px}
.modal-body::-webkit-scrollbar-thumb{
  background:rgba(122,75,255,.18);
  border-radius:999px;
  border:2px solid transparent;
  background-clip:padding-box;
}

/* Labels */
.modal-body label{
  display:block;
  margin:12px 0 8px;
  font-weight:900;
  font-size:13px;
  color:rgba(31,31,43,.82);
}

/* Inputs / selects / textarea */
.form-control{
  width:100%;
  padding:12px 14px;
  border-radius:16px;

  background:rgba(122,75,255,.05);
  border:1px solid rgba(122,75,255,.12);

  outline:none;
  color:#1f1f2b;
  font-weight:800;
}
.form-control:focus{
  background:#fff;
  border-color:rgba(122,75,255,.28);
  box-shadow:0 0 0 4px rgba(122,75,255,.12);
}

/* Textarea height comfort */
#descriptionContenu{
  min-height:140px;
  resize:vertical;
}

/* Custom file upload */
.custom-file-upload{
  display:flex;
  align-items:center;
  gap:10px;

  margin-top:12px;
  padding:12px 14px;
  border-radius:16px;

  background:rgba(255,255,255,.96);
  border:1px dashed rgba(122,75,255,.30);

  cursor:pointer;
  font-weight:900;
  color:rgba(31,31,43,.85);
}
.custom-file-upload:hover{
  border-color:rgba(122,75,255,.42);
  background:#fff;
}
.custom-file-upload input[type="file"]{
  display:none;
}

/* Image preview */
.image-preview{
  margin-top:12px;
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(40,20,80,.08);
  background:rgba(245,245,255,.8);
}
.previewing-capture{
  width:100%;
  height:220px;
  object-fit:cover;
  display:block;
}

/* Choisir pays results dropdown */
#choisirPays{position:relative}
#resultatPaysModale{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 8px);

  background:rgba(255,255,255,.98);
  border:1px solid rgba(40,20,80,.08);
  border-radius:18px;
  box-shadow:0 18px 38px rgba(31,31,43,.14);

  overflow:hidden;
  display:none; /* tu l'affiches en JS */
  z-index:3;
}
#resultatPaysModale ul{
  list-style:none;
  margin:0;
  padding:8px;
}
#resultatPaysModale li{
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  font-weight:900;
  color:#1f1f2b;
}
#resultatPaysModale li:hover{
  background:rgba(122,75,255,.08);
}

/* Footer */
.modalFooter{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;

  padding:14px 18px;

  border-top:1px solid rgba(40,20,80,.08);
  background:rgba(255,255,255,.96);
}

#messageCapture{
  font-weight:900;
  font-size:13px;
  color:rgba(31,31,43,.70);
  min-height:18px;
}

/* Loader */
.loaderCapture img{
  width:26px;
  height:26px;
  display:block;
}

/* Submit */
.post-button,
.btn-success.post-button{
  border:none;
  border-radius:999px;
  padding:12px 18px;
  font-weight:900;
  color:#fff;
  -webkit-text-fill-color:#fff;
  background:linear-gradient(90deg, #ff6aa2, #7a4bff);
  box-shadow:0 14px 26px rgba(122,75,255,.18);
  cursor:pointer;
}
.post-button:hover{
  box-shadow:0 16px 32px rgba(122,75,255,.22);
}

/* ============================================================
   Helpers: modal open state (si tu veux)
   - Ajoute la class .is-open via JS sur body ou modal
   ============================================================ */
body.modal-open{
  overflow:hidden;
}
/* Empêche les enfants de “forcer” la largeur */
.index-main,
.section-head > div{min-width:0}

/* ============================================================
   SIDEBAR (index-sidebar + inner)
   ============================================================ */
.index-sidebar.card{
  position:sticky;
  top:16px;

  height:auto;
  max-height:calc(100vh - 32px);

  border-radius:var(--r-xxl);
  overflow:hidden;

  background:
    radial-gradient(520px 220px at 20% 0%, rgba(122,75,255,.12), transparent 60%),
    rgba(255,255,255,.92);

  border:1px solid rgba(122,75,255,.14);
  box-shadow:var(--shadow);
}

/* scroll + padding = inner */
.index-sidebar__inner{
  height:100%;
  overflow:auto;
  padding:18px;
}
.index-sidebar__inner::-webkit-scrollbar{width:10px}
.index-sidebar__inner::-webkit-scrollbar-thumb{
  background:rgba(122,75,255,.18);
  border-radius:999px;
  border:2px solid transparent;
  background-clip:padding-box;
}

/* ✅ Force visibilité (problème des pills “blanches”) */
.index-sidebar__inner,
.index-sidebar__inner *{
  color:var(--text) !important;
  opacity:1 !important;
  filter:none !important;
  text-shadow:none !important;
  mix-blend-mode:normal !important;
}
.index-sidebar__inner a{
  color:var(--text) !important;
  -webkit-text-fill-color:var(--text) !important;
}

/* Nav */
.nav{display:flex;flex-direction:column;gap:10px}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:12px 12px;
  border-radius:16px;
  font-weight:900;
  border:1px solid transparent;
  background:transparent;
}
.nav-item:hover{background:rgba(122,75,255,.06);border-color:rgba(122,75,255,.14)}
.nav-item.active{background:rgba(122,75,255,.10);border-color:rgba(122,75,255,.18)}

.nav-section{display:flex;flex-direction:column;gap:10px;margin-top:6px}
.nav-title{
  font-size:12px;
  letter-spacing:.10em;
  text-transform:uppercase;
  font-weight:900;
  color:rgba(31,31,43,.62) !important;
  -webkit-text-fill-color:rgba(31,31,43,.62) !important;
}

.pill-wrap{display:flex;flex-wrap:wrap;gap:10px}
.pill,
.pill *{
  color:var(--text) !important;
  -webkit-text-fill-color:var(--text) !important;
  opacity:1 !important;
}
.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:999px;
  font-size:13px;
  font-weight:900;

  background:rgba(255,255,255,.96);
  border:1px solid rgba(40,20,80,.10);
  box-shadow:0 10px 18px rgba(31,31,43,.05);
}
.pill:hover{background:#fff;border-color:rgba(122,75,255,.22)}

.nav-bottom{margin-top:14px;display:flex;flex-direction:column;gap:10px;padding-top:6px}

/* ============================================================
   MAIN
   ============================================================ */
.index-main{
  display:flex;
  flex-direction:column;
  gap:18px;
}

/* ============================================================
   SECTIONS RECETTES
   ============================================================ */
.index-section.card{
  padding:18px;
  border-radius:var(--r-xxl);
  overflow:hidden;

  background:
    radial-gradient(760px 240px at 10% 0%, rgba(122,75,255,.10), transparent 60%),
    rgba(255,255,255,.92);

  border:1px solid rgba(122,75,255,.12);
  box-shadow:var(--shadow2);
}

.section-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.section-head h2{margin:0;font-size:18px;font-weight:900}
.section-head p{margin:4px 0 0;font-size:13px;font-weight:800}
.link{color:var(--primary);font-weight:900}
.link:hover{text-decoration:underline}

/* ============================================================
   CAROUSEL
   ============================================================ */
.tc-carousel{
  display:flex;
  align-items:center;
  gap:12px;
}

.tc-carousel__btn{
  width:42px;height:42px;
  border-radius:999px;
  border:1px solid rgba(122,75,255,.18);
  background:rgba(255,255,255,.95);
  box-shadow:0 10px 18px rgba(31,31,43,.06);
  cursor:pointer;
  font-size:22px;
  font-weight:900;
  color:rgba(31,31,43,.75);
  display:grid;
  place-items:center;
  flex:0 0 auto;
}
.tc-carousel__btn:hover{background:#fff}

.tc-hscroll{
  flex:1;
  min-width:0;

  display:flex;
  gap:14px;

  overflow-x:auto;
  overflow-y:hidden;
  padding-bottom:10px;

  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
}
.tc-hscroll::-webkit-scrollbar{height:10px}
.tc-hscroll::-webkit-scrollbar-thumb{
  background:rgba(122,75,255,.18);
  border-radius:999px;
  border:2px solid transparent;
  background-clip:padding-box;
}

/* ============================================================
   RECIPE CARD
   ============================================================ */
.recipe-card{
  width:var(--recipe-w);
  min-width:var(--recipe-w);
  height:var(--recipe-h);

  display:flex;
  flex-direction:column;

  background:#fff;
  border:1px solid rgba(40,20,80,.08);
  border-radius:var(--r-xxl);
  overflow:hidden;
  box-shadow:0 12px 22px rgba(31,31,43,.08);
  scroll-snap-align:start;
}

.rc-cover{
  position:relative;
  display:block;
  width:100%;
  height:var(--cover-h);
  overflow:hidden;
  background:#f3f3fb;
}
.rc-cover-img{width:100%;height:100%;object-fit:cover}

.rc-cover-badge{
  position:absolute;
  left:12px;bottom:12px;
  padding:7px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  color:#fff;
  -webkit-text-fill-color:#fff;
  background:rgba(0,0,0,.55);
  max-width:calc(100% - 24px);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.rc-body{
  flex:1;
  padding:12px 12px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.rc-title{
  font-weight:900;
  font-size:14px;
  line-height:1.25;
  min-height:36px;
}

.rc-actions{margin-top:auto;display:flex;justify-content:flex-end}

/* ============================================================
   BUTTONS (pour "Voir")
   ============================================================ */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  border-radius:999px;
  border:1px solid rgba(122,75,255,.18);
  background:rgba(255,255,255,.92);
  font-weight:900;
  cursor:pointer;
  box-shadow:0 10px 18px rgba(31,31,43,.06);
}
.btn:hover{background:#fff}

.btn-mini{
  padding:10px 16px;
  font-size:13px;
  border:none;
  color:var(--primary);
  -webkit-text-fill-color:var(--primary);
  background:rgba(122,75,255,.12);
  box-shadow:none;
}
.btn-mini:hover{background:rgba(122,75,255,.16)}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* <= 1200 : un peu plus compact */
@media (max-width: 1200px){
  :root{--recipe-w:240px;--cover-h:165px}
  .index-app{grid-template-columns: 270px minmax(0,1fr)}
}

/* <= 980 : 1 colonne (sidebar au-dessus) */
@media (max-width: 980px){
  .tc-topbar{position:relative;top:auto;margin:12px 12px 14px}
  .index-app{grid-template-columns:1fr;padding:0 12px 12px}
  .index-sidebar.card{
    position:relative;
    top:auto;
    max-height:none;
  }
  .index-sidebar__inner{overflow:visible}
}

/* <= 640 : topbar wrap (brand/actions + search dessous) */
@media (max-width: 640px){
  .indexCapture{
    width:calc(100vw - 18px);
    border-radius:22px;
  }
  .modalHeader{padding:14px 14px}
  .modalHeader h2{font-size:16px}
  .modal-body{padding:14px 14px 6px}
  .modalFooter{padding:12px 14px; flex-wrap:wrap; justify-content:flex-end}
  #messageCapture{width:100%}
  .previewing-capture{height:190px}
  .tc-topbar{
    flex-wrap:wrap;
    gap:10px;
    padding:12px;
    border-radius:24px;
  }
  .tc-brand{order:1}
  .tc-topbar-actions{order:2}
  .tc-search{
    order:3;
    width:100%;
    flex:1 1 100%;
    min-width:0;
  }
  .tc-topbar .search{padding:11px 12px}
  .tc-brand-text strong{font-size:15px}
}

/* <= 560 : cartes recettes plus petites */
@media (max-width: 560px){
  :root{--recipe-w:210px;--recipe-h:300px;--cover-h:150px}
  .index-section.card{padding:14px}
  .section-head h2{font-size:16px}
}

/* <= 420 : encore plus compact */
@media (max-width: 420px){
  .previewing-capture{height:170px}
  .form-control{border-radius:14px}
  .custom-file-upload{border-radius:14px}
  :root{--recipe-w:200px;--recipe-h:290px;--cover-h:145px}
  .tc-carousel__btn{width:40px;height:40px}
  .tc-logo{width:38px;height:38px}
  .icon-btn{width:42px;height:42px}
  .tc-topbar .btn.primary{padding:11px 14px}
}
