/* FreeHelper homepage redesign — design-only layer.
   Uses theme variables (e.g. --bs-primary) so Admin color settings keep working. */

/* ---------- HERO ---------- */
.fh-hero {
    background: var(--bs-primary, #2563eb);
    background: linear-gradient(135deg, var(--bs-primary, #2563eb) 0%, color-mix(in srgb, var(--bs-primary, #2563eb) 55%, #0b1220) 100%);
    border-radius: 20px;
    padding: 56px 32px 48px;
    margin: 8px 0 36px;
    color: #fff;
    text-align: center;
    position: relative;
}
.fh-hero::before,
.fh-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.fh-hero::before { width: 220px; height: 220px; top: 24px; right: 48px; }
.fh-hero::after { width: 130px; height: 130px; bottom: 30px; left: 56px; }
.fh-hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.fh-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 999px;
    margin-bottom: 18px;
}
.fh-title {
    color: #fff;
    font-size: clamp(28px, 4.5vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 12px;
}
.fh-sub {
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(15px, 2vw, 18px);
    margin: 0 auto 26px;
    max-width: 620px;
}

/* ---------- HERO SEARCH ---------- */
.fh-search { position: relative; max-width: 560px; margin: 0 auto; }
.fh-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa3b2;
    pointer-events: none;
}
#fhSearchInput {
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 16px;
    padding: 0 20px 0 50px;
    font-size: 16px;
    color: #1f2937;
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    outline: none;
}
#fhSearchInput:focus { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 0 0 4px rgba(255, 255, 255, 0.35); }
.fh-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bs-body-bg, #fff);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    z-index: 50;
    text-align: left;
    max-height: 340px;
    overflow-y: auto;
}
.fh-results.show { display: block; }
.fh-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--bs-body-color, #1f2937);
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.14);
}
.fh-result:last-child { border-bottom: none; }
.fh-result:hover { background: color-mix(in srgb, var(--bs-primary, #2563eb) 8%, transparent); color: var(--bs-primary, #2563eb); }
.fh-result-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; color: var(--bs-primary, #2563eb); flex: none; }
.fh-result-icon img { width: 26px; height: 26px; object-fit: contain; }
.fh-no-result { padding: 16px; color: var(--bs-secondary-color, #6b7280); font-size: 14px; text-align: center; }

/* ---------- STATS + POPULAR ---------- */
.fh-stats { display: flex; justify-content: center; gap: 36px; margin: 28px 0 6px; flex-wrap: wrap; }
.fh-stat { display: flex; flex-direction: column; }
.fh-stat strong { font-size: 26px; font-weight: 800; color: #fff; line-height: 1.1; }
.fh-stat span { font-size: 13px; color: rgba(255, 255, 255, 0.78); }
.fh-popular { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.fh-popular-label { color: rgba(255, 255, 255, 0.8); font-size: 13.5px; margin-right: 2px; }
.fh-popular a {
    color: #fff;
    font-size: 13.5px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 6px 14px;
    border-radius: 999px;
    transition: background 0.18s ease, transform 0.18s ease;
}
.fh-popular a:hover { background: rgba(255, 255, 255, 0.28); transform: translateY(-1px); color: #fff; }

/* ---------- SECTION HEADERS ---------- */
.fh-home .wrap-content { margin-bottom: 34px; }
.fh-home .hero-title {
    border-left: 4px solid var(--bs-primary, #2563eb);
    padding-left: 14px;
    margin-bottom: 18px;
}
.fh-home .hero-title h2 { font-size: 22px; font-weight: 800; margin: 0; }
.fh-home .hero-title h2 a { color: inherit; text-decoration: none; }
.fh-home .hero-title h2 a:hover { color: var(--bs-primary, #2563eb); }
.fh-home .hero-title p { margin: 4px 0 0; color: var(--bs-secondary-color, #6b7280); font-size: 14.5px; }

/* ---------- TOOL CARDS ---------- */
.fh-home .products ul.items { list-style: none; margin: 0 -8px; padding: 0; }
.fh-home .products ul.items::after { content: ""; display: block; clear: both; }
.fh-home .products ul.items.grid-view li {
    width: calc(25% - 16px);
    margin: 8px;
    float: left;
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(128, 128, 128, 0.18);
    border-radius: 32px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.07);
    text-align: center;
    display: flex;
    align-items: stretch;
    min-height: 148px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    overflow: hidden;
}
.fh-home .products ul.items.grid-view li:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(16, 24, 40, 0.14);
    border-color: color-mix(in srgb, var(--bs-primary, #2563eb) 45%, transparent);
}
.fh-home .products ul.items li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 24px 10px;
    color: var(--bs-body-color, #1f2937);
    text-decoration: none;
}
.fh-home .products ul.items li a i {
    font-size: 30px;
    width: 64px;
    height: 64px;
    line-height: 64px;
    border-radius: 50%;
    transition: transform 0.18s ease;
}
.fh-home .products ul.items.grid-view li:hover a i { transform: scale(1.08) rotate(-3deg); }
/* Rotating pastel icon tiles — pure CSS, no markup change */
.fh-home .products ul.items li:nth-child(6n+1) a i { color: #2563eb; background: #dbeafe; }
.fh-home .products ul.items li:nth-child(6n+2) a i { color: #7c3aed; background: #ede9fe; }
.fh-home .products ul.items li:nth-child(6n+3) a i { color: #16a34a; background: #dcfce7; }
.fh-home .products ul.items li:nth-child(6n+4) a i { color: #d97706; background: #fef3c7; }
.fh-home .products ul.items li:nth-child(6n+5) a i { color: #e11d48; background: #ffe4e6; }
.fh-home .products ul.items li:nth-child(6n+6) a i { color: #0891b2; background: #cffafe; }
.fh-home .products ul.items li a img { width: 64px; height: 64px; padding: 12px; object-fit: contain; background: #f1f5f9; border-radius: 50%; }
.fh-home .products ul.items li a span { font-size: 14.5px; font-weight: 600; line-height: 1.35; }

[theme-mode="dark"] .fh-home .products ul.items.grid-view li {
    background: var(--bs-secondary-dark, #1c2333);
    border-color: var(--bs-dark-border-color, #2c3648);
}
[theme-mode="dark"] .fh-home .products ul.items li a { color: #e5e9f0; }
[theme-mode="dark"] .fh-home .products ul.items li:nth-child(6n+1) a i { color: #93c5fd; background: rgba(37, 99, 235, 0.22); }
[theme-mode="dark"] .fh-home .products ul.items li:nth-child(6n+2) a i { color: #c4b5fd; background: rgba(124, 58, 237, 0.24); }
[theme-mode="dark"] .fh-home .products ul.items li:nth-child(6n+3) a i { color: #86efac; background: rgba(22, 163, 74, 0.24); }
[theme-mode="dark"] .fh-home .products ul.items li:nth-child(6n+4) a i { color: #fcd34d; background: rgba(217, 119, 6, 0.26); }
[theme-mode="dark"] .fh-home .products ul.items li:nth-child(6n+5) a i { color: #fda4af; background: rgba(225, 29, 72, 0.24); }
[theme-mode="dark"] .fh-home .products ul.items li:nth-child(6n+6) a i { color: #67e8f9; background: rgba(8, 145, 178, 0.26); }

/* ---------- COMPACT HERO (category pages) ---------- */
.fh-hero-sm { padding: 40px 32px 34px; }
.fh-hero-sm .fh-title { font-size: clamp(24px, 3.5vw, 34px); }
.fh-hero-sm .fh-sub { margin-bottom: 20px; }
.fh-hero-sm .fh-stats { margin: 18px 0 0; }
.fh-back {
    display: inline-block;
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 6px 16px;
    border-radius: 999px;
    margin-bottom: 16px;
}
.fh-back:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
@media (max-width: 767px) {
    .fh-hero-sm { padding: 30px 20px 26px; }
}

/* ---------- CATEGORY MENU ---------- */
.fh-cats { margin: 0 0 36px; }
.fh-cats-head { text-align: center; margin-bottom: 20px; }
.fh-cats-head h2 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.fh-cats-head p { margin: 0; color: var(--bs-secondary-color, #6b7280); font-size: 14.5px; }
.fh-cats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.fh-cat {
    display: flex; align-items: center; gap: 12px;
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(128, 128, 128, 0.18);
    border-radius: 18px;
    padding: 14px 14px;
    text-decoration: none; color: inherit;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.07);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.fh-cat:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 26px rgba(16, 24, 40, 0.13);
    border-color: color-mix(in srgb, var(--bs-primary, #2563eb) 45%, transparent);
    color: inherit;
}
.fh-cat-icon {
    width: 46px; height: 46px; flex: none;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
}
.fh-cat:nth-child(6n+1) .fh-cat-icon { color: #2563eb; background: #dbeafe; }
.fh-cat:nth-child(6n+2) .fh-cat-icon { color: #7c3aed; background: #ede9fe; }
.fh-cat:nth-child(6n+3) .fh-cat-icon { color: #16a34a; background: #dcfce7; }
.fh-cat:nth-child(6n+4) .fh-cat-icon { color: #d97706; background: #fef3c7; }
.fh-cat:nth-child(6n+5) .fh-cat-icon { color: #e11d48; background: #ffe4e6; }
.fh-cat:nth-child(6n+6) .fh-cat-icon { color: #0891b2; background: #cffafe; }
.fh-cat-text { display: flex; flex-direction: column; min-width: 0; }
.fh-cat-text strong { font-size: 14.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-cat-text small { color: var(--bs-secondary-color, #6b7280); font-size: 12.5px; }
.fh-cat-arrow { margin-left: auto; color: var(--bs-primary, #2563eb); font-weight: 800; opacity: 0; transform: translateX(-6px); transition: opacity 0.18s ease, transform 0.18s ease; }
.fh-cat:hover .fh-cat-arrow { opacity: 1; transform: none; }
[theme-mode="dark"] .fh-cat { background: #1c2333; border-color: #2c3648; }
[theme-mode="dark"] .fh-cat-text strong { color: #e5e9f0; }
@media (max-width: 1199px) {
    .fh-cats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
    .fh-cats-grid { grid-template-columns: 1fr; gap: 8px; }
    .fh-cat { padding: 10px 12px; gap: 12px; border-radius: 16px; }
    .fh-cat-icon { width: 42px; height: 42px; font-size: 18px; }
    .fh-cat-text strong { white-space: normal; font-size: 14px; }
    .fh-cat-arrow { display: inline; opacity: 0.6; transform: none; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1199px) {
    .fh-home .products ul.items.grid-view li { width: calc(33.333% - 16px); }
}
@media (max-width: 767px) {
    /* kill sideways scroll from wide elements */
    body { overflow-x: clip; }
    /* compact hero: less scroll before tools */
    .fh-hero { padding: 30px 16px 26px; border-radius: 16px; margin-bottom: 24px; }
    .fh-hero::before { width: 130px; height: 130px; top: 12px; right: 16px; }
    .fh-hero::after { display: none; }
    .fh-badge { font-size: 11px; padding: 5px 12px; margin-bottom: 12px; }
    .fh-title { margin-bottom: 8px; }
    .fh-sub { font-size: 14.5px; margin-bottom: 18px; }
    #fhSearchInput { height: 52px; }
    .fh-stats { gap: 20px; margin-top: 20px; }
    .fh-stat strong { font-size: 21px; }
    .fh-stat span { font-size: 12px; }
    /* popular chips scroll sideways instead of wrapping tall */
    .fh-popular { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
    .fh-popular::-webkit-scrollbar { display: none; }
    .fh-popular a { flex: none; }
    /* category menu */
    .fh-cats { margin-bottom: 26px; }
    .fh-cats-head h2 { font-size: 19px; }
    /* denser tool cards */
    .fh-home .products ul.items { margin: 0 -6px; }
    .fh-home .products ul.items.grid-view li { width: calc(50% - 12px); margin: 6px; min-height: 126px; border-radius: 24px; }
    .fh-home .products ul.items li a { padding: 16px 6px; gap: 8px; }
    .fh-home .products ul.items li a i { width: 54px; height: 54px; line-height: 54px; font-size: 25px; }
    .fh-home .products ul.items li a img { width: 54px; height: 54px; padding: 10px; }
    .fh-home .products ul.items li a span { font-size: 13px; }
    .fh-home .hero-title h2 { font-size: 19px; }
    .fh-home .wrap-content { margin-bottom: 26px; }
    /* render below-fold sections lazily for faster mobile paint */
    .fh-home .wrap-content { content-visibility: auto; contain-intrinsic-size: auto 640px; }
}
