/* ========================================================
   CALCHUB - CATEGORY LANDING PAGE STYLES
   Cohesive with All Calculators & Mega-Menu Subgroup Design
   Supports Container Width 1468px, Dark Mode & Full Responsiveness
======================================================== */

.cat-page {
    padding: 2rem 0 5rem 0;
    min-height: 80vh;
}

/* ==========================================
   1. CATEGORY HERO BANNER
========================================== */
.cat-hero-card {
    position: relative;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 2.25rem 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2.5rem;
    align-items: center;
    overflow: hidden;
}

.cat-hero-card::before {
    content: "";
    position: absolute;
    top: -90px;
    right: -60px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--cat-glow, rgba(37, 99, 235, 0.12)) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

html.dark .cat-hero-card {
    background-color: #131b2e;
    border-color: #1e293b;
    box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.45);
}

.cat-hero-left {
    position: relative;
    z-index: 1;
}

.cat-hero-title-row {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    margin-bottom: 0.9rem;
}

.cat-hero-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.cat-hero-icon-box img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.cat-hero-heading-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.cat-hero-title {
    font-size: 2.35rem;
    font-weight: 850;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.12;
    margin: 0;
}

html.dark .cat-hero-title {
    color: #f8fafc;
}

.cat-hero-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.cat-hero-desc {
    font-size: 1.02rem;
    color: #475569;
    line-height: 1.6;
    max-width: 720px;
    margin: 0 0 1.4rem 0;
}

html.dark .cat-hero-desc {
    color: #94a3b8;
}

/* Inline Category Search Bar */
.cat-search-bar {
    display: flex;
    align-items: center;
    max-width: 560px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 0.32rem 0.4rem 0.32rem 1.15rem;
    gap: 0.65rem;
    transition: all 0.2s ease;
}

.cat-search-bar:focus-within {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

html.dark .cat-search-bar {
    background-color: #0b1120;
    border-color: #1e293b;
}

html.dark .cat-search-bar:focus-within {
    background-color: #131b2e;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

.cat-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.92rem;
    color: #0f172a;
    font-family: inherit;
    min-width: 0;
}

.cat-search-input::placeholder {
    color: #94a3b8;
}

html.dark .cat-search-input {
    color: #f8fafc;
}

.cat-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #475569;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.78rem;
    cursor: pointer;
    flex-shrink: 0;
}

.cat-search-clear.visible {
    display: inline-flex;
}

html.dark .cat-search-clear {
    background: #334155;
    color: #cbd5e1;
}

.cat-search-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 0.52rem 1.25rem;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.cat-search-btn:hover {
    background: #1d4ed8;
}

/* Right Hero Summary Card */
.cat-hero-right {
    position: relative;
    z-index: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem;
}

html.dark .cat-hero-right {
    background: #0b1120;
    border-color: #1e293b;
}

.cat-hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cat-stat-box {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
}

html.dark .cat-stat-box {
    background: #131b2e;
    border-color: #1e293b;
}

.cat-stat-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
}

html.dark .cat-stat-val {
    color: #f8fafc;
}

.cat-stat-lbl {
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748b;
    margin-top: 2px;
}

html.dark .cat-stat-lbl {
    color: #94a3b8;
}

.cat-hero-highlights {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #475569;
    font-weight: 500;
}

html.dark .cat-hero-highlights {
    color: #cbd5e1;
}

.cat-highlight-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.cat-highlight-item svg {
    color: #10b981;
    flex-shrink: 0;
}

/* ==========================================
   2. QUICK SUBCATEGORY JUMP BAR
========================================== */
.cat-jump-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.cat-jump-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.35rem;
}

html.dark .cat-jump-label {
    color: #94a3b8;
}

.cat-jump-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.cat-jump-pill:hover {
    border-color: #3b82f6;
    color: #2563eb;
    background: #eff6ff;
    transform: translateY(-1px);
}

html.dark .cat-jump-pill {
    background: #131b2e;
    border-color: #1e293b;
    color: #cbd5e1;
}

html.dark .cat-jump-pill:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: #1e293b;
}

/* ==========================================
   3. SECTION HEADERS
========================================== */
.cat-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cat-section-eyebrow {
    font-size: 0.76rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2563eb;
    margin-bottom: 0.25rem;
}

html.dark .cat-section-eyebrow {
    color: #60a5fa;
}

.cat-section-title {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0;
}

html.dark .cat-section-title {
    color: #f8fafc;
}

.cat-section-sub {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0.25rem 0 0 0;
}

html.dark .cat-section-sub {
    color: #94a3b8;
}

/* ==========================================
   4. SUBCATEGORIES GRID (MEGA-MENU EXACT STYLE)
========================================== */
.cat-subgroups-section {
    margin-bottom: 3.5rem;
}

.cat-subgroups-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.35rem;
}

.cat-subgroups-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cat-subgroup-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    display: flex;
    flex-direction: column;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, border-color 0.18s ease;
    scroll-margin-top: 92px;
}

.cat-subgroup-card:hover {
    transform: translateY(-3px);
    border-color: #cbd5e1;
    box-shadow: 0 12px 26px -6px rgba(15, 23, 42, 0.08);
}

html.dark .cat-subgroup-card {
    background-color: #131b2e;
    border-color: #1e293b;
}

html.dark .cat-subgroup-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.45);
}

.cat-subgroup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.85rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

html.dark .cat-subgroup-header {
    border-color: #1e293b;
}

.cat-subgroup-header-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.cat-subgroup-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-subgroup-title {
    font-size: 1.02rem;
    font-weight: 750;
    color: #0f172a;
    margin: 0;
    line-height: 1.25;
}

html.dark .cat-subgroup-title {
    color: #f8fafc;
}

.cat-subgroup-count {
    font-size: 0.74rem;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    white-space: nowrap;
    flex-shrink: 0;
}

html.dark .cat-subgroup-count {
    background: #0b1120;
    border-color: #1e293b;
    color: #94a3b8;
}

.cat-subgroup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.cat-subgroup-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.44rem 0.6rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: all 0.12s ease;
}

.cat-subgroup-link:hover {
    background-color: #eff6ff;
    color: #2563eb;
    transform: translateX(2px);
}

html.dark .cat-subgroup-link {
    color: #cbd5e1;
}

html.dark .cat-subgroup-link:hover {
    background-color: #1e293b;
    color: #60a5fa;
}

.cat-subgroup-link.is-match {
    background-color: #fef08a !important;
    color: #854d0e !important;
    font-weight: 600;
}

html.dark .cat-subgroup-link.is-match {
    background-color: #854d0e !important;
    color: #fef08a !important;
}

.cat-subgroup-link-arr {
    color: #cbd5e1;
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.12s ease, color 0.12s ease;
}

.cat-subgroup-link:hover .cat-subgroup-link-arr {
    color: #2563eb;
    transform: translateX(2px);
}

html.dark .cat-subgroup-link:hover .cat-subgroup-link-arr {
    color: #60a5fa;
}

/* ==========================================
   5. POPULAR TOOLS STRIP (IF AVAILABLE)
========================================== */
.cat-popular-section {
    margin-bottom: 3.5rem;
}

.cat-popular-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.cat-popular-pill-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    text-decoration: none;
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 650;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.cat-popular-pill-card:hover {
    border-color: #3b82f6;
    color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px -4px rgba(37, 99, 235, 0.12);
}

html.dark .cat-popular-pill-card {
    background: #131b2e;
    border-color: #1e293b;
    color: #f8fafc;
}

html.dark .cat-popular-pill-card:hover {
    border-color: #60a5fa;
    color: #60a5fa;
}

.cat-popular-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.cat-popular-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-popular-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   6. COMPLETE A-Z DIRECTORY CARDS
========================================== */
.cat-directory-section {
    margin-bottom: 3.5rem;
}

.cat-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.cat-tool-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
}

.cat-tool-card:hover {
    transform: translateY(-3px);
    border-color: #3b82f6;
    box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.12);
}

html.dark .cat-tool-card {
    background: #131b2e;
    border-color: #1e293b;
}

html.dark .cat-tool-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.45);
}

.cat-tool-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cat-tool-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-tool-popular-tag {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fef3c7;
    color: #b45309;
    padding: 0.18rem 0.55rem;
    border-radius: 9999px;
}

html.dark .cat-tool-popular-tag {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}

.cat-tool-card-title {
    font-size: 1rem;
    font-weight: 750;
    color: #0f172a;
    margin: 0 0 0.4rem 0;
    line-height: 1.3;
}

html.dark .cat-tool-card-title {
    color: #f8fafc;
}

.cat-tool-card:hover .cat-tool-card-title {
    color: #2563eb;
}

html.dark .cat-tool-card:hover .cat-tool-card-title {
    color: #60a5fa;
}

.cat-tool-card-desc {
    font-size: 0.83rem;
    color: #64748b;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

html.dark .cat-tool-card-desc {
    color: #94a3b8;
}

.cat-tool-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2563eb;
}

html.dark .cat-tool-card-foot {
    border-color: #1e293b;
    color: #60a5fa;
}

/* ==========================================
   7. EXPLORE OTHER CATEGORIES FOOTER STRIP
========================================== */
.cat-other-strip {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

html.dark .cat-other-strip {
    background: #131b2e;
    border-color: #1e293b;
}

.cat-other-title {
    font-size: 1.05rem;
    font-weight: 750;
    color: #0f172a;
    margin: 0 0 0.2rem 0;
}

html.dark .cat-other-title {
    color: #f8fafc;
}

.cat-other-sub {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

html.dark .cat-other-sub {
    color: #94a3b8;
}

.cat-other-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 650;
    padding: 0.65rem 1.35rem;
    border-radius: 9999px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
}

.cat-other-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

/* Empty State */
.cat-empty-state {
    display: none;
    grid-column: 1 / -1;
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
}

html.dark .cat-empty-state {
    background: #131b2e;
    border-color: #334155;
}

/* ==========================================
   8. RESPONSIVE BREAKPOINTS
========================================== */
@media (max-width: 1280px) {
    .cat-subgroups-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cat-popular-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cat-tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .cat-hero-card {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.75rem;
    }

    .cat-hero-title {
        font-size: 1.95rem;
    }

    .cat-popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cat-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .cat-subgroups-grid,
    .cat-subgroups-grid.cols-2,
    .cat-popular-grid,
    .cat-tools-grid {
        grid-template-columns: 1fr;
    }

    .cat-hero-card {
        padding: 1.35rem;
    }

    .cat-hero-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .cat-hero-title {
        font-size: 1.65rem;
    }
}
