/* =============================================================
   HocMai — Archive + Shared Component CSS v4.1
   Loaded on archive, taxonomy, and search pages
   ============================================================= */

/* ────────────────────────────────────────────────────────────
   ARCHIVE HERO
──────────────────────────────────────────────────────────── */
.hmt-archive-hero {
    background: linear-gradient(145deg, var(--clr-indigo-950) 0%, var(--clr-indigo-800) 60%, #312e81 100%);
    padding: var(--sp-10) 0 var(--sp-12);
    position: relative;
    overflow: hidden;
}
.hmt-archive-hero-bg { position: absolute; inset: 0; pointer-events: none; }
.hmt-archive-hero-blob {
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139,92,246,.22), transparent 70%);
    top: -150px; right: -80px;
    filter: blur(60px);
    animation: blobFloat 18s ease-in-out infinite alternate;
}
.hmt-archive-hero-inner {
    position: relative; z-index: 1;
    display: flex; align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-8); flex-wrap: wrap;
}
.hmt-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: var(--text-xs); color: rgba(255,255,255,.5);
    margin-bottom: var(--sp-3);
}
.hmt-breadcrumb a { color: rgba(255,255,255,.8); }
.hmt-breadcrumb a:hover { color: #fff; text-decoration: none; }
.hmt-breadcrumb span:last-child { color: #fff !important; font-weight: 700; }
.hmt-breadcrumb svg { opacity: .6; color: #fff; }

.hmt-archive-h1 {
    display: flex; align-items: center; gap: var(--sp-3);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 900; letter-spacing: -.04em;
    color: #fff; margin-bottom: var(--sp-3);
    line-height: 1.1;
}
.hmt-archive-h1-icon { font-size: 0.9em; flex-shrink: 0; }
.hmt-archive-desc {
    font-size: var(--text-md); color: rgba(255,255,255,.65);
    max-width: 500px; line-height: 1.65;
}
.hmt-archive-hero-stats {
    display: flex; gap: var(--sp-6); flex-shrink: 0;
}
.hmt-archive-hero-stat {
    display: flex; flex-direction: column; align-items: center;
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--r-xl);
    padding: var(--sp-4) var(--sp-6);
    min-width: 80px; text-align: center;
}
.hmt-archive-hero-stat span {
    font-size: var(--text-2xl); font-weight: 900;
    color: #fff; letter-spacing: -.04em;
}
.hmt-archive-hero-stat small {
    font-size: var(--text-xs); color: rgba(255,255,255,.55);
    text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
    margin-top: 2px;
}

/* ────────────────────────────────────────────────────────────
   ARCHIVE BODY: SIDEBAR + MAIN
──────────────────────────────────────────────────────────── */
.hmt-archive-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--sp-8);
    padding-top: var(--sp-8);
    padding-bottom: var(--sp-16);
    align-items: start;
}
@media (max-width: 1024px) {
    .hmt-archive-body { grid-template-columns: 220px 1fr; gap: var(--sp-6); }
}
@media (max-width: 768px) {
    .hmt-archive-body { grid-template-columns: 1fr; }
}

/* ── Sidebar ── */
.hmt-archive-sidebar {
    position: sticky; top: calc(var(--nav-h) + 16px);
    display: flex; flex-direction: column; gap: var(--sp-4);
}
@media (max-width: 768px) {
    .hmt-archive-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0; right: 0; z-index: 200;
        background: rgba(0,0,0,.5);
        backdrop-filter: blur(8px);
        padding: var(--sp-6);
        display: none; flex-direction: column; justify-content: flex-start;
        overflow-y: auto;
    }
    .hmt-archive-sidebar.open { display: flex; }
}

.hmt-sidebar-widget {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: var(--r-xl);
    padding: var(--sp-6);
    box-shadow: 0 4px 24px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
}
.hmt-sidebar-widget-title {
    display: flex; align-items: center; gap: 8px;
    font-size: var(--text-xs); font-weight: 800;
    text-transform: uppercase; letter-spacing: .1em;
    color: var(--text-muted);
    margin-bottom: var(--sp-3);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border);
}
.hmt-sidebar-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.hmt-sidebar-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px var(--sp-3);
    border-radius: var(--r-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: background var(--dur-fast), color var(--dur-fast);
}
.hmt-sidebar-link:hover { background: var(--bg-hover); color: var(--primary); text-decoration: none; }
.hmt-sidebar-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}
.hmt-sidebar-count {
    font-size: var(--text-xs); color: var(--text-muted);
    background: var(--bg-muted);
    padding: 1px 7px; border-radius: var(--r-full);
    font-weight: 600; min-width: 28px; text-align: center;
}
.hmt-sidebar-link.active .hmt-sidebar-count {
    background: var(--primary); color: #fff;
}

.hmt-sidebar-widget--cta {
    background: linear-gradient(135deg, var(--clr-indigo-800), var(--clr-violet-600));
    border-color: transparent; text-align: center;
}
.hmt-sidebar-cta-icon { font-size: 2rem; margin-bottom: var(--sp-2); }
.hmt-sidebar-widget--cta h4 { font-size: var(--text-md); font-weight: 800; color: #fff; margin-bottom: var(--sp-2); }
.hmt-sidebar-widget--cta p  { font-size: var(--text-sm); color: rgba(255,255,255,.65); }

/* ── Toolbar ── */
.hmt-archive-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--sp-5); gap: var(--sp-4); flex-wrap: wrap;
}
.hmt-results-count {
    font-size: var(--text-sm); color: var(--text-muted);
}
.hmt-results-count strong { color: var(--primary); font-weight: 800; }
.hmt-results-count em { color: var(--text); font-style: normal; font-weight: 600; }
.hmt-toolbar-actions { display: flex; gap: var(--sp-2); }

.hmt-mobile-filter-toggle {
    display: none;
    align-items: center; gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--r-full);
    font-size: var(--text-sm); font-weight: 700; color: var(--primary);
    cursor: pointer;
    transition: background var(--dur-fast);
}
.hmt-mobile-filter-toggle.active { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (max-width: 768px) { .hmt-mobile-filter-toggle { display: flex; } }

/* ── Card Grid ── */
.hmt-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-5);
}
@media (max-width: 1024px) { .hmt-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .hmt-card-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.hmt-card {
    display: flex; flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--r-xl);
    overflow: hidden;
    text-decoration: none; color: inherit;
    box-shadow: var(--shadow-card);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur-fast);
    animation: cardReveal .5s var(--ease) both;
    position: relative;
}
.hmt-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
    text-decoration: none;
}
@keyframes cardReveal {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Stagger delays */
.hmt-card:nth-child(1)  { animation-delay:  .04s }
.hmt-card:nth-child(2)  { animation-delay:  .08s }
.hmt-card:nth-child(3)  { animation-delay:  .12s }
.hmt-card:nth-child(4)  { animation-delay:  .16s }
.hmt-card:nth-child(5)  { animation-delay:  .20s }
.hmt-card:nth-child(6)  { animation-delay:  .24s }
.hmt-card:nth-child(7)  { animation-delay:  .28s }
.hmt-card:nth-child(8)  { animation-delay:  .32s }
.hmt-card:nth-child(n+9){ animation-delay:  .36s }

.hmt-card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, var(--clr-violet-100) 0%, var(--clr-violet-50) 100%);
}
.hmt-card-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .4s var(--ease);
}
.hmt-card:hover .hmt-card-thumb img { transform: scale(1.04); }
.hmt-card-thumb-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(15,10,46,.35) 0%, transparent 60%);
    pointer-events: none;
}
.hmt-card-thumb-icon {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
}
.hmt-card-thumb-icon-bg {
    width: 64px; height: 64px;
    background: var(--primary-soft);
    border-radius: var(--r-xl);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    transition: transform var(--dur) var(--ease);
}
.hmt-card:hover .hmt-card-thumb-icon-bg { transform: scale(1.1) rotate(-5deg); }

.hmt-card-body {
    display: flex; flex-direction: column;
    flex: 1; padding: var(--sp-4) var(--sp-5) var(--sp-5);
}
.hmt-card-tags {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: var(--sp-3);
}
.hmt-tag {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: var(--r-full);
    font-size: .68rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .06em;
}
.hmt-tag--grade   { background: var(--gold-soft); color: var(--gold); }
.hmt-tag--subject { background: var(--primary-soft); color: var(--primary); }

/* Post item with thumbnail */
.hmt-search-thumb {
  width: 44px; height: 34px; flex-shrink: 0;
  border-radius: 8px; object-fit: cover;
  background: var(--bg-muted);
}
.hmt-search-thumb--placeholder {
  width: 44px; height: 34px; flex-shrink: 0;
  border-radius: 8px; background: var(--bg-muted);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.hmt-search-info { flex: 1; min-width: 0; overflow: hidden; }
.hmt-search-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: var(--text-sm); font-weight: 600; color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  margin-bottom: 4px;
}

.hmt-card-title {
    font-size: var(--text-md); font-weight: 700;
    color: var(--text); line-height: 1.45;
    margin-bottom: var(--sp-3);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    transition: color var(--dur-fast);
}
.hmt-card:hover .hmt-card-title { color: var(--primary); }

.hmt-card-meta {
    display: flex; align-items: center; gap: var(--sp-3);
    flex-wrap: wrap; margin-top: auto;
}
.hmt-card-meta-item {
    display: flex; align-items: center; gap: 4px;
    font-size: var(--text-xs); color: var(--text-muted); font-weight: 500;
}
.hmt-card-date { margin-left: auto; }

.hmt-card-cta {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    position: absolute; bottom: var(--sp-4); right: var(--sp-5);
    background: linear-gradient(135deg, var(--clr-violet-600), var(--clr-violet-500));
    color: #fff; padding: 6px 14px;
    border-radius: var(--r-full);
    font-size: var(--text-xs); font-weight: 800;
    text-transform: uppercase; letter-spacing: .06em;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--dur-fast);
    box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
.hmt-card:hover .hmt-card-meta { opacity: 0; }
.hmt-card:hover .hmt-card-cta { opacity: 1; transform: translateY(0); }

/* ── Pagination ── */
.hmt-pagination {
    margin-top: var(--sp-10);
    display: flex; justify-content: center;
}
.hmt-pagination ul {
    list-style: none;
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.hmt-pagination ul li a,
.hmt-pagination ul li span {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--r-md);
    font-size: var(--text-sm); font-weight: 700;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-card);
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
    text-decoration: none;
}
.hmt-pagination ul li a:hover {
    border-color: var(--primary); color: var(--primary); background: var(--primary-soft);
    transform: translateY(-2px); text-decoration: none;
}
.hmt-pagination ul li .current {
    background: linear-gradient(135deg, var(--clr-violet-600), var(--clr-violet-500));
    border-color: transparent;
    color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,0.35);
}
.hmt-pagination ul li .prev, .hmt-pagination ul li .next {
    width: auto; padding: 0 var(--sp-4);
}

/* ── Empty state ── */
.hmt-empty-state {
    text-align: center; padding: var(--sp-16) var(--sp-8);
}
.hmt-empty-state-icon { font-size: 3.5rem; margin-bottom: var(--sp-4); }
.hmt-empty-state h3 { font-size: var(--text-xl); font-weight: 800; margin-bottom: var(--sp-2); }
.hmt-empty-state p  { color: var(--text-muted); margin-bottom: var(--sp-6); }

/* ── Shared button (reused in home.css too) ── */
.hmt-btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font); font-weight: 700; font-size: var(--text-sm);
    border: none; cursor: pointer; text-decoration: none;
    border-radius: var(--r-full); transition: all var(--dur) var(--ease);
    letter-spacing: -.01em; white-space: nowrap;
    padding: 11px 22px;
}
.hmt-btn:hover { text-decoration: none; }
.hmt-btn--primary {
    background: linear-gradient(135deg, var(--clr-indigo-800), var(--clr-violet-500));
    color: #fff; box-shadow: var(--shadow-btn);
}
.hmt-btn--primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 28px rgba(124,58,237,.45); }

/* ─── Archive Filter Form ─── */
.hmt-filter-form { display: flex; flex-direction: column; gap: 20px; }
.hmt-filter-select-wrap { position: relative; }
.hmt-filter-select-wrap::after {
    content: "▼"; font-size: 10px; color: #8b9199;
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    pointer-events: none;
}
.hmt-filter-select {
    appearance: none; -webkit-appearance: none;
    width: 100%; padding: 12px 14px; padding-right: 30px;
    font-size: 14px; font-weight: 500; font-family: inherit; color: #1a1a2e;
    background: #f8fafc; border: 1px solid #e1e7ef; border-radius: 8px;
    cursor: pointer; transition: all .2s; outline: none;
}
.hmt-filter-select:hover, .hmt-filter-select:focus { border-color: #7c3aed; background: #fff; box-shadow: 0 0 0 3px rgba(124,58,237,.1); }

.hmt-filter-submit {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px; font-size: 15px; font-weight: 700;
    color: #fff; background: var(--gradient); border: none; border-radius: 8px;
    cursor: pointer; transition: all .2s; font-family: inherit;
}
.hmt-filter-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,.25); }

/* ─── AJAX Search Header ─── */
.hmt-search-wrapper { position: relative; }
.hmt-live-search-results {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px;
    background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1);
    border: 1px solid #e1e7ef; z-index: 999; overflow: hidden;
    opacity: 0; visibility: hidden; transform: translateY(-5px);
    transition: all .2s;
}
.hmt-live-search-results.active { opacity: 1; visibility: visible; transform: translateY(0); }
.hmt-search-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
    text-decoration: none; color: #1a1a2e; transition: background .15s;
}
.hmt-search-item:last-child { border-bottom: none; }
.hmt-search-item:hover { background: #f8fafc; }
.hmt-search-item-badge {
    font-size: 10px; font-weight: 700; color: #7c3aed; background: #f0eeff;
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.hmt-search-item-title { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── Horizontal Filter Bar ─── */
.hmt-archive-body--full { grid-template-columns: 1fr !important; }
.hmt-archive-toolbar--enhanced { 
    background: #fff; border: 1px solid #e1e7ef; 
    border-radius: 12px; padding: 12px 16px; 
    box-shadow: 0 4px 12px rgba(0,0,0,.03);
    margin-bottom: 24px;
}
.hmt-filter-form-row {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
    width: 100%;
}
.hmt-filter-row-group {
    display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0;
}
.hmt-filter-row-group .hmt-filter-select-wrap { min-width: 200px; }
.hmt-filter-label {
    font-size: 13px; font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.hmt-filter-selects {
    display: flex; gap: 12px; flex: 1; flex-wrap: wrap;
    min-width: 0;
}
.hmt-filter-selects .hmt-filter-select-wrap { min-width: 180px; flex: 1 1 180px; }
@media (max-width: 768px) {
    .hmt-filter-form-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .hmt-filter-row-group { flex-direction: column; width: 100%; gap: 8px; }
    .hmt-filter-selects { flex-direction: column; width: 100%; gap: 8px; flex-wrap: nowrap; }
    .hmt-filter-selects .hmt-filter-select-wrap { width: 100% !important; min-width: unset; flex: none; }
    .hmt-filter-selects .hmt-filter-has-icon { width: 100% !important; }
    .hmt-filter-row-meta { font-size: 13px; }
    /* Fix select nằm trong has-icon cũng phải 100% */
    .hmt-filter-has-icon .hmt-filter-select { width: 100%; }
}


/* ─── Pjax Loading State ─── */
.hmt-pjax-loading { opacity: 0.4; pointer-events: none; transition: opacity 0.2s ease; }

/* ─── SVG Native Select Styling ─── */
.hmt-filter-has-icon { position: relative; }
.hmt-filter-left-icon {
    position: absolute;
    left: 14px; top: 50%; transform: translateY(-50%);
    color: #8b9199; pointer-events: none; z-index: 2;
    transition: color 0.2s;
}
.hmt-filter-has-icon .hmt-filter-select {
    padding-left: 40px; /* Nhường chỗ cho SVG */
}
.hmt-filter-has-icon:focus-within .hmt-filter-left-icon {
    color: #7c3aed; /* Đổi màu Tím khi người dùng bấm vào mũi tên */
}


