/* ==========================================================================
   HubvanTech — Public storefront polish layer
   Loaded last on client-facing pages. Purely additive: it refines spacing,
   typography, elevation and responsive behaviour without altering markup.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    --pl-brand: #1d4ed8;
    --pl-brand-ink: #172033;
    --pl-brand-soft: #eff6ff;
    --pl-accent: #dc2626;
    --pl-success: #087f5b;
    --pl-warning: #b45309;
    --pl-ink: #0f172a;
    --pl-body: #475569;
    --pl-muted: #64748b;
    --pl-faint: #94a3b8;
    --pl-line: #e5e7eb;
    --pl-line-soft: #eef2f7;
    --pl-surface: #ffffff;
    --pl-canvas: #f7f8fa;

    --pl-r-sm: 10px;
    --pl-r-md: 14px;
    --pl-r-lg: 18px;
    --pl-r-xl: 24px;

    --pl-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --pl-shadow-sm: 0 2px 8px rgba(15, 23, 42, .05);
    --pl-shadow-md: 0 10px 26px rgba(15, 23, 42, .09);
    --pl-shadow-lg: 0 18px 46px rgba(15, 23, 42, .13);

    --pl-elevated: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .05);
}

/* --------------------------------------------------------------------------
   2. Global polish
   -------------------------------------------------------------------------- */
body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    letter-spacing: -.022em;
    text-wrap: balance;
}

p { text-wrap: pretty; }

/* Visible, consistent keyboard focus across the storefront. */
.site-main a:focus-visible,
.site-header a:focus-visible,
.site-footer a:focus-visible,
.site-main button:focus-visible,
.site-main input:focus-visible,
.site-main select:focus-visible,
.site-main textarea:focus-visible {
    outline: 2px solid var(--pl-brand);
    outline-offset: 2px;
    border-radius: 6px;
}

.skip-link:focus {
    outline: 3px solid var(--pl-brand);
    outline-offset: 3px;
}

/* Section rhythm: alternate tinted bands for scannable page composition. */
.site-main > .section:nth-of-type(even of .section) {
    background: var(--pl-canvas);
}

.site-main > .section {
    border-top: 1px solid var(--pl-line-soft);
}
.site-main > .section:first-of-type {
    border-top: 0;
}

/* --------------------------------------------------------------------------
   3. Section headings
   -------------------------------------------------------------------------- */
.section-head,
.market-section-head,
.flash-sale-head {
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 20px;
}

.section-head h2,
.market-section-head h2,
.flash-sale-head h2 {
    position: relative;
    padding-left: 14px;
    line-height: 1.15;
}

.section-head h2::before,
.market-section-head h2::before,
.flash-sale-head h2::before {
    content: "";
    position: absolute;
    left: 0;
    top: .12em;
    bottom: .12em;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--pl-brand), #38bdf8);
}

.section-head p,
.market-section-head p,
.flash-sale-head p {
    margin-top: 5px;
    color: var(--pl-muted);
}

.section-head .link-all,
.market-section-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border: 1px solid var(--pl-line);
    border-radius: 999px;
    background: var(--pl-surface);
    color: var(--pl-brand);
    font-weight: 800;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.section-head .link-all:hover,
.market-section-link:hover {
    background: var(--pl-brand-soft);
    border-color: #bfdbfe;
    transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   4. Product cards
   -------------------------------------------------------------------------- */
.product-card {
    position: relative;
    border-radius: var(--pl-r-md);
    border-color: var(--pl-line);
    box-shadow: var(--pl-elevated);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: #cbd5e1;
    box-shadow: var(--pl-shadow-md);
}

.product-card:focus-within {
    border-color: #bfdbfe;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}

.product-card .product-img-wrap {
    background: linear-gradient(180deg, #ffffff, #f6f8fb);
    border-bottom: 1px solid var(--pl-line-soft);
}

.product-card .product-body {
    padding: 11px 12px 12px;
}

.product-name {
    color: var(--pl-ink);
    transition: color .16s ease;
}

.product-name:hover {
    color: var(--pl-brand);
}

.product-price-row .price {
    color: var(--pl-ink);
    font-weight: 900;
}

/* Badges: unify discount / stock pills. */
.product-card .badge,
.market-discount,
.flash-sale-badge {
    border-radius: 8px;
    font-weight: 900;
    letter-spacing: .01em;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}

.product-card .badge.out {
    background: var(--pl-ink);
    color: #fff;
}

/* Product actions sit flush to the card bottom for aligned CTAs. */
.product-card .product-actions {
    margin-top: auto;
    padding-top: 10px;
    gap: 7px;
}

.product-card .product-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

/* Wishlist / discount chips. */
.market-card-wishlist {
    transition: transform .16s ease, color .16s ease;
}

.market-card-wishlist:hover {
    transform: scale(1.08);
    color: var(--pl-accent);
}

/* --------------------------------------------------------------------------
   5. Category directory cards
   -------------------------------------------------------------------------- */
.market-category-directory {
    gap: 14px;
}

.market-category-card {
    border-radius: var(--pl-r-md);
    box-shadow: var(--pl-elevated);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.market-category-card:hover {
    transform: translateY(-3px);
    border-color: #bfdbfe;
    box-shadow: var(--pl-shadow-md);
}

.market-category-icon {
    border-radius: var(--pl-r-sm);
}

.market-subcategory-list a:hover {
    background: var(--pl-brand-soft);
}

/* Brand chips. */
.brand-chip {
    border-radius: var(--pl-r-md);
    box-shadow: var(--pl-elevated);
}

.brand-chip:hover {
    box-shadow: var(--pl-shadow-md);
}

/* Seller cards. */
.market-seller-card {
    border-radius: var(--pl-r-md);
    box-shadow: var(--pl-elevated);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.market-seller-card:hover {
    transform: translateY(-3px);
    border-color: #bfdbfe;
    box-shadow: var(--pl-shadow-md);
}

/* --------------------------------------------------------------------------
   6. Page header / breadcrumbs
   -------------------------------------------------------------------------- */
.page-head {
    padding: 30px 0 26px;
    background: linear-gradient(180deg, var(--pl-surface), #fbfcfe);
}

.page-head h1 {
    margin-top: 10px;
    line-height: 1.12;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--pl-faint);
}

.breadcrumb a {
    color: var(--pl-muted);
    font-weight: 700;
    transition: color .16s ease;
}

.breadcrumb a:hover {
    color: var(--pl-brand);
    text-decoration: underline;
}

.breadcrumb .sep {
    color: var(--pl-line);
}

.breadcrumb > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--pl-ink);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   7. Empty states
   -------------------------------------------------------------------------- */
.empty-state {
    padding: 60px 24px;
    border-radius: var(--pl-r-lg);
    border: 1px dashed var(--pl-line);
    background:
        radial-gradient(circle at 50% 0%, rgba(37, 99, 235, .05), transparent 62%),
        var(--pl-surface);
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--pl-muted);
    margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   8. Category browse: sidebar + results
   -------------------------------------------------------------------------- */
.category-browse-layout {
    grid-template-columns: 224px minmax(0, 1fr);
    gap: 22px;
}

.category-sidebar {
    top: 96px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: var(--pl-r-md);
    box-shadow: var(--pl-elevated);
    scrollbar-width: thin;
}

.category-sidebar::-webkit-scrollbar { width: 6px; }
.category-sidebar::-webkit-scrollbar-thumb {
    background: var(--pl-line);
    border-radius: 999px;
}

.category-sidebar-title {
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--pl-ink);
}

.category-sidebar a {
    padding: 9px 10px;
    font-size: 12.5px;
    border-radius: var(--pl-r-sm);
}

.category-sidebar a:hover {
    background: var(--pl-canvas);
    color: var(--pl-ink);
}

.category-sidebar a.active {
    background: var(--pl-brand-soft);
    color: var(--pl-brand);
    box-shadow: inset 2px 0 0 var(--pl-brand);
}

/* Filter toolbar. */
.category-toolbar {
    border-radius: var(--pl-r-md);
    padding: 12px 14px;
    border: 1px solid var(--pl-line);
    box-shadow: var(--pl-elevated);
}

.category-toolbar .form-control {
    min-width: 0;
    border-radius: var(--pl-r-sm);
    border-color: var(--pl-line);
    background: var(--pl-surface);
    color: var(--pl-ink);
}

.category-toolbar .form-control:focus {
    border-color: var(--pl-brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.category-results-head h2 {
    font-size: 19px;
    line-height: 1.2;
}

/* Pagination. */
.catalog-pagination {
    margin: 30px 0 10px;
}

.catalog-page-link {
    border-radius: var(--pl-r-sm);
    box-shadow: var(--pl-shadow-xs);
}

.catalog-page-link.active {
    background: var(--pl-brand);
    border-color: var(--pl-brand);
    box-shadow: 0 6px 16px rgba(37, 99, 235, .26);
}

/* --------------------------------------------------------------------------
   9. Product detail page
   -------------------------------------------------------------------------- */
.pd-wrap {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 44px;
}

.pd-gallery {
    top: 96px;
}

.pd-img {
    border-radius: var(--pl-r-lg);
    border-color: var(--pl-line);
    box-shadow: var(--pl-shadow-md), inset 0 0 0 6px rgba(255, 255, 255, .55);
}

.pd-thumbnail {
    border-radius: var(--pl-r-sm);
    border-color: var(--pl-line);
}

.pd-thumbnail:hover,
.pd-thumbnail.active {
    border-color: var(--pl-brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.pd-cat {
    letter-spacing: .07em;
    font-size: 12px;
    color: var(--pl-brand);
}

.pd-title {
    line-height: 1.13;
    margin: 8px 0 12px;
    color: var(--pl-ink);
}

.pd-brand-line {
    font-size: 13px;
    color: var(--pl-muted);
    margin-bottom: 14px;
}

.pd-brand-line a {
    color: var(--pl-brand);
    font-weight: 800;
}

.pd-brand-line a:hover { text-decoration: underline; }

.pd-price {
    font-size: 34px;
    color: var(--pl-ink);
}

.pd-meta {
    gap: 20px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid var(--pl-line);
    border-radius: var(--pl-r-md);
    background: var(--pl-canvas);
}

.pd-meta div {
    color: var(--pl-muted);
}

.pd-meta b {
    color: var(--pl-ink);
}

/* Quantity stepper and primary actions. */
.qty-box {
    border-radius: var(--pl-r-sm);
    border-color: var(--pl-line);
}

.qty-box button:hover {
    background: var(--pl-brand-soft);
    color: var(--pl-brand);
}

.pd-actions {
    gap: 10px;
}

.pd-actions .btn {
    flex: 1 1 190px;
    justify-content: center;
    min-height: 48px;
}

.flash-product-banner {
    border-radius: var(--pl-r-sm);
}

.pd-save {
    border-radius: 999px;
}

/* Product tabs. */
.product-tabs {
    gap: 4px;
    border-bottom-color: var(--pl-line);
}

.product-tabs button {
    border-radius: var(--pl-r-sm) var(--pl-r-sm) 0 0;
    color: var(--pl-muted);
    transition: color .16s ease, background .16s ease;
}

.product-tabs button:hover {
    background: var(--pl-canvas);
    color: var(--pl-brand);
}

.product-details-grid div {
    background: var(--pl-canvas);
    border-radius: var(--pl-r-sm);
}

/* --------------------------------------------------------------------------
   10. Cart & checkout
   -------------------------------------------------------------------------- */
.cart-layout {
    grid-template-columns: minmax(0, 1fr) 352px;
    gap: 26px;
}

.cart-list {
    gap: 14px;
}

.cart-item {
    align-items: center;
    border-radius: var(--pl-r-md);
    box-shadow: var(--pl-elevated);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.cart-item:hover {
    border-color: #cbd5e1;
    box-shadow: var(--pl-shadow-sm);
}

.cart-item-img {
    border-radius: var(--pl-r-sm);
    border: 1px solid var(--pl-line-soft);
}

.cart-item-name {
    color: var(--pl-ink);
}

.cart-item-name:hover { color: var(--pl-brand); }

.cart-qty {
    border: 1px solid var(--pl-line);
    border-radius: var(--pl-r-sm);
    padding: 3px;
    gap: 2px;
}

.cart-qty button {
    border: 0;
    border-radius: 7px;
}

.cart-qty button:hover {
    background: var(--pl-brand-soft);
    color: var(--pl-brand);
}

.cart-item-total {
    font-size: 17px;
    color: var(--pl-ink);
}

.cart-summary {
    top: 96px;
    border-radius: var(--pl-r-lg);
    padding: 24px;
    box-shadow: var(--pl-shadow-md);
}

.cart-summary h3 {
    font-size: 18px;
    letter-spacing: -.01em;
}

.sum-row {
    padding: 10px 0;
}

.sum-row.total {
    border-top-color: var(--pl-line);
    margin-top: 12px;
    padding-top: 16px;
}

.sum-row.total span:last-child {
    color: var(--pl-brand);
}

.cart-summary .btn-block {
    min-height: 48px;
    margin-top: 18px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--pl-r-sm);
}

.checkout-layout {
    gap: 26px;
}

.checkout-layout .form-card,
.checkout-layout .cart-summary {
    border-radius: var(--pl-r-lg);
    box-shadow: var(--pl-shadow-md);
}

/* --------------------------------------------------------------------------
   11. Trust strips & footer
   -------------------------------------------------------------------------- */
.store-trust-grid,
.market-trust-grid {
    gap: 1px;
}

.store-trust-item,
.market-trust-item {
    background: var(--pl-surface);
    transition: background .18s ease;
}

.store-trust-item:hover {
    background: var(--pl-brand-soft);
}

.store-trust-icon {
    background: var(--pl-brand-soft);
    color: var(--pl-brand);
}

.site-footer {
    background: var(--pl-ink);
    color: #cbd5e1;
    border-top: 0;
}

.site-footer h4 {
    color: #fff;
    font-size: 13px;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.site-footer a {
    color: #cbd5e1;
    transition: color .16s ease;
}

.site-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.site-footer .whatsapp-footer-link {
    color: #4ade80 !important;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1);
    color: var(--pl-faint);
}

/* --------------------------------------------------------------------------
   12. Floating affordances
   -------------------------------------------------------------------------- */
.whatsapp-fab,
.chat-fab {
    box-shadow: var(--pl-shadow-md);
}

.whatsapp-fab:hover,
.chat-fab:hover {
    box-shadow: var(--pl-shadow-lg);
}

/* Support link bar that previously used inline styling. */
.site-main ~ div > div > a[href*="support-ticket"],
.site-main ~ div > a[href*="support-ticket"] {
    border-radius: var(--pl-r-md);
}

/* --------------------------------------------------------------------------
   13. Responsive refinements
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .pd-wrap {
        gap: 32px;
    }

    .cart-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }
}

@media (max-width: 900px) {
    .category-browse-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .category-sidebar {
        position: static;
        max-height: none;
    }

    .pd-gallery,
    .cart-summary {
        position: static;
    }

    .pd-wrap,
    .cart-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .pd-actions .btn {
        flex: 1 1 100%;
    }
}

@media (max-width: 640px) {
    .section-head,
    .market-section-head,
    .flash-sale-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 16px;
    }

    .section-head h2::before,
    .market-section-head h2::before,
    .flash-sale-head h2::before {
        display: none;
    }

    .section-head h2,
    .market-section-head h2,
    .flash-sale-head h2 {
        padding-left: 0;
    }

    .page-head {
        padding: 22px 0 20px;
    }

    .cart-item {
        flex-wrap: wrap;
        gap: 12px;
    }

    .cart-item-total {
        text-align: left;
        min-width: 0;
    }

    .cart-summary {
        padding: 20px;
    }
}

/* --------------------------------------------------------------------------
   14. Motion & print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .product-card:hover,
    .market-category-card:hover,
    .brand-chip:hover,
    .market-seller-card:hover,
    .section-head .link-all:hover,
    .market-section-link:hover {
        transform: none;
    }
}

@media print {
    .site-header,
    .site-footer,
    .mobile-bottom-nav,
    .whatsapp-fab,
    .chat-widget,
    .catalog-pagination {
        display: none !important;
    }
}