/**
 * Filters Styles - GroupeLDLC
 * Styles for category filters (type, fiscal year, search)
 */

/* ================================
   DATE BADGE (Articles financiers)
   ================================ */

/* Post avec badge date - layout compact */
#posts-container.classic .post:has(.post-date-badge) {
  padding: 18px 20px !important;
  margin: 10px 0 !important;
  display: flex !important;
  align-items: flex-start;
  gap: 20px;
  min-height: auto !important;
  height: auto !important;
  border: 1px solid #e0e0e0 !important;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#posts-container.classic .post:has(.post-date-badge) .post-info {
  margin-left: 0 !important;
  flex: 1;
}

#posts-container.classic .post:has(.post-date-badge) h2 {
  margin-bottom: 3px !important;
  padding: 0 !important;
}

#posts-container.classic .post:has(.post-date-badge) .post-meta {
  margin: 0 !important;
  margin-top: 2px !important;
}

.post-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 110px;
  min-height: 95px;
  padding: 12px 8px;
  background: #f5f5f5;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
  float: left;
  box-sizing: border-box;
}

.post-date-badge:hover {
  background: #e8e8e8;
  text-decoration: none;
}

.date-badge-day {
  font-size: 32px;
  font-weight: 700;
  color: #1d1d1d;
  line-height: 1;
  margin-bottom: 4px;
}

.date-badge-month {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #1d1d1d;
  padding: 5px 10px;
  border-radius: 4px;
  text-transform: lowercase;
  letter-spacing: 0.3px;
}

.date-badge-fiscal {
  font-size: 10px;
  font-weight: 600;
  color: #1d1d1d;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid #999;
  border-radius: 10px;
  letter-spacing: 0.3px;
}

/* ================================
   INFORMATIONS REGLEMENTEES BADGES
   ================================ */
.info-reg-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px 0;
}

.info-reg-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  background: #e8e8e8;
  color: #1d1d1d;
}

.info-reg-badge.badge-fiscal {
  background: #1d1d1d;
  color: #fff;
}

.info-reg-badge.badge-subcat {
  background: #1d1d1d;
  color: #fff;
}

/* ================================
   PDF ATTACHMENT SECTION
   ================================ */
.pdf-attachment-section {
  border-top: 1px solid #999;
  padding: 12px 0 0 20px;
  margin-top: 12px;
  margin-right: 200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdf-attachment-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  flex: 1;
}

.pdf-attachment-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
}

.pdf-view-btn,
.pdf-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  text-decoration: none;
  transition: color 0.2s ease;
}

.pdf-view-btn:hover,
.pdf-download-btn:hover {
  color: #1d1d1d;
}

.pdf-attachment-name {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1d;
  transition: color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-attachment-size {
  font-size: 12px;
  color: #666;
}

/* ================================
   SINGLE PDF VIEWER
   ================================ */
.single-pdf-viewer {
  margin-bottom: 30px;
}

.single-pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #1d1d1d;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s ease;
  margin-left: 20px;
}

.single-pdf-download:hover {
  background: #333;
  color: #fff;
}

/* Header avec bouton télécharger */
.post-header:has(.single-pdf-download) {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.post-header:has(.single-pdf-download) h1 {
  margin-right: auto;
}

.post-header:has(.single-pdf-download) .post-time {
  order: 3;
  width: 100%;
  margin-top: 5px;
}

.post-header:has(.single-pdf-download) .single-pdf-download {
  margin-left: 0;
}

.single-pdf-iframe {
  display: block;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  min-height: 800px;
}

@media (max-width: 768px) {
  .single-pdf-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .single-pdf-iframe {
    min-height: 500px;
  }
}

/* ================================
   FILTERS CONTAINER
   ================================ */
.info-reg-filters-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 20px 0;
  padding: 0;
}

.info-reg-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  width: 100%;
  align-items: center;
}

.info-reg-filter-row.search-row {
  flex-wrap: nowrap;
  align-items: center;
  padding: 0;
  margin: 0;
  gap: 20px;
  height: 42px;
}

.info-reg-filter-row.search-row > .search-input-wrapper {
  flex: 1;
  padding: 0;
  margin: 0;
  margin-right: 20px;
  height: 100%;
}

.info-reg-filter-row.filters-row {
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

/* ================================
   BASE FILTER STYLES
   ================================ */
.info-reg-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  background: transparent;
  flex: 1;
  align-items: center;
}

.info-reg-filter-title {
  font-size: 13px;
  font-weight: 700;
  color: #1d1d1d;
  white-space: nowrap;
  margin-right: 10px;
}

.info-reg-filter a {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #1d1d1d;
  background: #fff;
  border: 1px solid #1d1d1d;
  border-radius: 0;
  text-decoration: none;
  transition: all 0.15s linear;
  cursor: pointer;
  font-family: inherit;
}

.info-reg-filter a:hover {
  background: #1d1d1d;
  border-color: #1d1d1d;
  color: #b99d61;
  text-decoration: none;
}

.info-reg-filter a.active {
  background: #1d1d1d;
  border-color: #1d1d1d;
  color: #b99d61;
}

/* ================================
   TYPE FILTER
   ================================ */
.type-filter {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.type-filter .info-reg-filter-title {
  flex-shrink: 0;
}

.type-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-reg-filter button.type-btn {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.info-reg-filter button.type-btn.active {
  background: #1d1d1d;
  color: #fff;
}

.info-reg-filter button.type-btn:not(.active) {
  background: #e8e8e8;
  color: #666;
}

.info-reg-filter button.type-btn:not(.active):hover {
  background: #ddd;
  color: #333;
}

.type-btn .btn-remove {
  margin-left: 8px;
  font-weight: 400;
  opacity: 0.7;
}

.type-btn:hover .btn-remove {
  opacity: 1;
}

/* Tous/Aucun buttons */
.type-btn-action {
  display: inline-block;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #999;
  border-radius: 20px;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.type-btn-action:hover {
  background: #1d1d1d;
  color: #fff;
  border-color: #1d1d1d;
}

.type-separator {
  color: #ccc;
  margin: 0 8px;
  font-size: 14px;
}

.clear-filters {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: #666 !important;
  background: transparent !important;
  border: none !important;
  text-decoration: underline !important;
  padding: 0 !important;
}

.clear-filters:hover {
  color: #1d1d1d !important;
  background: transparent !important;
}

/* ================================
   FISCAL YEAR FILTER
   ================================ */
.fiscal-year-filter {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 60px;
}

.fiscal-year-filter .info-reg-filter-title {
  margin-bottom: 0;
  white-space: nowrap;
}

.fiscal-year-filter select {
  width: 140px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #1d1d1d;
  background: #fff;
  border: 1px solid #1d1d1d;
  border-radius: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231d1d1d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.fiscal-year-filter select:hover,
.fiscal-year-filter select:focus {
  background: #1d1d1d;
  color: #b99d61;
  outline: none;
}

/* ================================
   LANGUAGE FILTER - Toggle Slider
   ================================ */
.lang-filter {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.lang-slider-toggle {
  display: inline-flex;
  align-items: center;
  position: relative;
  background: #e8e8e8;
  padding: 4px;
  gap: 0;
  border-radius: 30px;
  width: 150px;
  justify-content: center;
  border: 1px solid #1d1d1d;
}

.lang-slider-toggle .lang-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  z-index: 2;
  border-radius: 25px;
}

.lang-slider-toggle .lang-option img {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.lang-slider-toggle .lang-option:hover:not(.active) {
  color: #333;
}

.lang-slider-toggle .lang-option.active {
  background: #1d1d1d;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Slider caché - animation gérée via classes actives */
.lang-slider-toggle .lang-slider {
  display: none;
}

/* ================================
   SEARCH FILTER
   ================================ */
.info-reg-filter.search-filter {
  flex: 1;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 10px;
  padding: 0 !important;
  background: transparent;
  min-width: 0;
}

.info-reg-filter.search-filter > .info-reg-filter-title {
  flex-shrink: 0;
  width: auto;
  margin: 0 !important;
  padding: 0;
  white-space: nowrap;
}

.info-reg-filter.search-filter > .search-input-wrapper {
  flex: 1;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  display: none;
}

.search-input-wrapper input {
  width: 100%;
  padding: 6px 30px 6px 32px;
  font-size: 13px;
  font-weight: 400;
  color: #1d1d1d;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px 16px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

.search-input-wrapper input:focus {
  outline: none;
  background-color: #fff;
  border-color: #1d1d1d;
}

.search-input-wrapper input::placeholder {
  color: #999;
}

.clear-search {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  color: #999;
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
}

.clear-search:hover {
  color: #1d1d1d;
}

/* ================================
   SUBCATEGORY CHIPS FILTER
   ================================ */
.subcat-row {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 0 5px 0;
  border-top: 1px solid #e8e8e8;
  margin-top: 10px;
}

.subcat-row .info-reg-filter-title {
  flex-shrink: 0;
}

.subcat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.subcat-chip {
  display: inline-block;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  background: #f0f0f0;
  color: #666;
}

.subcat-chip:hover:not(.active) {
  background: #e0e0e0;
  color: #333;
}

.subcat-chip.active {
  background: #1d1d1d;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ================================
   SINGLE TYPE VIEW
   ================================ */
.single-type-view .search-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.single-type-view .search-filter {
  flex: 1;
  display: flex;
  align-items: center;
}

.single-type-view .fiscal-year-filter {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0;
  background: transparent;
}

.single-type-view .fiscal-year-filter .info-reg-filter-title {
  width: auto;
  margin-bottom: 0;
  margin-right: 10px;
  white-space: nowrap;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 768px) {
  .info-reg-filter-row.filters-row {
    flex-wrap: wrap;
  }
  .type-filter {
    flex: 1 1 100%;
  }
  .fiscal-year-filter,
  .lang-filter {
    flex: 1 1 45%;
    min-width: 120px;
  }

  /* Filtres search-row sur 2 lignes */
  .info-reg-filter-row.search-row {
    flex-wrap: wrap;
    height: auto;
    gap: 8px;
    margin-left: 0;
  }

  .info-reg-filter-row.search-row > .search-input-wrapper {
    flex: 1 1 100%;
    order: 1;
    margin-right: 0;
    min-width: 200px;
  }

  .info-reg-filter-row.search-row .fiscal-year-filter {
    flex: 1 1 auto;
    order: 2;
    margin-right: 0;
  }

  .info-reg-filter-row.search-row .lang-filter {
    flex: 0 0 auto;
    order: 3;
  }

  /* Subcat chips */
  .subcat-row {
    flex-wrap: wrap;
    margin-left: 0;
  }

  .subcat-chips {
    width: 100%;
  }

  .subcat-chip {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .info-reg-badges {
    margin: 6px 0 10px 0;
  }
  .info-reg-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  .info-reg-filter {
    padding: 10px;
  }
  .info-reg-filter a,
  .type-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Filtres encore plus compacts sur mobile */
  .info-reg-filter-row.search-row {
    gap: 10px;
    margin-left: 0;
  }

  .info-reg-filter-row.search-row > .search-input-wrapper {
    min-width: 200px;
  }

  .info-reg-filter-row.search-row .fiscal-year-filter,
  .info-reg-filter-row.search-row .lang-filter {
    flex: 1 1 auto;
  }

  .fiscal-year-filter {
    margin-right: 0 !important;
  }

  .fiscal-year-filter select {
    width: 100%;
  }

  .lang-slider-toggle {
    width: 100%;
    justify-content: center;
  }
}

/* Responsive articles avec date badge */
@media (max-width: 768px) {
  #posts-container.classic .post:has(.post-date-badge) {
    flex-direction: column;
    padding: 15px !important;
    gap: 12px;
  }
  
  #posts-container.classic .post:has(.post-date-badge) .post-date-badge {
    width: 100%;
    flex-direction: row;
    min-height: auto;
    padding: 10px 15px;
    gap: 15px;
    justify-content: flex-start;
  }
  
  #posts-container.classic .post:has(.post-date-badge) .post-info {
    width: 100%;
  }
  
  #posts-container.classic .post:has(.post-date-badge) h2 {
    font-size: 16px !important;
    line-height: 1.3 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  .pdf-attachment-section {
    margin-right: 0 !important;
    padding-left: 0 !important;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
}

/* Alignement langue à droite */
@media (max-width: 768px) {
  .info-reg-filter-row.search-row {
    justify-content: space-between;
  }
  
  .info-reg-filter-row.search-row .lang-filter {
    margin-left: auto;
  }
}

/* Marge droite pour aligner avec les articles */
@media (max-width: 768px) {
  .info-reg-filters-container {
    padding-right: 10px;
  }
  
  .info-reg-filter-row.search-row {
    margin-right: 10px;
  }
}

/* Aligner filtres avec les articles (40px de chaque côté) */
@media (max-width: 768px) {
  .info-reg-filters-container {
    padding-left: 40px !important;
    padding-right: 40px !important;
  }
  
  .info-reg-filter-row.search-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Fix superposition à 600px - exercice et langue sur lignes séparées */
@media (max-width: 600px) {
  .info-reg-filter-row.search-row .fiscal-year-filter,
  .info-reg-filter-row.search-row .lang-filter {
    flex: 1 1 100% !important;
  }
  
  .lang-slider-toggle {
    width: auto !important;
  }
}

/* Réduire espacement vertical entre filtres en responsive */
@media (max-width: 768px) {
  .info-reg-filter-row.search-row {
    gap: 5px !important;
  }
}

@media (max-width: 600px) {
  .info-reg-filter-row.search-row {
    gap: 4px !important;
  }
}

/* Gap 10px entre filtres en responsive */
@media (max-width: 768px) {
  .info-reg-filter-row.search-row {
    gap: 10px !important;
  }
}

/* Marge gauche fil d'ariane en responsive */
@media (max-width: 768px) {
  ul#fil_arianne {
    padding-left: 10px !important;
  }
}

/* Fix espace gris en bas de la page home en responsive */
@media (max-width: 768px) {
  body.home #footer {
    background: transparent;
  }
  
  body.home {
    min-height: auto;
  }
}
