/* ================= VARIABLES ================= */
:root {
  --primary: #0d6efd;
  --dark: #111827;
  --muted: #64748b;
  --bg: #f7f7f7;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --shadow: rgba(0,0,0,0.08);
  --transition: 0.3s ease;
}

/* ================= RESET GLOBAL ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
  background: var(--bg);
  overflow-x: hidden;
  color: #333;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* empêche horizontal scroll */
    overflow-y: auto;   /* scroll vertical global */
}



a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ================= HEADER ================= */
header {
  max-width: 1300px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 2000;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.header-inner {
  max-width: 1300px;
  margin: auto;
  padding: 15px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--dark);
}
.logo img { width:42px; height:42px; border-radius:10px; }

/* ================= NAV DESKTOP ================= */
.nav-links {
  display: flex;
  gap: 18px;
}
.nav-links a {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--primary); }

/* ================= HAMBURGER ================= */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  width: 26px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  transition: all var(--transition);
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* ================= MOBILE MENU ================= */
#mobile-menu {
  position: fixed;
  top: 60px;
  right: -100%;
  width: 250px;
  height: calc(100% - 60px);
  background: #fff;
  box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  z-index: 3000;
  transition: right var(--transition);
  padding: 20px;
}
#mobile-menu.open { right: 0; }
#mobile-menu .mobile-nav { display: flex; flex-direction: column; gap: 20px; }
#mobile-menu .mobile-nav a {
  font-size: 16px;
  color: var(--dark);
  font-weight: 600;
  transition: color var(--transition);
}
#mobile-menu .mobile-nav a:hover { color: var(--primary); }

#mobile-menu-overlay {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  height: calc(100% - 60px);
  background: rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 2990;
  transition: opacity var(--transition);
}
#mobile-menu-overlay.active { opacity: 1; pointer-events: all; }

/* ================= FILTERS ================= */
.filters {
  display:flex;
  flex-wrap: wrap;
  gap:15px;
  margin:20px 0;
  background: #fff;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  align-items: center;
  position: relative;
  z-index: 3;
}
.filters input, .filters select {
  padding:8px 12px;
  border-radius:6px;
  border:1px solid #ccc;
  flex:1;
  min-width:150px;
  font-size:14px;
}
.filters button, .filters .btn-filter {
  padding: 8px 16px;
  border-radius: 6px;
  border:none;
  background: var(--primary);
  color:#fff;
  cursor:pointer;
  font-weight:500;
  transition: 0.2s;
}
.filters button:hover, .filters .btn-filter:hover { background:#0956c5; transform: translateY(-2px); }
.filters .btn-filter:active { transform: scale(0.97); }
.filters select:disabled { background:#f1f5f9; cursor:not-allowed; opacity:0.7; }

/* ================= SEARCH BAR ================= */
.search-bar { position: relative; flex: 2; }
.search-bar input {
  width: 80%;
  padding: 12px 45px 12px 15px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  background: #f9fafb;
  transition: 0.2s ease;
}
.search-bar input:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(13,110,253,0.1);
}
.search-bar button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--primary);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s ease;
}
.search-bar button:hover {
  background: #0b5ed7;
  transform: translateY(-50%) scale(1.05);
}

/* ================= LAYOUT DESKTOP / TABLETTE ================= */

.layout {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 20px;
  max-width: 1300px;
  
  margin: 0 auto;
  padding: 0 15px;
  box-sizing: border-box;
}

/* Sidebar fixes */
.sidebar-left, .sidebar-right {
   /* permet au feed de rétrécir correctement */
  position: sticky;
  top: 80px;
  height: fit-content;
}

/* Feed central */
.feed {
  
}

/* Urgentes scroll si beaucoup */
#urgentBox {
 
  overflow-y: auto;
}


/* ================= SIDEBARS ================= */
.sidebar-left,
.sidebar-right {
  position: sticky;
  top: 80px;
  height: fit-content;
  transition: all var(--transition);
}

/* Sidebar gauche */
.sidebar-left {
  background: #fff;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  z-index: 2;
}

/* Sidebar droite */
.sidebar-right {
  background: #fff;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  z-index: 1;
  min-width: 0;
}

/* ================= FEED ================= */
.feed { min-width: 0; }
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ================= CARDS ================= */
.card {
  background:#fff;
  padding:15px 20px;
  border-radius:12px;
  box-shadow:0 4px 12px var(--shadow);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  transition: transform var(--transition), box-shadow var(--transition), opacity 0.6s ease;
  opacity: 0;
  transform: translateY(20px);
}
.card.show { opacity: 1; transform: translateY(0); }
.card:hover { 
  transform: translateY(-5px); 
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.card h3, .card h4 { margin:0 0 10px 0; color: var(--primary); }
.card p { margin:5px 0; font-size:14px; color:#555; }
.card .badges { display:flex; gap:8px; margin-top:10px; }
.badge { padding:2px 6px; border-radius:4px; font-size:12px; font-weight:600; color:#fff; }
.badge.urgent { background: var(--danger); }
.badge.boost { background: var(--warning); color:#000; }
.badge.verified { background: var(--primary); }
.card button {
  margin-top:15px;
  padding:6px 12px;
  border:none;
  border-radius:6px;
  background: var(--success);
  color:#fff;
  cursor:pointer;
  font-weight:500;
  transition:0.2s;
}
.card button:hover { background:#145c3c; }
.small-card { padding: 10px 15px; font-size: 13px; }

/* ================= NO RESULTS ================= */
.no-results {
  text-align:center;
  font-size:16px;
  color:#777;
  margin-top:50px;
  display:none;
}

/* ================= PAGINATION ================= */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
  gap: 8px;
  flex-wrap: wrap;
}
.page-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}
.page-btn:hover { background: var(--primary); color:#fff; }
.page-btn.active { background: var(--primary); color:#fff; font-weight:bold; }
.page-btn.disabled { opacity:0.5; cursor:not-allowed; }

/* ================= FOOTER ================= */
footer {
  max-width: 1300px;
  width: 100%;
  margin-top:60px;
  background: var(--dark);
  color:white;
  padding:50px 20px;
  line-height:1.6;
}
footer .f-container {
  max-width:1200px;
  margin:auto;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:30px;
}
footer .f-container div p { color:#cbd5e1; margin-top:8px; font-size:14px; }
footer a { color:#cbd5e1; text-decoration:none; font-size:14px; transition:var(--transition); }
footer a:hover { color: var(--primary); text-decoration:underline; }
footer small { display:block; margin-top:25px; opacity:0.7; font-size:12px; text-align:center; }

/* ================= TABLETTE / PETIT DESKTOP ================= */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 220px 1fr 250px; /* left / feed / right */
    gap: 2%;
  }

  .hamburger { display: flex; }

  /* Sidebar gauche reste fixe */
  .sidebar-left {
    display: block;
    position: sticky;
    top: 80px;
    /* pas de scroll */
    max-height: none;
    overflow: visible;
  }

 /* Sidebar droite annonces urgentes */
.sidebar-right {
  display: block;
  position: sticky;
  top: 80px;

  max-height: calc((190px * 3) + (18px * 2)); /* 3 cartes visibles + gaps */
  overflow-y: auto; /* scroll vertical indépendant */
}
 /* Feed central */
  .feed {
    width: 100%;
    max-height: calc((290px + 18px) * 2); /* 2 lignes visibles de cartes */
    overflow-y: auto; /* scroll vertical si plus de 6 cartes */
  }

  /* Grille des cartes */
  .cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 3 cartes par ligne */
    gap: 10px;
  }

}
/* ================= MOBILE / TABLETTE PETITE ================= */
@media (max-width: 900px) {
  .layout {
      display: block; 
    grid-template-columns: 1fr;
    column-gap: 0;
    margin: 0 auto;
    padding: 0 10px; /* padding plus petit */
    max-width: 100%; /* ne jamais dépasser la largeur écran */
    box-sizing: border-box;
    overflow-x: hidden; /* supprime le scroll horizontal */
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px; /* réduit le gap pour mobile */
  }
  
  .feed {
    width: 100%;
    min-height: 300px; /* force un espace minimal */
    max-height: calc(100vh - 120px); /* prend le reste de l'écran */
    overflow-y: auto;  /* scroll interne si beaucoup de cartes */
  }

  .filters {
    width: 100%;
    padding: 10px 0;
  }
  .sidebar-left,
  .sidebar-right {
    position: static; /* sticky désactivé */
    top: auto;
    height :80%
    max-height: 100px; /* ou auto selon besoin */
    overflow-y: auto;
  }
}

/* ================= PETIT MOBILE ================= */
@media (max-width: 600px) {
      body {
    overflow-x: hidden; /* empêche horizontal scroll */
    overflow-y: auto;   /* scroll vertical global */
  }
  .cards {
    grid-template-columns: repeat(1, 1fr); /* 1 carte par ligne */
    gap: 15px;
  }

  .search-bar {
    width: 100%; /* prend tout l'espace du container */
  }

  .filters {
    flex-direction: row;
  }
  .sidebar-right { display: none; }
      
  }
}


/* ================= ANIMATION JS (show cards) ================= */
.card.animate { opacity: 0; transform: translateY(20px); transition: transform 0.5s, opacity 0.5s; }
.card.animate.show { opacity: 1; transform: translateY(0); }
