/* ═══════════════════════════════════════════════
   JASA V2 — Categories / Shop Page
   categories.css
   ═══════════════════════════════════════════════ */

/* ── Category bar (fixed below header) ── */
.cat-bar {
    position: fixed;
    top: var(--hh);
    left: 0; right: 0;
    height: 48px;
    background: var(--bg-white);
    border-bottom: 1.5px solid var(--border);
    z-index: 850;
    display: flex;
    align-items: center;
}
.cat-bar-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
}

.cat-tab {
    flex: 1;                  /* equal share of available width */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 8px;
    border-radius: 50px;
    border: 1.5px solid var(--border2);
    background: none;
    font-size: .76rem; font-weight: 700;
    color: var(--txt2);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background var(--ease), color var(--ease),
                border-color var(--ease), box-shadow var(--ease);
}
.cat-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 3px 12px rgba(45,140,240,.32);
}
.cat-tab:not(.active):hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Main content offset for cat-bar ── */
.cat-main {
    padding-top: calc(var(--hh) + 48px) !important;
}

/* ── Toolbar ── */
.cat-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px 0;
}
.cat-search-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}
.cat-search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: .82rem;
    color: var(--txt3);
    pointer-events: none;
}
.cat-search-input {
    width: 100%;
    height: 40px;
    padding: 0 36px 0 36px;
    border: 1.5px solid var(--border2);
    border-radius: 50px;
    font-size: .84rem; font-weight: 600;
    color: var(--txt1);
    background: var(--bg);
    outline: none;
    font-family: inherit;
    transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.cat-search-input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(45,140,240,.1);
}
.cat-search-input::placeholder { color: var(--txt3); font-weight: 500; }
.cat-search-clear {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--txt3); font-size: .78rem;
    cursor: pointer; padding: 4px;
    transition: color var(--ease);
}
.cat-search-clear:hover { color: var(--txt1); }

.cat-tool-btn {
    display: inline-flex; align-items: center; gap: 5px;
    height: 40px; padding: 0 12px;
    border: 1.5px solid var(--border2);
    border-radius: 50px;
    background: none;
    font-size: .76rem; font-weight: 700;
    color: var(--txt2);
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    font-family: inherit; position: relative;
    transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.cat-tool-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-faint);
}
.cat-tool-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.cat-badge {
    min-width: 16px; height: 16px;
    border-radius: 50px;
    background: var(--primary);
    color: #fff;
    font-size: .58rem; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

/* ── Active chips ── */
.cat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 0;
}
.cat-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--primary-faint);
    border: 1px solid var(--primary-light);
    color: var(--primary);
    border-radius: 50px;
    padding: 3px 10px;
    font-size: .72rem; font-weight: 700;
}
.cat-chip-rm {
    cursor: pointer; opacity: .6;
    background: none; border: none;
    color: inherit; font-size: .6rem; padding: 0;
    transition: opacity var(--ease);
}
.cat-chip-rm:hover { opacity: 1; }

/* ── Results count ── */
.cat-results-row {
    padding: 6px 14px 0;
}
.cat-results-count {
    font-size: .72rem; font-weight: 700;
    color: var(--txt3);
}

/* ── Product Grid ── */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px 14px 16px;
}
@media (min-width: 480px) {
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 700px) {
    .cat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Product Card ── */
.prod-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: box-shadow var(--ease), transform var(--ease), border-color var(--ease);
}
.prod-card:hover {
    box-shadow: var(--sh-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}
.prod-card-img {
    height: 120px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 10px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.prod-card-img img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
}
.prod-card-img .prod-no-img {
    font-size: 2.2rem;
    color: var(--border2);
}
.prod-card-body {
    padding: 10px 10px 8px;
    flex: 1;
    display: flex; flex-direction: column;
}
.prod-card-name {
    font-size: .8rem; font-weight: 800;
    color: var(--txt1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    margin-bottom: 3px;
}
.prod-card-sub {
    font-size: .68rem; font-weight: 600;
    color: var(--txt3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 6px;
}
.prod-card-price-row {
    display: flex; align-items: center; gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.prod-price {
    font-size: .92rem; font-weight: 800;
    color: var(--txt1);
}
.prod-original {
    font-size: .66rem; font-weight: 600;
    color: var(--txt3);
    text-decoration: line-through;
}
.prod-disc {
    font-size: .6rem; font-weight: 800;
    background: #dcfce7; color: #16a34a;
    border-radius: 4px; padding: 1px 5px;
    margin-left: auto;
}
.prod-card-actions {
    display: flex; gap: 6px;
    margin-top: auto;
}
.prod-buy-btn {
    flex: 1; height: 36px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--r-xs);
    font-size: .72rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    transition: background var(--ease), transform var(--ease);
}
.prod-buy-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.prod-cart-btn {
    width: 36px; height: 36px; flex-shrink: 0;
    border: 1.5px solid var(--border2);
    border-radius: var(--r-xs);
    background: none; color: var(--txt2);
    font-size: .82rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.prod-cart-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-faint);
}
/* Cart added state */
.prod-cart-btn.added {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Skeleton loader ── */
.cat-skeleton {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    height: 230px;
    animation: catSkelPulse 1.4s ease-in-out infinite;
}
@keyframes catSkelPulse {
    0%,100% { opacity: 1; }
    50%     { opacity: .45; }
}

/* ── Empty state ── */
.cat-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
}
.cat-empty-icon {
    font-size: 3rem;
    color: var(--border2);
    margin-bottom: 12px;
}
.cat-empty h5 {
    font-size: 1rem; font-weight: 800;
    color: var(--txt1); margin-bottom: 5px;
}
.cat-empty p {
    font-size: .78rem; font-weight: 600;
    color: var(--txt3); margin-bottom: 14px;
}
.cat-empty-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 20px;
    border: 1.5px solid var(--primary);
    border-radius: 50px;
    background: none; color: var(--primary);
    font-size: .78rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    transition: background var(--ease), color var(--ease);
}
.cat-empty-btn:hover { background: var(--primary); color: #fff; }

/* ════════════════════════════════
   BOTTOM SHEETS
   ════════════════════════════════ */
.sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    z-index: 1600;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.sheet-backdrop.show { opacity: 1; pointer-events: all; }

.bottom-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 82vh;
    background: var(--bg-white);
    border-radius: 22px 22px 0 0;
    border-top: 1.5px solid var(--border);
    z-index: 1700;
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -8px 32px rgba(0,0,0,.18);
}
.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
    width: 40px; height: 4px;
    border-radius: 4px;
    background: var(--border2);
    margin: 10px auto 0;
    flex-shrink: 0;
}
.sheet-head {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 18px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sheet-title {
    font-size: 1rem; font-weight: 800;
    color: var(--txt1);
}
.sheet-clear {
    background: none; border: none;
    font-size: .78rem; font-weight: 700;
    color: var(--primary); cursor: pointer;
    font-family: inherit;
}
.sheet-body {
    flex: 1; overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sheet-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sheet-apply-btn {
    width: 100%; height: 46px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--r-sm);
    font-size: .9rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 14px rgba(45,140,240,.32);
    transition: background var(--ease);
}
.sheet-apply-btn:hover { background: var(--primary-dark); }

/* ── Filter tabs inside sheet ── */
.filter-tab-row {
    display: flex; gap: 6px;
    padding: 10px 14px 8px;
    overflow-x: auto; flex-shrink: 0;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
}
.filter-tab-row::-webkit-scrollbar { display: none; }

.filter-tab-btn {
    height: 32px; padding: 0 14px;
    border-radius: 50px;
    border: 1.5px solid var(--border2);
    background: none;
    font-size: .74rem; font-weight: 700;
    color: var(--txt2);
    cursor: pointer; white-space: nowrap; flex-shrink: 0;
    font-family: inherit;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.filter-tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Filter option panes ── */
.filter-panes { padding: 0 14px 8px; }
.filter-pane { display: none; padding-top: 8px; }
.filter-pane.active { display: block; }

.filter-check {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: .86rem; font-weight: 600;
    color: var(--txt1);
}
.filter-check:last-child { border-bottom: none; }
.filter-check input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--primary);
    cursor: pointer; flex-shrink: 0;
}

/* ── Sort options ── */
.sort-option {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: .88rem; font-weight: 600;
    color: var(--txt1);
}
.sort-option:last-child { border-bottom: none; }
.sort-option input[type="radio"] {
    width: 18px; height: 18px;
    accent-color: var(--primary);
    cursor: pointer; flex-shrink: 0;
}
.sort-option.selected { color: var(--primary); font-weight: 800; }

/* ── Toast ── */
.cat-toast {
    position: fixed;
    bottom: calc(var(--bnh) + 14px);
    left: 50%; transform: translateX(-50%) translateY(16px);
    background: var(--txt1); color: var(--bg-white);
    padding: 9px 20px;
    border-radius: 50px;
    font-size: .8rem; font-weight: 700;
    white-space: nowrap;
    opacity: 0; pointer-events: none;
    z-index: 2000;
    box-shadow: var(--sh-md);
    transition: opacity .2s ease, transform .2s ease;
    max-width: calc(100vw - 32px);
}
.cat-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cat-toast.success { background: #16a34a; }
.cat-toast.error   { background: #dc2626; }

/* ── Responsive ── */
@media (min-width: 600px) {
    .cat-toolbar  { padding: 12px 0 0; }
    .cat-chips    { padding: 8px 0 0; }
    .cat-results-row { padding: 6px 0 0; }
    .cat-grid     { padding: 10px 0 16px; }
}
