/* =====================================================
   Cape Water Tech -- Store Stylesheet (V2)
   Aligned with main site design language
   Includes: New color palette, DM Serif Display fonts,
   dark navy buttons, card hover effects, logo styling,
   complete footer styles, cart icon, and main site link
   ===================================================== */

:root {
    /* Main site color palette */
    --water-deep: #0a2236;
    --water-mid: #0e3a5a;
    --water-bright: #1a6fa8;
    --water-light: #4db8e8;
    --water-pale: #e6f4fb;
    --mineral: #2a9d6e;
    --mineral-light: #e1f5ee;
    --warning: #e07b39;
    --warning-light: #fdf0e6;
    
    /* Text colors */
    --text-dark: #0f1a22;
    --text-mid: #2c4454;
    --text-muted: #5a7a8a;
    
    /* Surfaces */
    --surface: #ffffff;
    --surface-alt: #f2f7fb;;  /* ← FIXED: Warm light grey */
    --border: #cbdde6;
    
    /* Typography */
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing & effects */
    --radius: 8px;
    --radius-lg: 18px;
    --shadow: 0 2px 16px rgba(10,34,54,0.09);
    --max-width: 1180px;

    /* ---------------------------------------------------------
       Admin-panel aliases -- admin.css references these variable
       names (--ink, --slate, --line, --white, --bg, --accent,
       --accent-dark, --slate-pale, --copper), but they were never
       defined here, so every admin.css rule using them was
       silently falling back to nothing (badges, table shading,
       form borders, etc. rendering without their intended colors).
       These just point the missing names at tokens that already
       exist above -- purely additive, doesn't change any existing
       variable or any storefront rule.
       --------------------------------------------------------- */
    --ink: var(--text-dark);
    --slate: var(--text-muted);
    --slate-pale: var(--surface-alt);
    --line: var(--border);
    --white: var(--surface);
    --bg: var(--surface-alt);
    --accent: var(--water-bright);
    --accent-dark: var(--mineral);
    --copper: var(--warning);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--surface-alt);  /* ← FIXED: Uses variable instead of hardcoded */
    color: var(--text-mid);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--text-dark);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.5em;
}

a {
    color: var(--water-bright);
    text-decoration: none;
}
a:hover { 
    color: var(--water-deep);
    text-decoration: underline; 
}

img { max-width: 100%; display: block; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--water-bright);
    outline-offset: 2px;
    border-radius: 4px;
}

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

/* ---------------------------------------------------
   Header / top bar
   --------------------------------------------------- */
.site-header {
    background: var(--water-deep);
    color: var(--surface);
    border-bottom: 3px solid var(--water-bright);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    max-width: var(--max-width);
    margin: 0 auto;
    gap: 24px;
}

/* ===== LOGO STYLES ===== */
.site-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--surface);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
}
.site-header__brand:hover { text-decoration: none; }

.site-logo-img {
    height: 40px;
    width: 40px;
    object-fit: contain;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.brand-wrapper {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

.text-white {
    color: #ffffff;
}

.tech-blue {
    color: var(--water-light);  /* #4db8e8 */
}

/* ---------------------------------------------------
   Header Actions - Main Site Link + Cart with Icon
   --------------------------------------------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Main Site Link */
.main-site-link {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.main-site-link:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
    text-decoration: none;
}

/* Cart Button with Icon */
.site-header__cart {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--water-bright);
    color: var(--surface);
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
}
.site-header__cart:hover {
    background: var(--water-mid);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Cart Icon SVG */
.cart-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Cart Count Badge */
.cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: var(--water-deep);
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    line-height: 1;
    margin-left: 2px;
}
.cart-count:empty {
    display: none;
}

/* Mobile responsive for header actions */
@media (max-width: 600px) {
    .header-actions {
        gap: 8px;
    }
    .main-site-link {
        font-size: 0.7rem;
        padding: 4px 10px;
    }
    .site-header__cart {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    .cart-icon {
        width: 16px;
        height: 16px;
    }
    .cart-count {
        font-size: 0.6rem;
        min-width: 16px;
        height: 16px;
    }
}

/* Mobile responsive for logo */
@media (max-width: 480px) {
    .site-header__brand {
        font-size: 1.1rem;
        gap: 8px;
    }
    .site-logo-img {
        height: 32px;
        width: 32px;
    }
}

/* ---------------------------------------------------
   Schematic category nav
   --------------------------------------------------- */
.schematic-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.schematic-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.schematic-nav__item {
    position: relative;
}

.schematic-nav__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: var(--text-dark);
    font-size: 0.92rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}
.schematic-nav__link:hover,
.schematic-nav__link[aria-current="page"] {
    border-bottom-color: var(--water-bright);
    color: var(--water-bright);
    text-decoration: none;
}

.schematic-nav__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--water-bright);
    flex-shrink: 0;
}

.schematic-nav details { position: relative; }
.schematic-nav summary {
    list-style: none;
    cursor: pointer;
}
.schematic-nav summary::-webkit-details-marker { display: none; }

.schematic-nav__caret {
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--text-mid);
    border-bottom: 2px solid var(--text-mid);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
    margin-left: 2px;
}
details[open] .schematic-nav__caret { transform: rotate(-135deg); }

.schematic-nav__subpanel {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--water-bright);
    min-width: 240px;
    padding: 8px 0;
    box-shadow: var(--shadow);
    z-index: 20;
}

.schematic-nav__subpanel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--text-mid);
    font-size: 0.88rem;
    font-weight: 500;
}
.schematic-nav__subpanel a:hover {
    background: var(--water-pale);
    color: var(--text-dark);
    text-decoration: none;
}
.schematic-nav__subpanel a::before {
    content: '';
    width: 14px;
    height: 1px;
    background: var(--border);
    flex-shrink: 0;
}

/* ---------------------------------------------------
   Hero
   --------------------------------------------------- */
.hero {
    background: linear-gradient(135deg, var(--water-deep) 0%, #0c3050 60%, #0e4a7a 100%);
    color: var(--surface);
    padding: 64px 24px 56px;
}
.hero__inner {
    max-width: var(--max-width);
    margin: 0 auto;
}
.hero__eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--water-light);
    margin-bottom: 14px;
}
.hero h1 {
    color: var(--surface);
    font-size: clamp(2rem, 4.5vw, 3.1rem);
    max-width: 16ch;
    margin-bottom: 18px;
}
.hero p {
    max-width: 52ch;
    color: rgba(255,255,255,0.82);
    font-size: 1.08rem;
    margin: 0 0 28px;
}

/* ---------------------------------------------------
   Buttons - Main site style
   --------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--water-deep);
    color: var(--surface);
}
.btn-primary:hover {
    background: var(--water-bright);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-copper {
    background: var(--warning);
    color: var(--surface);
}
.btn-copper:hover {
    background: #c96a30;
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-dark);
}
.btn-outline:hover {
    border-color: var(--water-bright);
    color: var(--water-bright);
    text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------
   Section headers
   --------------------------------------------------- */
.section { 
    padding: 56px 24px; 
    background: var(--surface);
}
.section.alt {
    background: var(--surface-alt);  /* ← Now uses #edf2f7 */
}

.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}
.section__head h2 { 
    font-size: 1.7rem; 
    margin: 0; 
}
.section__head .eyebrow {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--water-bright);
    display: block;
    margin-bottom: 6px;
}

/* ---------------------------------------------------
   Category cards (homepage)
   --------------------------------------------------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: var(--max-width);
    margin: 0 auto;
}
.category-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 22px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}
.category-card:hover {
    border-color: var(--water-bright);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.category-card h3 {
    font-size: 1.18rem;
    margin-bottom: 8px;
}
.category-card p {
    font-size: 0.92rem;
    color: var(--text-mid);
    margin: 0 0 16px;
}
.category-card a.cat-link {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--water-bright);
}

/* ---------------------------------------------------
   Product grid + cards - Enhanced like main site
   --------------------------------------------------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 22px;
    max-width: var(--max-width);
    margin: 0 auto;
    align-items: stretch;
}

.product-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    position: relative;
    padding: 14px 0 0;
    overflow: hidden;
    min-width: 0;
}
.product-card:hover {
    border-color: var(--water-bright);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Featured product badge */
.product-card.featured {
    border-color: var(--water-bright);
    border-width: 2px;
    padding-top: 32px;
}
.product-card.featured::before {
    content: 'Most popular';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--water-bright);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 14px;
    border-radius: 20px;
    white-space: nowrap;
    z-index: 2;
}

.product-card__image {
    aspect-ratio: 4 / 3;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 12px;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .product-card__image img {
        padding: 8px;
    }
}

.product-card__body {
    padding: 18px 16px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.product-card__sku {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--water-bright);
    margin-bottom: 6px;
}

.product-card__name {
    font-family: var(--font-display);
    font-size: 1.02rem;
    color: var(--text-dark);
    margin: 0 0 8px;
    line-height: 1.3;
}
.product-card__name a { color: inherit; }
.product-card__name a:hover { 
    color: var(--water-bright); 
    text-decoration: none;
}

.product-card__desc {
    font-size: 0.86rem;
    color: var(--text-mid);
    margin: 0 0 14px;
    flex: 1;
    line-height: 1.5;
}

.spec-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border);
    padding-top: 10px;
    margin-bottom: 12px;
}
.spec-strip span { display: flex; align-items: center; gap: 4px; }
.spec-strip b { color: var(--text-dark); font-weight: 700; }

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    flex-wrap: wrap;
    min-width: 0;
}

.price {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--warning);
    min-width: 0;
}
.price small {
    font-family: var(--font-body);
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stock-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.stock-badge--in { background: var(--mineral-light); color: var(--mineral); }
.stock-badge--low { background: var(--warning-light); color: var(--warning); }
.stock-badge--out { background: #f5e6e6; color: #a14040; }

/* ---------------------------------------------------
   "Add to Cart" buttons - Dark navy style from main site
   --------------------------------------------------- */
.btn-add {
    width: 100%;
    padding: 10px 20px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
    margin-top: 12px;
    text-align: center;
    display: inline-block;
}
.btn-add:hover {
    background: var(--water-bright);
    transform: translateY(-1px);
    text-decoration: none;
}

/* ---------------------------------------------------
   Product detail page
   --------------------------------------------------- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 48px 24px;
}
@media (max-width: 800px) {
    .product-detail { grid-template-columns: 1fr; gap: 32px; padding: 32px 24px; }
}

.product-detail__image {
    background: #ffffff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--water-bright); }
.breadcrumb .sep { margin: 0 6px; color: var(--border); }

.product-detail__sku {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--water-bright);
    margin-bottom: 10px;
}

.product-detail h1 {
    font-size: 1.9rem;
    margin-bottom: 14px;
}

.product-detail__price {
    font-family: var(--font-display);
    font-size: 1.9rem;
    color: var(--warning);
    font-weight: 600;
    margin-bottom: 18px;
}
.product-detail__price small {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 8px;
}

.product-detail__desc {
    font-size: 0.98rem;
    color: var(--text-mid);
    margin-bottom: 24px;
    line-height: 1.6;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 26px;
    font-size: 0.88rem;
}
.spec-table tr { border-bottom: 1px solid var(--border); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table th, .spec-table td {
    text-align: left;
    padding: 9px 0;
}
.spec-table th {
    color: var(--text-dark);
    font-weight: 600;
    width: 40%;
}
.spec-table td { color: var(--text-mid); }

.variant-selector {
    margin-bottom: 22px;
}
.variant-selector label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}
.variant-selector select {
    width: 100%;
    max-width: 360px;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: var(--font-body);
    color: var(--text-dark);
    background: var(--surface);
}
.variant-selector select:focus { 
    border-color: var(--water-bright); 
    outline: none; 
}

.qty-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.qty-input {
    width: 70px;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    text-align: center;
}

.add-to-cart-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------
   Footer - Matches main site design
   --------------------------------------------------- */
.site-footer { 
    background: var(--surface-alt); 
    border-top: 1px solid var(--border); 
    padding: 40px 60px 24px; 
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 32px; 
    max-width: var(--max-width);
    margin: 0 auto;
    box-sizing: border-box;
}
.footer-col {
    flex: 0 1 auto;
    min-width: 220px;
    max-width: 320px;
}

.footer-col h4 { 
    font-family: var(--font-display); 
    font-size: 18px; 
    margin-bottom: 16px; 
    color: var(--water-deep); 
}

.footer-col ul { 
    list-style: none; 
    padding: 0;
    margin: 0;
}

.footer-col ul li { 
    margin-bottom: 10px; 
    font-size: 14px; 
    color: var(--text-mid); 
}

.footer-col a { 
    color: var(--text-mid); 
    text-decoration: none; 
}

.footer-col a:hover { 
    color: var(--water-bright); 
}

.social-icons { 
    display: flex; 
    gap: 12px; 
    margin-top: 16px; 
    flex-wrap: wrap; 
}

.social-icons a img { 
    width: 28px; 
    height: 28px; 
    transition: transform 0.2s; 
}

.social-icons a:hover img { 
    transform: scale(1.1); 
}

.footer-bottom { 
    text-align: center; 
    padding: 24px 60px 32px; 
    font-size: 12px; 
    color: var(--text-muted); 
    border-top: 1px solid var(--border); 
    background: var(--surface-alt); 
}

.btn-whatsapp { 
    background-color: #25D366; 
    color: white; 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    padding: 0.5rem 1rem; 
    border-radius: 8px; 
    font-weight: 600; 
    font-size: 0.85rem; 
    text-decoration: none; 
    transition: background 0.2s, transform 0.15s; 
}

.btn-whatsapp:hover { 
    background-color: #128C7E; 
    transform: translateY(-2px); 
    color: white; 
    text-decoration: none;
}

/* Mobile responsive for footer */
@media (max-width: 768px) {
    .site-footer { 
        padding: 30px 20px; 
    }
    .footer-bottom { 
        padding: 20px 20px; 
    }
}

/* ---------------------------------------------------
   Utility
   --------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}
.empty-state h3 { margin-bottom: 8px; }

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--water-bright);
    color: var(--surface);
    padding: 10px 16px;
    z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Breadcrumb */
.breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--water-bright); }
.breadcrumb .sep { margin: 0 6px; color: var(--border); }