/* ===== AutoPartsX — Categories page ===== */
.apxc-page {
    --apx-red: #ff0505;
    --apx-red-dark: #b00303;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 12px;
    color: #1e1e1e;
    box-sizing: border-box;
}
.apxc-page *,
.apxc-page *::before,
.apxc-page *::after { box-sizing: border-box; }

.apxc-empty { padding: 40px 0; font-size: 16px; }

/* ---- Hero ---- */
.apxc-hero {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 30px 32px;
    color: #fff;
    background:
        radial-gradient(120% 160% at 92% -10%, rgba(255,5,5,.95) 0%, rgba(255,5,5,0) 42%),
        linear-gradient(118deg, #0e0e0e 0%, #1c0606 44%, #5c0202 78%, #b00303 100%);
    box-shadow: 0 14px 34px rgba(120, 0, 0, .28);
}
.apxc-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(80% 120% at 0% 120%, rgba(255,255,255,.06), transparent 60%);
    pointer-events: none;
}
.apxc-hero-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.apxc-hero-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(255,255,255,.72);
    margin-bottom: 8px;
}
.apxc-hero-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 800;
    color: #fff;
}
.apxc-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.apxc-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 13px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(2px);
}

.apxc-change-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #b00303;
    background: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .12s ease, box-shadow .12s ease;
    box-shadow: 0 6px 16px rgba(0,0,0,.22);
}
.apxc-change-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(0,0,0,.28); }
.apxc-change-btn svg { color: var(--apx-red); }

/* Empty-state button (outside the dark hero) — filled red so it's visible on white */
.apxc-page > .apxc-change-btn {
    color: #fff;
    background: linear-gradient(120deg, #ff0505, #b00303);
    margin-top: 8px;
}
.apxc-page > .apxc-change-btn svg { color: #fff; }

/* ---- Search bar ---- */
.apxc-searchbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -22px auto 22px;
    position: relative;
    z-index: 3;
    width: calc(100% - 36px);
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 0 10px 26px rgba(0,0,0,.08);
}
.apxc-search-icon { display: inline-flex; color: #b3b3b3; flex-shrink: 0; }
/* Reset aggressively so the input is only as tall as its text (themes inflate inputs). */
#apxc-search {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    line-height: 1.4 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    font-size: 15px;
    color: #1e1e1e;
}
#apxc-search:focus { border: none !important; box-shadow: none !important; outline: none !important; }
#apxc-search::placeholder { color: #a3a3a3; }
/* ---- Search suggestions (typeahead) ---- */
.apxc-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    display: none;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(0,0,0,.14);
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}
.apxc-suggest.open { display: block; }
.apxc-suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #2b2b2b;
    font-size: 14px;
    text-decoration: none;
}
.apxc-suggest-item:hover,
.apxc-suggest-item.active {
    background: rgba(255,5,5,.08);
    color: var(--apx-red);
}
.apxc-suggest-item svg { color: #c2c2c2; flex-shrink: 0; }
.apxc-suggest-item:hover svg,
.apxc-suggest-item.active svg { color: var(--apx-red); }
.apxc-suggest-item mark { background: transparent; color: var(--apx-red); font-weight: 700; padding: 0; }
.apxc-suggest-empty { padding: 14px 12px; color: #888; font-size: 14px; }

/* ---- Category list ---- */
.apxc-list { display: flex; flex-direction: column; gap: 10px; }

.apxc-group {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.apxc-group:hover { box-shadow: 0 6px 18px rgba(0,0,0,.07); border-color: #e0e0e0; }

.apxc-parent {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: #232323;
    transition: background-color .12s ease;
}
.apxc-parent:hover,
.apxc-parent:focus {
    background: rgba(255, 5, 5, .05) !important;
    color: #232323 !important;
}
.apxc-parent:hover .apxc-parent-name,
.apxc-parent:focus .apxc-parent-name {
    color: #232323;
}
.apxc-parent-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 10px;
    color: var(--apx-red);
    background: linear-gradient(135deg, rgba(255,5,5,.10), rgba(255,5,5,.04));
}
.apxc-parent-name {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: uppercase;
    color: #232323;
}
.apxc-parent-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 7px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--apx-red);
    border-radius: 999px;
    flex-shrink: 0;
}
.apxc-parent-arrow {
    display: inline-flex;
    color: #b0b0b0;
    transition: transform .2s ease;
    flex-shrink: 0;
}
.apxc-group.open .apxc-parent-arrow { transform: rotate(180deg); color: var(--apx-red); }

.apxc-children {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 18px 18px 74px;
}
.apxc-group.open .apxc-children { display: flex; }

.apxc-child-link {
    display: inline-block;
    padding: 8px 14px;
    font-size: 13.5px;
    color: #333;
    text-decoration: none;
    background: #f4f4f5;
    border: 1px solid #ececec;
    border-radius: 8px;
    transition: all .12s ease;
}
.apxc-child-link:hover {
    color: #fff;
    background: var(--apx-red);
    border-color: var(--apx-red);
}

.apxc-noresults { padding: 30px 4px; color: #777; font-size: 15px; }

/* ---- Modal ---- */
.apx-modal { position: fixed; inset: 0; z-index: 99999; display: none; }
.apx-modal.open { display: block; }
.apx-modal-overlay {
    position: absolute; inset: 0;
    background: rgba(10,10,10,.6);
    backdrop-filter: blur(2px);
}
.apx-modal-box {
    position: relative;
    max-width: 640px;
    width: calc(100% - 32px);
    max-height: 88vh;
    overflow-y: auto;
    margin: 6vh auto;
    background: #fff;
    border-radius: 14px;
    padding: 26px 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,.4);
}
.apx-modal-close {
    position: absolute;
    top: 12px; right: 14px;
    width: 34px; height: 34px;
    border: none;
    background: #f2f2f2;
    color: #444;
    border-radius: 8px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.apx-modal-close:hover { background: var(--apx-red); color: #fff; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .apxc-hero { padding: 24px 20px; border-radius: 12px; }
    .apxc-hero-title { font-size: 20px; }
    .apxc-change-btn { width: 100%; justify-content: center; margin-top: 4px; }
    /* Search sits as a normal block below the hero (no floating overlap). */
    .apxc-searchbar { margin-top: 14px; width: 100%; }
    .apxc-parent { gap: 10px; padding: 12px 14px; }
    .apxc-parent-icon { width: 36px; height: 36px; }
    .apxc-parent-name { font-size: 13.5px; }
    .apxc-children { padding-left: 14px; }
}
