/**
 * 月份篩選器模組樣式
 * 符合 WCAG 2.1 Level AA 無障礙標準
 *
 * @package     Joomla.Site
 * @subpackage  mod_articles_monthfilter
 */

/* ============================================
   容器
   ============================================ */
.mod-articles-monthfilter {
    margin-bottom: 1.5rem;
}

/* ============================================
   列表
   ============================================ */
.monthfilter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================
   列表項目
   ============================================ */
.monthfilter-item {
    margin: 0;
    border-bottom: 1px solid var(--cassiopeia-color-border, #dee2e6);
}

.monthfilter-item:last-child {
    border-bottom: none;
}

/* ============================================
   連結
   ============================================ */
.monthfilter-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    min-height: 44px; /* WCAG 觸控目標最小尺寸 */
    background: transparent;
    color: var(--cassiopeia-color-primary, #132f53);
    text-decoration: none;
    font-size: calc(0.9375rem * var(--font-size-scale, 1));
    transition: background-color 0.2s ease, color 0.2s ease;
}

.monthfilter-link:hover {
    background: var(--cassiopeia-color-primary, #132f53);
    color: #ffffff;
    text-decoration: none;
}

.monthfilter-link:focus {
    outline: 2px dotted var(--focus-color);
    background: var(--cassiopeia-color-hover, #f8f9fa);
}

/* ============================================
   選中狀態
   ============================================ */
.monthfilter-item.active .monthfilter-link {
    background: var(--cassiopeia-color-primary, #132f53);
    color: #ffffff;
    font-weight: 600;
}

.monthfilter-item.active .monthfilter-link:hover {
    background: var(--cassiopeia-color-primary, #132f53);
    color: #ffffff;
}

.monthfilter-item.active .monthfilter-link:focus {
    outline-color: #ffffff;
}

/* ============================================
   「全部」選項
   ============================================ */
.monthfilter-item--all {
    border-bottom: 2px solid var(--cassiopeia-color-border, #dee2e6);
    margin-bottom: 0.25rem;
}

.monthfilter-item--all .monthfilter-link {
    font-weight: 500;
}

/* ============================================
   文字與數量
   ============================================ */
.monthfilter-text {
    flex: 1;
}

.monthfilter-count {
    font-size: 0.85em;
    opacity: 0.7;
    white-space: nowrap;
}

.monthfilter-item.active .monthfilter-count {
    opacity: 0.9;
}

/* ============================================
   扁平化樣式 — 全斷點共用
   ============================================ */

/* --- 1. 去除 card 外殼 --- */
.sidebar-left.card {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  --card-border-width: 0;
  --card-border-color: transparent;
  --card-bg: transparent;
  --card-border-radius: 0;
  display: flex;
  flex-direction: column;
}

/* --- 2. 標題 --- */
.sidebar-left .card-header {
  background: transparent;
  border-bottom: none;
  padding: 0;
  margin: 0;
  font-size: var(--htsprout-fs-20);
  font-weight: var(--htsprout-fw-medium);
  line-height: var(--htsprout-lh-150);
  color: var(--htsprout-text-1000);
  --card-cap-bg: transparent;
}

/* --- 3. card-body --- */
.sidebar-left .card-body {
  padding: 0;
  min-width: 0;
}

/* --- 4. 列表項目：去除分隔線 --- */
.monthfilter-item {
  border-bottom: none;
}

.monthfilter-item--all {
  border-bottom: none;
  margin-bottom: 0;
}

/* --- 5. 連結 typography --- */
.monthfilter-link {
  min-height: 24px;
  font-size: var(--htsprout-fs-18);
  font-weight: var(--htsprout-fw-regular);
  line-height: var(--htsprout-lh-130);
  color: var(--htsprout-text-800);
  background: transparent;
  justify-content: center;
  padding: 12px 0;
}

.monthfilter-link:hover {
  background: transparent;
  color: var(--htsprout-green-500);
}

/* --- 6. 選中狀態 --- */
.monthfilter-item.active .monthfilter-link {
  background: transparent;
  color: var(--htsprout-green-500);
  font-weight: var(--htsprout-fw-medium);
}

.monthfilter-item.active .monthfilter-link:hover {
  background: transparent;
  color: var(--htsprout-green-500);
}

/* --- 7. 焦點狀態 --- */
.monthfilter-link:focus {
  background: transparent;
  outline: 2px dotted var(--focus-color);
}

.monthfilter-item.active .monthfilter-link:focus {
  outline-color: var(--focus-color);
}

/* --- 8. 「全部」選項 --- */
.monthfilter-item--all .monthfilter-link {
  font-weight: var(--htsprout-fw-regular);
}

.monthfilter-item--all.active .monthfilter-link {
  font-weight: var(--htsprout-fw-medium);
}

/* --- 9. 數量標記 --- */
.monthfilter-count {
  display: none;
}

/* --- 10. 容器外距 --- */
.mod-articles-monthfilter {
  margin-bottom: 0;
  min-width: 0;
}

/* ============================================
   響應式：平板版（768px–991px）— 垂直列表
   ============================================ */
@media (min-width: 768px) and (max-width: 991.98px) {
  .sidebar-left.card {
    padding: 0;
    gap: 24px;
  }

  .monthfilter-list {
    flex-direction: column;
    gap: 16px;
  }

  .monthfilter-link {
    padding: 0;
  }
}

/* ============================================
   響應式：手機版（< 768px）— 水平滑動篩選列
   ============================================ */
@media (max-width: 767.98px) {
  .sidebar-left.card {
    padding: 0 0 20px 40px;
    margin: 0 0 40px 0;
    gap: 20px;
  }

  .monthfilter-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .monthfilter-list::-webkit-scrollbar {
    display: none;
  }

  .monthfilter-item {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .monthfilter-link {
    padding: 0 2rem 0 0;
  }
}

/* ============================================
   高對比模式
   ============================================ */
@media (prefers-contrast: high) {
    .monthfilter-item {
        border-bottom-width: 2px;
    }

    .monthfilter-link:focus {
        outline-width: 4px;
    }

    .monthfilter-item.active .monthfilter-link {
        border: 2px solid currentColor;
    }
}

/* ============================================
   減少動畫
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .monthfilter-link {
        transition: none;
    }
}
