/* Customisation Infovitrail sur base HeroBiz */

/*
 * NOTE: On conserve les couleurs par défaut de HeroBiz
 * --accent-color: #0ea2bd (bleu turquoise)
 * --heading-color: #485664 (gris bleu)
 * --nav-hover-color: #0ea2bd
 *
 * Ce fichier ajoute uniquement les éléments spécifiques à Infovitrail
 * sans écraser le design HeroBiz existant
 */

/* Logo Infovitrail */
.header .logo .sitename {
  font-size: 32px;
  font-weight: 300;
  margin: 0;
  color: var(--heading-color);
  font-family: 'Source Sans Pro', serif;
  letter-spacing: 1px;
}

.header .logo .dot-blue {
  color: var(--accent-color);
  font-weight: 400;
  font-size: 34px;
  margin-left: 2px;
}

.header .logo .dot-pink {
  color: #e6194b;
  font-weight: 400;
  font-size: 34px;
  margin-left: 0;
}

.header .logo .dot-green {
  color: #3cb44b;
  font-weight: 400;
  font-size: 34px;
  margin-left: 0;
}

/* Language selector in header */
.language-selector {
  display: flex;
  gap: 10px;
  margin-left: 20px;
}

.language-selector a {
  color: var(--nav-color);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.3s;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.language-selector a:hover,
.language-selector a.active {
  background: var(--accent-color);
  color: var(--contrast-color);
}

/* ── Header Search Bar ──────────────────────────────────── */

.header-search-form {
  flex: 0 1 360px;
  min-width: 240px;
}

@media (min-width: 1400px) {
  .header-search-form {
    flex: 0 1 420px;
    min-width: 280px;
  }
}

.search-bar-wrapper {
  width: 100%;
}

.search-bar-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.9rem;
  z-index: 2;
  pointer-events: none;
  transition: color 0.2s;
}

.search-bar-wrapper input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  border: 2px solid rgba(0,0,0,0.08);
  border-radius: 24px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.95);
  color: #333;
  outline: none;
  transition: all 0.25s ease;
}

.search-bar-wrapper input:focus {
  border-color: var(--accent-color);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb, 14,162,189), 0.15);
}

.search-bar-wrapper input::placeholder {
  color: #aaa;
  font-size: 0.85rem;
}

.search-spinner {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

.htmx-request .search-spinner {
  display: block;
}

.htmx-request ~ .search-icon {
  display: none;
}

/* Suggestions dropdown */
.search-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 420px;
  max-width: 90vw;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  max-height: 420px;
  overflow-y: auto;
  z-index: 1060;
  border: 1px solid rgba(0,0,0,0.08);
}

.search-suggestions-dropdown:empty {
  display: none;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
  cursor: pointer;
}

.search-suggestion-item:hover,
.search-suggestion-item:focus {
  background: #f5f9fc;
}

.search-suggestion-item .suggestion-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: #222;
  line-height: 1.35;
}

.search-suggestion-item .suggestion-title mark {
  background: #fff3cd;
  padding: 0 2px;
}

.suggestion-silo-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 8px;
  background: var(--accent-color);
  color: #fff;
  border-radius: 10px;
  text-transform: capitalize;
  flex-shrink: 0;
}

.search-suggestion-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  text-decoration: none;
  transition: background 0.15s;
}

.search-suggestion-all:hover {
  background: #f0f8fa;
  color: var(--accent-color);
}

/* Responsive */
@media (max-width: 1199.98px) {
  .header-search-container {
    order: 2;
    flex: 1;
    min-width: 0;
  }

  .header-search-form {
    flex: 1 1 100%;
    min-width: 0;
    margin: 0;
  }

  .search-bar-wrapper input {
    font-size: 1rem;
    padding: 10px 16px 10px 42px;
  }
}

/* Univers filter sidebar - Style amélioré */
.univers-filter {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.univers-filter h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--heading-color);
}

.univers-filter ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.univers-filter ul li {
  margin-bottom: 10px;
}

.univers-filter ul li a {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  color: var(--default-color);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.3s;
}

.univers-filter ul li a:hover,
.univers-filter ul li a.active {
  background: var(--accent-color);
  color: var(--contrast-color);
}

.univers-filter ul li a span {
  background: rgba(0,0,0,0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.univers-filter ul li a:hover span,
.univers-filter ul li a.active span {
  background: rgba(255,255,255,0.2);
}

/* Prev/Next navigation */
.prev-next-nav {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.prev-next-nav a {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  text-decoration: none;
  color: var(--default-color);
  transition: all 0.3s;
}

.prev-next-nav a.nav-prev {
  justify-content: flex-start;
}

.prev-next-nav a.nav-next {
  justify-content: flex-end;
}

.prev-next-nav a:hover {
  background: var(--accent-color);
  color: var(--contrast-color);
}

.prev-next-nav a.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.prev-next-nav a small {
  display: block;
  font-size: 0.8rem;
  opacity: 0.7;
}

.prev-next-nav a strong {
  display: block;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .language-selector {
    margin-left: 10px;
  }
}

/***/

/* Keep dropdown visible when parent is active - mobile only */
@media (max-width: 1199px) {
  #navmenu .dropdown.active > ul {
    visibility: visible !important;
    opacity: 1 !important;
    top: 100% !important;
  }
}

/* Archives sidebar - style badges années */
.categories-widget .archive-year-item a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px !important;
  background: #f8f9fa !important;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  text-decoration: none;
  color: var(--default-color) !important;
  transition: all 0.3s;
  margin-bottom: 8px;
}

.categories-widget .archive-year-item a:hover,
.categories-widget .archive-year-item a.active {
  background: var(--accent-color) !important;
  color: var(--contrast-color) !important;
  border-color: var(--accent-color);
  transform: translateX(5px);
}

.categories-widget .archive-year-item a span {
  background: rgba(0,0,0,0.06);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--default-color);
}

.categories-widget .archive-year-item a:hover span,
.categories-widget .archive-year-item a.active span {
  background: rgba(255,255,255,0.25);
  color: var(--contrast-color);
}

/* Sticky header enhancement */
.header.sticked {
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Annuaire results frame */
.annuaire-results-frame {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Catégories sidebar - lien actif */
.categories-widget ul a.active {
  background: var(--accent-color) !important;
  color: var(--contrast-color) !important;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

/* Asset images border */
.card-img img,
.post-img img,
.figure-img {
  padding: 7px;
  background-color: #ddd;
  border: 1px solid #ddd;
}

/* Fix detail page hero image overlapping the h1/title */
.blog-details .post-img {
  margin: 0 0 1.5rem 0;
  overflow: hidden;
}

/* Header social links — bulles identiques desktop et mobile */
.header-social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin: 0 4px;
  font-size: 16px;
  color: var(--nav-color);
  background: color-mix(in srgb, var(--accent-color), transparent 90%);
  transition: 0.3s;
}

.header-social-links a:hover {
  background: var(--accent-color);
  color: var(--contrast-color);
}

/* ── Mobile Sidebar Bottom Sheet ──────────────────────── */
@media (max-width: 991.98px) {

  .sidebar {
    display: none !important;
  }

  .mobile-sidebar-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: #fff;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    padding: 10px 16px;
    display: flex;
    justify-content: center;
  }

  .mobile-sidebar-bar .mobile-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
  }

  .mobile-sidebar-bar .mobile-sidebar-toggle:hover {
    background: color-mix(in srgb, var(--accent-color), black 15%);
  }

  .mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
  }

  .mobile-sidebar-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1051;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .mobile-sidebar-sheet.open {
    transform: translateY(0);
  }

  .mobile-sidebar-sheet .sheet-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px 16px;
  }

  .mobile-sidebar-sheet .sheet-drag-handle {
    width: 40px;
    height: 4px;
    background: #d0d5dd;
    border-radius: 2px;
    margin: 0 auto 8px auto;
  }

  .mobile-sidebar-sheet .sheet-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--heading-color);
    margin: 0;
  }

  .mobile-sidebar-sheet .sheet-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
  }

  .mobile-sidebar-sheet .sheet-close:hover {
    color: #212529;
  }

  .mobile-sidebar-sheet .sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 24px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-sidebar-sheet .sheet-body .widgets-container {
    box-shadow: none;
    margin: 0;
    padding: 0;
    background: transparent;
  }

  .mobile-sidebar-sheet .sheet-body .widget-item {
    margin-bottom: 24px;
  }

  .mobile-sidebar-sheet .sheet-body .btn {
    width: 100%;
  }

  body.mobile-sidebar-open {
    overflow: hidden;
  }
}

/* --- Mobile social links full width --- */
@media (max-width: 1199px) {
  .mobile-social-links {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .mobile-social-links > div {
    display: flex !important;
    justify-content: space-evenly;
    width: 100%;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .mobile-social-links > div a {
    align-self: center;
  }
}

/* Annule la rotation 180deg + le flex HeroBiz sur les icônes sociales */
#navmenu .mobile-social-links i {
  transform: none !important;
  display: inline !important;
  width: auto !important;
  height: auto !important;
  background-color: transparent !important;
  border-radius: 0 !important;
  line-height: 1;
}

/* --- Mobile nav dropdown overrides (HeroBiz) --- */

@media (max-width: 1199px) {
  .navmenu .dropdown ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-in-out, padding 0.35s ease-in-out, margin 0.35s ease-in-out, opacity 0.35s ease-in-out;
    padding: 0 0 !important;
    margin: 0 20px !important;
    display: block !important;
    opacity: 0;
  }

  .navmenu .dropdown ul.dropdown-active {
    max-height: 500px;
    padding: 10px 0 !important;
    margin: 10px 20px !important;
    opacity: 1;
  }

  /* Ne pas fermer le menu entier quand on clique un dropdown */
  .mobile-nav-active .navmenu #navmenu a {
    pointer-events: auto;
  }
}

/* ── Homepage Sidebar Widgets ─────────────────────────── */

.homepage-widget {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.homepage-widget .widget-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.homepage-widget .widget-title i {
  color: var(--accent-color);
  font-size: 1.1rem;
}

.homepage-widget-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}

.homepage-widget-list li {
  border-bottom: 1px solid #f0f0f0;
}

.homepage-widget-list li:last-child {
  border-bottom: none;
}

.homepage-widget-list li a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--default-color);
  transition: background 0.2s;
}

.homepage-widget-list li a:hover {
  background: #f5f9fc;
}

.homepage-widget-list .hw-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--heading-color);
  line-height: 1.35;
}

.homepage-widget-list .hw-date {
  font-size: 0.78rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}

.homepage-widget-list .hw-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hw-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 8px;
  background: var(--accent-color);
  color: #fff;
  border-radius: 10px;
  font-weight: 500;
}

.hw-see-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  text-decoration: none;
  transition: gap 0.2s;
}

.hw-see-all:hover {
  gap: 10px;
  color: color-mix(in srgb, var(--accent-color), black 20%);
}

.hw-quick-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hw-quick-list li {
  margin-bottom: 10px;
}

.hw-quick-list li:last-child {
  margin-bottom: 0;
}

.hw-quick-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  background: #f8f9fa;
  color: #485664;
  border: 1px solid #e9ecef;
  transition: all 0.3s;
}

.hw-quick-list a:hover {
  background: #0ea2bd;
  color: #fff;
  border-color: #0ea2bd;
}

.hw-quick-list a span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.hw-quick-list a i {
  color: var(--accent-color);
  font-size: 1rem;
}

.hw-quick-list a:hover i {
  color: #fff;
}

.hw-quick-count {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.08);
  color: #485664;
}

.hw-quick-list a:hover .hw-quick-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Badge de compteur dans le titre du widget */
.hw-title-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-color), transparent 85%);
  color: var(--accent-color);
}

.hw-empty {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
  padding: 8px 0;
  margin: 0 0 12px 0;
}

/* ── Titres de page H1 unifiés ───────────────────── */
.page-h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--heading-color);
  margin: 0 0 20px;
}

@media (max-width: 768px) {
  .page-h1 {
    font-size: 24px;
  }
}
