/* modern-v2.css - Design SaaS Premium "WOW Effect", UX/SEO Optimisé */
:root {
  --primary: #3b82f6; /* Bleu vibrant */
  --primary-hover: #2563eb;
  --bg-color: #f8fafc; /* Gris très clair pour le fond de page */
  --card-bg: #ffffff;
  --sidebar-bg: #0f172a; /* Fond sombre premium (Bleu nuit profond) */
  --sidebar-text: #cbd5e1;
  --sidebar-text-hover: #38bdf8;
  --text-main: #334155;
  --text-muted: #64748b;
  --sidebar-width: 320px;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.7;
  font-size: 1.05rem;
}

/* Global Layout Grid : Sidebar à gauche ! */
#wrapper {
  display: flex;
  flex-direction: row-reverse; /* Met le sidebar (qui est 2ème dans le HTML) à GAUCHE */
  min-height: 100vh;
}

/* Sidebar Fixed Left (Thème Sombre Premium) */
#sidebar {
  width: var(--sidebar-width);
  background-color: #0f172a !important;
  background: #0f172a !important;
  border-right: 1px solid rgba(255,255,255,0.08);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: 2px 0 15px rgba(0,0,0,0.15);
  z-index: 10;
}

/* Scrollbar discrète pour la sidebar */
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

#sidebar .inner {
  padding-bottom: 2rem;
}

.site-branding {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}
.site-branding img { max-width: 210px; max-height: 80px; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05)); }
.site-branding p { font-size: 0.85rem; color: #64748b; margin-top: 1rem; }
.mini-posts article .image { max-height: 140px; overflow: hidden; border-radius: 8px; }
.mini-posts article .image img { width: 100%; height: 140px; object-fit: cover; object-position: center 20%; }

/* Main Content Right */
#main {
  flex-grow: 1;
  padding: 3rem 4rem;
  width: 100%;
  max-width: none;
  background: #ffffff;
}

/* Typography & Reset */
h1, h2, h3, h4 {
  color: #0f172a;
  font-weight: 800;
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.8rem; margin-top: 0; background: linear-gradient(135deg, #0f172a, #3b82f6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
h2 { font-size: 1.8rem; border-bottom: 2px solid #e2e8f0; padding-bottom: 0.5em; }
p, ul, ol { margin-bottom: 1.5rem; max-width: 850px; }

a { color: var(--primary); text-decoration: none; transition: all 0.2s; }
a:hover { color: var(--primary-hover); }

/* Buttons avec Micro-animations */
.button {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  padding: 0.8em 1.8em;
  border-radius: 50px; /* Pill shape ultra moderne */
  font-weight: 700;
  text-align: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}
.button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.6);
  color: white;
}

/* Cards (Articles/Posts) avec effet Glass/Hover */
.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2.5rem;
  margin-top: 3rem;
}

article {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.5);
  position: relative;
  overflow: hidden;
}
article::after { /* Effet brillance au hover */
  content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg); transition: all 0.7s;
}
article:hover { transform: translateY(-8px); box-shadow: 0 20px 40px -10px rgba(0,0,0,0.1); }
article:hover::after { left: 200%; }

article .image { display: block; margin-bottom: 1.5rem; border-radius: 8px; overflow: hidden; }
article .image img { width: 100%; height: 200px; object-fit: cover; transition: transform 0.5s ease; }
article:hover .image img { transform: scale(1.08); }

article h3 { margin-top: 0; font-size: 1.4rem; line-height: 1.4; }
article h3 a { color: #0f172a; }
article h3 a:hover { color: var(--primary); }
article p { flex-grow: 1; color: var(--text-muted); font-size: 0.95rem; }

/* Sidebar Menu Redesign (Thème Sombre Premium) */
#menu header { padding: 0 1.5rem; margin-bottom: 1rem; }
#menu header h2 { font-size: 0.85rem; text-transform: uppercase; color: #38bdf8; border: none; padding: 0; letter-spacing: 1.5px; font-weight: 700; }

#menu ul { list-style: none; padding: 0; margin: 0; text-transform: none !important; }
#menu > ul > li { margin-bottom: 0.25rem; }

#menu a, #menu span, #menu .opener {
  text-transform: none !important;
  letter-spacing: normal !important;
}

#menu > ul > li > .opener,
#menu > ul > li > a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-radius: 8px;
  margin: 0.25rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: none !important;
  line-height: 1.35;
  text-transform: none !important;
}
#menu > ul > li > .opener:hover,
#menu > ul > li > a:hover {
  background: rgba(255,255,255,0.08);
  color: #38bdf8 !important;
  -webkit-text-fill-color: #38bdf8 !important;
  transform: translateX(3px);
}

/* Les sous-menus */
#menu ul ul {
  padding-left: 0.75rem;
  margin-top: 0.25rem;
  margin-bottom: 1.25rem;
  border-left: 2px solid rgba(56, 189, 248, 0.3);
  margin-left: 1rem;
}
#menu ul ul a,
#menu ul ul span {
  display: block;
  padding: 0.35rem 0.75rem;
  color: #e2e8f0 !important;
  -webkit-text-fill-color: #e2e8f0 !important;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.35;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.2s;
  text-transform: none !important;
}
#menu ul ul a:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8 !important;
  -webkit-text-fill-color: #38bdf8 !important;
}

/* Monetization / Ads (Anti-CLS, discret mais cliquable) */
.ad-container {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  min-height: 250px; 
  display: block;
  text-align: center;
  padding: 10px;
  margin: 2.5rem 0;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
  width: 100%;
}
.ad-container.ad-incontent {
  min-height: 100px;
  height: auto;
}
.ad-container::before {
  content: 'PUBLICIT\00C9';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #f8fafc;
  padding: 2px 15px;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

/* Sticky Boutique Sidebar (Glow effect) */
.sidebar-sticky-boutique {
  margin: 2rem 1rem;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.sidebar-sticky-boutique::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 60%);
}
.sidebar-sticky-boutique h3 { color: #fff; margin: 0 0 0.5rem 0; font-size: 1.2rem; position: relative; }
.sidebar-sticky-boutique p { font-size: 0.9rem; color: #cbd5e1; margin-bottom: 1.2rem; position: relative; }
.sidebar-sticky-boutique a {
  display: inline-block; background: var(--primary); color: white; padding: 0.75rem 1.5rem;
  border-radius: 50px; font-weight: bold; transition: all 0.3s; position: relative;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.sidebar-sticky-boutique a:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6); }

#sidebar > .toggle {
  display: none;
}

/* Responsive */
@media (max-width: 480px) {
  html, body { min-width: 0; }
}

@media (max-width: 1024px) {
  #wrapper { flex-direction: column; } 
  #main { padding: 1.5rem; padding-top: 4rem; position: relative; }
  .posts { grid-template-columns: 1fr; }

  #sidebar {
    --mobile-sidebar-width: min(275px, calc(100% - 48px));
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(0px - var(--mobile-sidebar-width));
    margin-left: 0 !important;
    width: var(--mobile-sidebar-width);
    z-index: 10000;
    background: var(--sidebar-bg);
    transition: left 0.5s ease;
    overflow: visible !important;
  }
  
  #sidebar > .inner {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* When main.js removes .inactive class or adds active */
  #sidebar:not(.inactive) {
    left: 0;
  }

  /* Hamburger Toggle from main.js */
  #sidebar > .toggle {
    display: block;
    position: absolute;
    top: 0;
    left: 100%;
    z-index: 10001;
    width: 48px;
    height: 48px;
    text-indent: -9999px;
    border: none;
    background: #0f172a;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
  }
  #sidebar > .toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 -6px #fff, 0 6px #fff;
  }
  #sidebar > .toggle::after {
    content: none;
  }
  #sidebar > .toggle:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: -3px;
  }
}


/* =========================================================
   Passerelles de Rebond UX et Navigation Intra-site (Vignettes AdSense)
   ========================================================= */
.udf-rebound-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 2.5rem 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}
.udf-rebound-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
}
.udf-rebound-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 700;
}
.udf-rebound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.udf-rebound-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
}
.udf-rebound-card:hover {
    background: #ffffff;
    border-color: #0284c7;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.12);
}
.udf-rebound-card strong {
    color: #0f172a;
    font-size: 1.02rem;
    display: block;
    margin-bottom: 6px;
}
.udf-rebound-card p {
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0 0 14px 0;
    flex-grow: 1;
}
.udf-rebound-card .rebound-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0284c7;
    margin-top: auto;
}
.udf-rebound-card:hover .rebound-action {
    color: #0369a1;
}
