/*
 * ═══════════════════════════════════════════════════════════
 * DTC DESIGN SYSTEM v2.0 — Expert-Level UX/UI Override
 * ═══════════════════════════════════════════════════════════
 * Philosophy: Don Norman (Visibility) · Nielsen (10 Heuristics)
 * Architecture: Hejlsberg (Type Tokens) · Torvalds (Minimal)
 * Visual: Julie Zhuo (Emotional Design) · Modern CSS Grid
 * ═══════════════════════════════════════════════════════════
 */

/* ═══ DESIGN TOKENS ═══ */
:root {
    /* Brand Palette — Chemistry-inspired */
    --dtc-primary: #0f7c78;
    --dtc-primary-dark: #0a5c59;
    --dtc-primary-light: #14b8a6;
    --dtc-primary-glow: rgba(15, 124, 120, 0.12);
    --dtc-primary-surface: rgba(15, 124, 120, 0.06);

    --dtc-accent: #f59e0b;
    --dtc-accent-glow: rgba(245, 158, 11, 0.1);

    /* Neutral Scale */
    --dtc-bg: #f8fafb;
    --dtc-surface: #ffffff;
    --dtc-surface-2: #f1f5f9;
    --dtc-border: #e2e8f0;
    --dtc-border-hover: rgba(15, 124, 120, 0.3);

    /* Text Hierarchy */
    --dtc-text: #0f172a;
    --dtc-text-2: #475569;
    --dtc-text-3: #94a3b8;

    /* Spacing System (4px base) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-2xl: 28px;
    --r-full: 9999px;

    /* Shadows — Multi-layer for depth */
    --sh-xs: 0 1px 2px rgba(0,0,0,0.04);
    --sh-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --sh-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --sh-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --sh-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px rgba(0,0,0,0.03);
    --sh-glow: 0 0 0 3px var(--dtc-primary-glow), var(--sh-lg);

    /* Motion (Zhuo: delightful micro-interactions) */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 0.2s;
    --dur: 0.35s;
    --dur-slow: 0.5s;
}

/* ═══ GLOBAL FOUNDATION ═══ */
body {
    background: var(--dtc-bg) !important;
    color: var(--dtc-text) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* Brand Selection */
::selection { background: var(--dtc-primary); color: #fff; }
::-moz-selection { background: var(--dtc-primary); color: #fff; }

/* Smooth Scroll */
html { scroll-behavior: smooth; }

/* ═══ TOP BAR — Clean, Minimal ═══ */
.top-divider {
    border-bottom: 1px solid var(--dtc-border) !important;
    background: var(--dtc-surface) !important;
}

#top-bar {
    font-size: 0.82rem !important;
    letter-spacing: 0.2px;
}

/* ═══ HEADER — Frosted Glass (Norman: visibility) ═══ */
.header-wrapper {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) saturate(1.8) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.8) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6) !important;
    transition: all var(--dur) var(--ease) !important;
}

.header-main {
    background: transparent !important;
}

/* Logo */
.logo a img,
.header-logo img {
    transition: transform var(--dur) var(--ease-spring) !important;
}
.logo a:hover img,
.header-logo:hover img {
    transform: scale(1.03);
}

/* Navigation Links */
.nav > li > a {
    position: relative !important;
    transition: color var(--dur-fast) !important;
}
.nav > li > a::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 50% !important;
    width: 0 !important;
    height: 2px !important;
    background: var(--dtc-primary) !important;
    transition: width var(--dur) var(--ease), left var(--dur) var(--ease) !important;
    border-radius: 1px !important;
}
.nav > li:hover > a::after,
.nav > li.active > a::after,
.nav > li.current-menu-item > a::after {
    width: 100% !important;
    left: 0 !important;
}
.nav > li:hover > a {
    color: var(--dtc-primary) !important;
}

/* Dropdown Menu */
.nav-dropdown {
    border-radius: var(--r-lg) !important;
    box-shadow: var(--sh-xl) !important;
    border: 1px solid var(--dtc-border) !important;
    overflow: hidden !important;
    animation: dropdown-in var(--dur) var(--ease) !important;
}

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

.nav-dropdown li a {
    transition: background var(--dur-fast), color var(--dur-fast), padding-left var(--dur) !important;
    border-radius: var(--r-sm) !important;
    margin: 2px 6px !important;
}
.nav-dropdown li a:hover {
    background: var(--dtc-primary-surface) !important;
    color: var(--dtc-primary) !important;
    padding-left: 18px !important;
}

/* ═══ SEARCH BAR ═══ */
.searchform input[type="search"],
.search-field {
    border-radius: var(--r-full) !important;
    border: 1.5px solid var(--dtc-border) !important;
    transition: border-color var(--dur), box-shadow var(--dur) !important;
    padding: 10px 20px !important;
}
.searchform input[type="search"]:focus,
.search-field:focus {
    border-color: var(--dtc-primary) !important;
    box-shadow: var(--sh-glow) !important;
    outline: none !important;
}

/* ═══ BANNER / HERO (Zhuo: first impression matters) ═══ */
.ux-banner,
.banner {
    border-radius: var(--r-xl) !important;
    overflow: hidden !important;
}

.banner-inner {
    transition: transform 8s linear !important;
}

/* ═══ SECTION TITLES — Typography Hierarchy ═══ */
.section-title {
    position: relative !important;
    padding-bottom: var(--sp-4) !important;
    margin-bottom: var(--sp-8) !important;
}

.section-title::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 60px !important;
    height: 3px !important;
    background: linear-gradient(90deg, var(--dtc-primary), var(--dtc-primary-light)) !important;
    border-radius: 2px !important;
}

.section-title a {
    color: var(--dtc-text) !important;
    transition: color var(--dur) !important;
}
.section-title a:hover {
    color: var(--dtc-primary) !important;
}

/* ═══ PRODUCT CARDS — Reimagined (Walke: component system) ═══ */
.product-small {
    border-radius: var(--r-lg) !important;
    overflow: hidden !important;
    background: var(--dtc-surface) !important;
    border: 1px solid var(--dtc-border) !important;
    box-shadow: var(--sh-xs) !important;
    transition: transform var(--dur) var(--ease-spring),
                box-shadow var(--dur) var(--ease),
                border-color var(--dur) !important;
}

.product-small:hover {
    transform: translateY(-6px) !important;
    box-shadow: var(--sh-xl) !important;
    border-color: var(--dtc-border-hover) !important;
}

/* Product Image */
.product-small .box-image {
    position: relative !important;
    overflow: hidden !important;
    background: var(--dtc-surface-2) !important;
    aspect-ratio: 1 / 1 !important;
}

.product-small .box-image img {
    transition: transform var(--dur-slow) var(--ease) !important;
    object-fit: cover !important;
}

.product-small:hover .box-image img {
    transform: scale(1.08) !important;
}

/* Product Image Overlay on Hover */
.product-small .box-image::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(to top, rgba(15, 124, 120, 0.08), transparent 50%) !important;
    opacity: 0 !important;
    transition: opacity var(--dur) !important;
    pointer-events: none !important;
    z-index: 1 !important;
}
.product-small:hover .box-image::after {
    opacity: 1 !important;
}

/* Product Text */
.product-small .box-text {
    padding: var(--sp-4) var(--sp-4) var(--sp-5) !important;
}

.product-small .product-title {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    color: var(--dtc-text) !important;
    transition: color var(--dur-fast) !important;
}

.product-small:hover .product-title {
    color: var(--dtc-primary) !important;
}

/* Product Price */
.product-small .price {
    color: var(--dtc-primary-dark) !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
}

/* Add to Cart Button */
.product-small .add_to_cart_button,
.product-small .button {
    background: var(--dtc-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--r-full) !important;
    padding: 8px 18px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    transition: transform var(--dur) var(--ease-spring),
                box-shadow var(--dur),
                background var(--dur-fast) !important;
}

.product-small .add_to_cart_button:hover,
.product-small .button:hover {
    background: var(--dtc-primary-dark) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 16px rgba(15, 124, 120, 0.25) !important;
}

/* Quick View Button */
.quick-view-button,
.quick-view {
    border-radius: var(--r-md) !important;
    transition: all var(--dur) !important;
}

/* Sale Badge */
.badge-container .onsale,
.onsale {
    background: var(--dtc-accent) !important;
    color: #fff !important;
    border-radius: var(--r-full) !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    box-shadow: 0 2px 8px var(--dtc-accent-glow) !important;
}

/* ═══ CATEGORY TABS / PRODUCT CATEGORY GRID ═══ */
.product-category .box-image {
    border-radius: var(--r-xl) !important;
    overflow: hidden !important;
}

.product-category .box-image img {
    transition: transform var(--dur-slow) var(--ease) !important;
}

.product-category:hover .box-image img {
    transform: scale(1.05) !important;
}

.product-category .box-text {
    transition: color var(--dur-fast) !important;
}

.product-category:hover .box-text .category-title {
    color: var(--dtc-primary) !important;
}

/* ═══ SLIDER / CAROUSEL (Nielsen: user control) ═══ */
.flickity-prev-next-button {
    background: var(--dtc-surface) !important;
    border: 1px solid var(--dtc-border) !important;
    box-shadow: var(--sh-md) !important;
    transition: all var(--dur) var(--ease-spring) !important;
    width: 44px !important;
    height: 44px !important;
}

.flickity-prev-next-button:hover {
    background: var(--dtc-primary) !important;
    border-color: var(--dtc-primary) !important;
    color: #fff !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 16px rgba(15, 124, 120, 0.3) !important;
}

.flickity-prev-next-button svg {
    transition: color var(--dur-fast) !important;
}

.flickity-prev-next-button:hover svg {
    fill: #fff !important;
}

/* Pagination Dots */
.flickity-page-dots .dot {
    width: 8px !important;
    height: 8px !important;
    background: var(--dtc-border) !important;
    border-radius: 50% !important;
    transition: all var(--dur) var(--ease-spring) !important;
    opacity: 1 !important;
}

.flickity-page-dots .dot.is-selected {
    background: var(--dtc-primary) !important;
    width: 24px !important;
    border-radius: var(--r-full) !important;
}

/* ═══ ROW / SECTION STYLING ═══ */
.row .col {
    transition: none !important; /* Prevent layout shift */
}

/* Section backgrounds with subtle gradient */
.section-bg {
    transition: background var(--dur) !important;
}

/* UX Builder sections — subtle separation */
[class*="section_"] {
    position: relative;
}

/* ═══ BUTTONS — Premium System ═══ */
.button,
.btn,
a.button,
button.button {
    border-radius: var(--r-full) !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    transition: all var(--dur) var(--ease-spring) !important;
    position: relative !important;
    overflow: hidden !important;
}

.button.primary,
.button.checkout,
.button.alt,
.wc-forward {
    background: var(--dtc-primary) !important;
    color: #fff !important;
    border: none !important;
}

.button.primary:hover,
.button.checkout:hover,
.button.alt:hover,
.wc-forward:hover {
    background: var(--dtc-primary-dark) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(15, 124, 120, 0.3) !important;
}

.button.secondary {
    background: transparent !important;
    border: 2px solid var(--dtc-primary) !important;
    color: var(--dtc-primary) !important;
}

.button.secondary:hover {
    background: var(--dtc-primary) !important;
    color: #fff !important;
}

/* ═══ SIDEBAR WIDGETS ═══ */
.widget {
    background: var(--dtc-surface) !important;
    border: 1px solid var(--dtc-border) !important;
    border-radius: var(--r-lg) !important;
    padding: var(--sp-6) !important;
    margin-bottom: var(--sp-6) !important;
}

.widget-title {
    font-size: 1rem !important;
    color: var(--dtc-text) !important;
    padding-bottom: var(--sp-3) !important;
    border-bottom: 2px solid var(--dtc-primary) !important;
    margin-bottom: var(--sp-4) !important;
}

/* ═══ BREADCRUMBS ═══ */
.breadcrumbs {
    font-size: 0.82rem !important;
    color: var(--dtc-text-3) !important;
}

.breadcrumbs a {
    color: var(--dtc-text-2) !important;
    transition: color var(--dur-fast) !important;
}

.breadcrumbs a:hover {
    color: var(--dtc-primary) !important;
}

/* ═══ FOOTER — Modern, Clean ═══ */
.footer-wrapper {
    background: #0f172a !important;
    color: #cbd5e1 !important;
}

.footer-wrapper .widget-title,
.footer-wrapper h3 {
    color: #f1f5f9 !important;
    position: relative !important;
    padding-bottom: var(--sp-3) !important;
}

.footer-wrapper .widget-title::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 32px !important;
    height: 2px !important;
    background: var(--dtc-primary-light) !important;
    border-radius: 1px !important;
}

.footer-wrapper a {
    color: #94a3b8 !important;
    transition: color var(--dur-fast), padding-left var(--dur) !important;
}

.footer-wrapper a:hover {
    color: var(--dtc-primary-light) !important;
    padding-left: 4px !important;
}

/* Footer Bottom */
.absolute-footer {
    background: #0a0f1a !important;
    border-top: 1px solid rgba(148, 163, 184, 0.1) !important;
    color: #64748b !important;
    font-size: 0.82rem !important;
}

/* ═══ STICKY FOOTER CTA (Mobile) ═══ */
.header-bottom,
.sticky-footer {
    background: var(--dtc-surface) !important;
    border-top: 1px solid var(--dtc-border) !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06) !important;
}

/* ═══ WooCommerce SINGLE PRODUCT ═══ */
.product-info .price {
    font-size: 1.5rem !important;
    color: var(--dtc-primary-dark) !important;
    font-weight: 700 !important;
}

.single_add_to_cart_button {
    background: var(--dtc-primary) !important;
    border-radius: var(--r-full) !important;
    padding: 14px 32px !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    transition: all var(--dur) var(--ease-spring) !important;
}

.single_add_to_cart_button:hover {
    background: var(--dtc-primary-dark) !important;
    transform: scale(1.03) !important;
    box-shadow: 0 8px 24px rgba(15, 124, 120, 0.3) !important;
}

/* Product Tabs */
.woocommerce-tabs .tabs li a {
    border-radius: var(--r-md) var(--r-md) 0 0 !important;
    transition: background var(--dur-fast), color var(--dur-fast) !important;
}

.woocommerce-tabs .tabs li.active a {
    color: var(--dtc-primary) !important;
    border-bottom: 2px solid var(--dtc-primary) !important;
}

/* ═══ CART & CHECKOUT ═══ */
.cart-container .cart-item {
    border-radius: var(--r-md) !important;
    border: 1px solid var(--dtc-border) !important;
    margin-bottom: var(--sp-3) !important;
}

/* ═══ SCROLL TO TOP ═══ */
.back-to-top {
    background: var(--dtc-primary) !important;
    color: #fff !important;
    border-radius: var(--r-full) !important;
    box-shadow: var(--sh-lg) !important;
    transition: all var(--dur) var(--ease-spring) !important;
    width: 44px !important;
    height: 44px !important;
}

.back-to-top:hover {
    background: var(--dtc-primary-dark) !important;
    transform: translateY(-4px) scale(1.1) !important;
    box-shadow: 0 8px 24px rgba(15, 124, 120, 0.3) !important;
}

/* ═══ MOBILE SIDEBAR MENU ═══ */
.mfp-content .nav-sidebar {
    background: var(--dtc-surface) !important;
}

.nav-sidebar li a {
    padding: var(--sp-3) var(--sp-4) !important;
    border-radius: var(--r-sm) !important;
    transition: background var(--dur-fast), color var(--dur-fast) !important;
}

.nav-sidebar li a:hover {
    background: var(--dtc-primary-surface) !important;
    color: var(--dtc-primary) !important;
}

/* ═══ ANIMATIONS ═══ */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Intersection Observer targets */
.product-small,
.ux-banner,
.section-title {
    animation: fade-in-up var(--dur-slow) var(--ease) both;
}

/* ═══ SCROLLBAR (Premium feel) ═══ */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--dtc-bg);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--r-full);
    border: 2px solid var(--dtc-bg);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--dtc-primary);
}

/* ═══ FORM INPUTS ═══ */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
textarea,
select,
.input-text {
    border: 1.5px solid var(--dtc-border) !important;
    border-radius: var(--r-md) !important;
    padding: 10px 14px !important;
    transition: border-color var(--dur), box-shadow var(--dur) !important;
    background: var(--dtc-surface) !important;
}

input:focus,
textarea:focus,
select:focus,
.input-text:focus {
    border-color: var(--dtc-primary) !important;
    box-shadow: 0 0 0 3px var(--dtc-primary-glow) !important;
    outline: none !important;
}

/* ═══ LOADING SKELETON ═══ */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.product-small .box-image:empty {
    background: linear-gradient(90deg, var(--dtc-surface-2) 25%, #e8eef3 50%, var(--dtc-surface-2) 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* ═══ ACCESSIBILITY ═══ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--dtc-primary) !important;
    outline-offset: 2px !important;
    border-radius: var(--r-sm) !important;
}

/* Touch targets — minimum 44x44px (WCAG) */
@media (max-width: 768px) {
    a, button, .button,
    .nav > li > a,
    .nav-sidebar li a {
        min-height: 44px !important;
    }
}

/* ═══ RESPONSIVE GRID FIXES ═══ */
@media (max-width: 849px) {
    .product-small {
        margin-bottom: var(--sp-4) !important;
    }

    .section-title {
        font-size: 1.3rem !important;
    }

    .footer-wrapper .col {
        margin-bottom: var(--sp-8) !important;
    }
}

@media (min-width: 850px) {
    /* Product grid — Modern CSS Grid auto-fill */
    .products .row,
    .product-row {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
        gap: var(--sp-5) !important;
    }

    .products .row .col,
    .product-row .col {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/* ═══ PRINT STYLES ═══ */
@media print {
    .header-wrapper, .footer-wrapper, .sticky-footer,
    .back-to-top, .flickity-prev-next-button { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .product-small { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; }
}
