/* Critical: ensure [hidden] attribute always wins over flex/block display rules */
[hidden] { display: none !important; }

/* ==========================================================================
   DínaCart UI — dc-ui.css  v1.0.0
   Pinterest-inspired, system light/dark, mobile-first responsive
   ========================================================================== */

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --dc-accent:          #e60023;   /* DínaCart red — close to Pinterest red */
    --dc-accent-hover:    #c1001f;
    --dc-accent-soft:     rgba(230, 0, 35, .1);

    /* Surfaces — Light */
    --dc-bg:              #ffffff;
    --dc-surface:         #f8f8f8;
    --dc-surface-hover:   #efefef;
    --dc-border:          #e8e8e8;

    /* Text — Light */
    --dc-text:            #111111;
    --dc-text-muted:      #767676;
    --dc-text-inv:        #ffffff;

    /* Shadows */
    --dc-shadow-sm:       0 1px 4px rgba(0,0,0,.08);
    --dc-shadow-md:       0 4px 16px rgba(0,0,0,.12);
    --dc-shadow-lg:       0 8px 32px rgba(0,0,0,.14);

    /* Layout */
    --dc-header-h:        64px;
    --dc-sidebar-w:       72px;       /* collapsed icon width */
    --dc-sidebar-w-exp:   220px;      /* expanded label width (hover) */
    --dc-mobile-nav-h:    64px;

    /* Motion */
    --dc-ease:            cubic-bezier(.4,0,.2,1);
    --dc-duration:        200ms;

    /* Radius */
    --dc-radius-sm:       8px;
    --dc-radius-md:       16px;
    --dc-radius-pill:     9999px;

    /* Typography */
    --dc-font:            'DM Sans', 'Segoe UI', system-ui, sans-serif;
    --dc-font-mono:       'DM Mono', monospace;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
    :root {
        --dc-bg:            #111111;
        --dc-surface:       #1a1a1a;
        --dc-surface-hover: #242424;
        --dc-border:        #2e2e2e;
        --dc-text:          #f1f1f1;
        --dc-text-muted:    #a0a0a0;
        --dc-shadow-sm:     0 1px 4px rgba(0,0,0,.4);
        --dc-shadow-md:     0 4px 16px rgba(0,0,0,.5);
        --dc-shadow-lg:     0 8px 32px rgba(0,0,0,.6);
    }
}

/* ── Font import (DM Sans — clean, modern, non-generic) ─────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ── Reset guard ────────────────────────────────────────────────────────── */
.dc-header *, .dc-sidenav *, .dc-search * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Body offset — pushes WooCommerce content clear of our chrome ────────── */
body.dc-ui-active {
    font-family: var(--dc-font);
    background-color: var(--dc-bg) !important;
    color: var(--dc-text) !important;
}

/* Also cover the html element — some themes set background on html, not body */
html:has(body.dc-ui-active) {
    background-color: var(--dc-bg) !important;
}

@media (min-width: 769px) {
    body.dc-ui-active {
        padding-top: var(--dc-header-h) !important;
        padding-left: var(--dc-sidebar-w) !important;
    }
}

@media (max-width: 768px) {
    body.dc-ui-active {
        padding-top: var(--dc-header-h) !important;
        padding-bottom: var(--dc-mobile-nav-h) !important;
    }
}

/* ── Hello Elementor theme reset — suppress its header on DC pages ───────── */
body.dc-ui-active .site-header,
body.dc-ui-active .elementor-section-wrap > .elementor-section:first-child .elementor-widget-site-logo {
    display: none !important;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.dc-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--dc-header-h);
    background: var(--dc-bg);
    border-bottom: 1px solid var(--dc-border);
    box-shadow: var(--dc-shadow-sm);
    /* Frosted glass for modern browsers */
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    will-change: transform;
    contain: layout style;
}

.dc-header__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 0 16px;
    max-width: 100%;
}

/* ── Logo / Wordmark ─────────────────────────────────────────────────────── */
.dc-header__logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    flex-shrink: 0;
    color: var(--dc-text);
    transition: opacity var(--dc-duration) var(--dc-ease);
}
.dc-header__logo:hover { opacity: .75; }

.dc-logo__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--dc-accent);
    color: #fff;
    border-radius: var(--dc-radius-sm);
    font-family: var(--dc-font);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: lowercase;
    flex-shrink: 0;
}

/* dc-logo__mark--sm removed */

.dc-logo__word {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -.025em;
    color: var(--dc-text);
    line-height: 1;
    /* Hide wordmark on narrow mobile */
}

@media (max-width: 480px) {
    .dc-logo__word { display: none; }
}

/* ── Header Actions ──────────────────────────────────────────────────────── */
.dc-header__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.dc-header__action {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--dc-radius-pill);
    color: var(--dc-text);
    text-decoration: none;
    transition: background var(--dc-duration) var(--dc-ease),
                color var(--dc-duration) var(--dc-ease);
}
.dc-header__action:hover {
    background: var(--dc-surface-hover);
    color: var(--dc-accent);
}

/* Cart badge */
.dc-cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    background: var(--dc-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
    border-radius: var(--dc-radius-pill);
    pointer-events: none;
    transform-origin: center;
    animation: dc-badge-pop .25s var(--dc-ease);
}
.dc-cart-badge--hidden { display: none; }

@keyframes dc-badge-pop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   SEARCH
   ========================================================================== */
.dc-search {
    flex: 1;
    min-width: 0;
    position: relative;
    max-width: 600px;
}

.dc-search__bar {
    display: flex;
    align-items: center;
    height: 44px;
    background: var(--dc-surface);
    border: 1.5px solid var(--dc-border);
    border-radius: var(--dc-radius-pill);
    padding: 0 12px 0 40px;
    transition: border-color var(--dc-duration) var(--dc-ease),
                box-shadow var(--dc-duration) var(--dc-ease),
                background var(--dc-duration) var(--dc-ease);
    position: relative;
}
.dc-search__bar:focus-within {
    border-color: var(--dc-accent);
    box-shadow: 0 0 0 3px var(--dc-accent-soft);
    background: var(--dc-bg);
}

.dc-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dc-text-muted);
    pointer-events: none;
    display: flex;
}

.dc-search__input {
    flex: 1;
    border: none;
    background: transparent;
    font: 400 14px/1 var(--dc-font);
    color: var(--dc-text);
    outline: none;
    min-width: 0;
}
.dc-search__input::placeholder { color: var(--dc-text-muted); }
.dc-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.dc-search__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--dc-radius-pill);
    background: var(--dc-surface-hover);
    color: var(--dc-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dc-duration) var(--dc-ease);
}
.dc-search__clear:hover { background: var(--dc-border); color: var(--dc-text); }

/* ── Search Dropdown ─────────────────────────────────────────────────────── */
.dc-search__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--dc-bg);
    border: 1px solid var(--dc-border);
    border-radius: var(--dc-radius-md);
    box-shadow: var(--dc-shadow-lg);
    overflow: hidden;
    z-index: 1001;
    animation: dc-dropdown-in .15s var(--dc-ease);
    contain: layout;
}

@keyframes dc-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dc-search__list {
    list-style: none;
}

.dc-search__list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--dc-text);
    border-bottom: 1px solid var(--dc-border);
    transition: background var(--dc-duration) var(--dc-ease);
    cursor: pointer;
}
.dc-search__list-item:last-child { border-bottom: none; }
.dc-search__list-item:hover,
.dc-search__list-item[aria-selected="true"] {
    background: var(--dc-surface);
}
.dc-search__list-item:hover .dc-search__item-title {
    color: var(--dc-accent);
}

.dc-search__item-img {
    width: 44px;
    height: 44px;
    border-radius: var(--dc-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--dc-surface);
}

.dc-search__item-info { flex: 1; min-width: 0; }
.dc-search__item-cat  { font-size: 11px; color: var(--dc-text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-search__item-title{ font-size: 13px; font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dc-text); transition: color var(--dc-duration) var(--dc-ease); }
.dc-search__item-price { font-size: 12px; font-weight: 600; color: var(--dc-accent); flex-shrink: 0; }

.dc-search__footer {
    padding: 10px 16px;
    border-top: 1px solid var(--dc-border);
    text-align: center;
}
.dc-search__footer a {
    font-size: 13px;
    font-weight: 500;
    color: var(--dc-accent);
    text-decoration: none;
}
.dc-search__footer a:hover { text-decoration: underline; }

.dc-search__no-results {
    padding: 20px 16px;
    text-align: center;
    color: var(--dc-text-muted);
    font-size: 13px;
}

/* ── Skeleton Loader ─────────────────────────────────────────────────────── */
@keyframes dc-shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.dc-skel {
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        var(--dc-surface) 0%,
        var(--dc-surface-hover) 50%,
        var(--dc-surface) 100%
    );
    background-size: 600px 100%;
    animation: dc-shimmer 1.4s infinite linear;
}

.dc-skel--img  { width: 44px; height: 44px; border-radius: var(--dc-radius-sm); flex-shrink: 0; }
.dc-skel--line { height: 10px; border-radius: 4px; }
.dc-skel--80   { width: 80%; }
.dc-skel--40   { width: 40%; margin-top: 6px; }

.dc-search__skel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--dc-border);
}
.dc-search__skel-item:last-child { border-bottom: none; }
.dc-skel-text { flex: 1; }

/* ==========================================================================
   SIDE PANEL (Desktop ≥ 769px)
   ========================================================================== */
.dc-sidenav {
    position: fixed;
    top: var(--dc-header-h);
    left: 0;
    bottom: 0;
    width: var(--dc-sidebar-w);
    background: var(--dc-bg);
    border-right: 1px solid var(--dc-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0 24px;
    z-index: 990;
    overflow: hidden;
    transition: width var(--dc-duration) var(--dc-ease),
                box-shadow var(--dc-duration) var(--dc-ease);
    will-change: width;
    contain: layout style;
}

/* Expand on hover — labels slide in */
@media (min-width: 769px) {
    .dc-sidenav:hover {
        width: var(--dc-sidebar-w-exp);
        box-shadow: var(--dc-shadow-md);
    }
    .dc-sidenav:hover .dc-sidenav__label { opacity: 1; max-width: 120px; }
    .dc-sidenav:hover .dc-sidenav__brand { opacity: 1; }
}

.dc-sidenav__brand {
    opacity: 0;
    transition: opacity var(--dc-duration) var(--dc-ease);
    margin-bottom: 16px;
    text-decoration: none;
}

.dc-sidenav__list {
    list-style: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dc-sidenav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--dc-text-muted);
    border-radius: var(--dc-radius-md);
    margin: 0 8px;
    transition: background var(--dc-duration) var(--dc-ease),
                color var(--dc-duration) var(--dc-ease);
    white-space: nowrap;
    position: relative;
}
.dc-sidenav__link:hover {
    background: var(--dc-surface-hover);
    color: var(--dc-text);
}
.dc-sidenav__link--active {
    color: var(--dc-accent);
    background: var(--dc-accent-soft);
}
.dc-sidenav__link--active:hover {
    background: var(--dc-accent-soft);
    color: var(--dc-accent);
}

.dc-sidenav__icon-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.dc-sidenav__badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    background: var(--dc-accent);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: var(--dc-radius-pill);
    pointer-events: none;
}

.dc-sidenav__label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: opacity var(--dc-duration) var(--dc-ease),
                max-width var(--dc-duration) var(--dc-ease);
    pointer-events: none;
}

/* ==========================================================================
   MOBILE BOTTOM NAV  (≤ 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .dc-sidenav {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: var(--dc-mobile-nav-h);
        flex-direction: row;
        align-items: stretch;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--dc-border);
        box-shadow: 0 -2px 12px rgba(0,0,0,.08);
        /* Safe area (iPhone notch) */
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--dc-mobile-nav-h) + env(safe-area-inset-bottom));
    }

    .dc-sidenav__brand { display: none; }

    .dc-sidenav__list {
        flex-direction: row;
        width: 100%;
        gap: 0;
    }

    .dc-sidenav__item {
        flex: 1;
        display: flex;
    }

    .dc-sidenav__link {
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        margin: 0;
        border-radius: 0;
    }

    .dc-sidenav__label {
        opacity: 1;
        max-width: none;
        font-size: 10px;
        font-weight: 500;
        text-align: center;
        pointer-events: auto;
        letter-spacing: .02em;
    }

    .dc-sidenav__link--active .dc-sidenav__label {
        color: var(--dc-accent);
    }
}

/* ==========================================================================
   UTILITY — scroll-lock for open dropdowns
   ========================================================================== */
html.dc-search-open {
    overflow-y: hidden;
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .dc-header, .dc-sidenav, .dc-skel,
    .dc-search__dropdown, .dc-sidenav__link,
    .dc-sidenav__label, .dc-cart-badge {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================================================
   HELLO ELEMENTOR COMPATIBILITY FIXES
   ========================================================================== */

/* 1. Suppress the Hello Elementor default site header on DC pages */
body.dc-ui-active .site-header,
body.dc-ui-active header.entry-header,
body.dc-ui-active .elementor-page-title,
body.dc-ui-active h1.entry-title,
body.dc-ui-active h1.woocommerce-products-header__title,
body.dc-ui-active .woocommerce-products-header {
    display: none !important;
}

/* 2. Remove WooCommerce breadcrumb top spacing that creates a gap */
body.dc-ui-active .woocommerce-breadcrumb {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 3. Prevent Hello Elementor's default .content-area padding conflicting */
body.dc-ui-active #content,
body.dc-ui-active .content-area,
body.dc-ui-active main.site-main,
body.dc-ui-active .site-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 3b. Ensure theme wrapper elements inherit DC's background color so they
       don't render white over dark mode. Covers Hello Elementor, Storefront,
       Astra, OceanWP, and most other common WP themes. */
body.dc-ui-active #page,
body.dc-ui-active .site,
body.dc-ui-active #content,
body.dc-ui-active .content-area,
body.dc-ui-active main.site-main,
body.dc-ui-active .site-content,
body.dc-ui-active #primary,
body.dc-ui-active .woocommerce,
body.dc-ui-active .woocommerce-page,
body.dc-ui-active .elementor-section-wrap,
body.dc-ui-active .e-con-inner {
    background-color: var(--dc-bg) !important;
}

/* 4. Elementor sections inside WC pages — full width */
body.dc-ui-active .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 100% !important;
}

/* 5. WooCommerce default ul.products grid — DISABLE it completely on DC pages.
      Our .dc-masonry replaces it. */
body.dc-ui-active ul.products.columns-1,
body.dc-ui-active ul.products.columns-2,
body.dc-ui-active ul.products.columns-3,
body.dc-ui-active ul.products.columns-4,
body.dc-ui-active ul.products.columns-5,
body.dc-ui-active ul.products {
    display: block !important;
    /* Let our CSS columns masonry take over */
    columns: unset !important;
    grid-template-columns: unset !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* 6. Remove WC's li product wrapper padding (we style .dc-card instead) */
body.dc-ui-active ul.products li.product {
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: auto !important;
    clear: none !important;
}

/* 7. Make the WooCommerce main content region fill available space
      (after our sidebar shifts it) */
body.dc-ui-active #primary,
body.dc-ui-active .woocommerce-page #primary {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

/* 8. Remove default WC sidebar on shop page */
body.dc-ui-active #secondary,
body.dc-ui-active aside.widget-area {
    display: none !important;
}

/* 9. Ensure our header sits above Elementor's sticky header */
.dc-header {
    z-index: 9999 !important;
}
.dc-sidenav {
    z-index: 9990 !important;
}

/* 10. Padding for page content below our fixed header */
body.dc-ui-active .woocommerce,
body.dc-ui-active .woocommerce-page {
    padding-top: 0 !important;
}

/* 11. Single product page — hide the dc-header entirely and remove the
       body padding-top it normally reserves. The .dc-pin layout is
       full-bleed and handles its own topbar (back btn, icons, ATC).
       Scoped to body.single-product so archive/other pages are unaffected. */
body.dc-ui-active.single-product .dc-header {
    display: none !important;
}

@media (min-width: 769px) {
    body.dc-ui-active.single-product {
        padding-top: 0 !important;
    }
}

@media (max-width: 768px) {
    body.dc-ui-active.single-product {
        padding-top: 0 !important;
    }
}
