/*
Theme Name: CDE Online
Theme URI: https://cdeonline.com.au/
Author: CDE Online Electrical & Telecommunications
Author URI: https://cdeonline.com.au/
Description: Complete, modern, high-conversion WooCommerce theme built for CDE Online (Communication, Data, Electrical). Built specifically for Australian electrical and civil telecom supply contractors with AUD pricing, Australian GST support, instant parts selector, Customizer controls, and Stripe gateway compatibility.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cde-online
Tags: e-commerce, custom-colors, custom-header, custom-menu, featured-images, full-width-template, theme-options, translation-ready, woocommerce
*/

/* CSS Reset & Responsive Base */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --cde-blue: #003399;
    --cde-blue-dark: #002266;
    --cde-orange: #FF5500;
    --cde-orange-hover: #E04B00;
    --cde-yellow: #FFC000;
    --cde-gray-bg: #F8F9FA;
    --cde-gray-border: #E5E7EB;
    --cde-text-dark: #111827;
    --cde-text-muted: #6B7280;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--cde-text-dark);
    background-color: #ffffff;
    line-height: 1.5;
}

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

a {
    color: var(--cde-blue);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}
a:hover {
    color: var(--cde-orange);
}

.cde-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header & Top Bar */
.cde-top-bar {
    background-color: #111827;
    color: #D1D5DB;
    font-size: 0.8125rem;
    padding: 0.4rem 0;
}
.cde-top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.cde-header-main {
    padding: 1rem 0;
    border-bottom: 1px solid var(--cde-gray-border);
}
.cde-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.cde-logo img {
    max-height: 55px;
    width: auto;
}
.cde-search-form {
    flex: 1;
    min-width: 280px;
    max-width: 650px;
    display: flex;
}
.cde-search-input {
    flex: 1;
    border: 2px solid var(--cde-blue);
    border-right: none;
    padding: 0.65rem 1rem;
    border-radius: 6px 0 0 6px;
    font-size: 0.95rem;
    outline: none;
    min-width: 0;
}
.cde-search-btn {
    background-color: var(--cde-orange);
    color: #ffffff;
    border: 2px solid var(--cde-orange);
    padding: 0.65rem 1.5rem;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.cde-search-btn:hover {
    background-color: var(--cde-orange-hover);
}

/* Navigation Bar */
.cde-nav-bar {
    background-color: var(--cde-blue);
    color: #ffffff;
}
.cde-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.cde-category-btn {
    background-color: var(--cde-yellow);
    color: #111827;
    font-weight: 800;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    font-size: 0.8125rem;
    white-space: nowrap;
}
.cde-nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.cde-nav-menu a {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    display: block;
}
.cde-nav-menu a:hover {
    color: var(--cde-yellow);
}

/* Responsive Hero & Quick Parts Finder */
.cde-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 2rem;
    align-items: center;
}
.cde-parts-selector-box {
    background: #ffffff;
    color: #111827;
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
    width: 100%;
}
.cde-parts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* Promotional Cards */
.cde-promo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}
.cde-promo-card {
    background: #ffffff;
    border: 1px solid var(--cde-gray-border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

/* Product Cards Grid */
.cde-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}
.cde-product-card {
    border: 1px solid var(--cde-gray-border);
    border-radius: 10px;
    padding: 1rem;
    background: #ffffff;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.cde-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}
.cde-product-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background-color: #fafafa;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}
.cde-product-sku {
    font-size: 0.75rem;
    color: var(--cde-text-muted);
    font-family: monospace;
    font-weight: bold;
}
.cde-product-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0.35rem 0;
    line-height: 1.35;
    flex: 1;
}
.cde-product-price {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--cde-blue);
    margin: 0.5rem 0;
}
.cde-gst-suffix {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--cde-text-muted);
}
.cde-add-to-cart-btn {
    background-color: var(--cde-orange);
    color: #ffffff;
    border: none;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    display: block;
    width: 100%;
    transition: background-color 0.15s;
}
.cde-add-to-cart-btn:hover {
    background-color: var(--cde-orange-hover);
    color: #ffffff;
}

/* Trust Bar */
.cde-trust-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    text-align: center;
}

/* Footer */
.cde-footer {
    background-color: #0f172a;
    color: #94a3b8;
    padding: 3.5rem 0 1.5rem;
    margin-top: 4rem;
}
.cde-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}
.cde-footer h4 {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cde-footer a {
    color: #94a3b8;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.cde-footer a:hover {
    color: #ffffff;
}

/* Sidebar & WooCommerce Layout */
.cde-shop-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
}
.cde-shop-sidebar {
    background: #ffffff;
    border: 1px solid var(--cde-gray-border);
    border-radius: 8px;
    padding: 1.25rem;
}
.cde-widget {
    margin-bottom: 2rem;
}
.cde-widget-title {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    border-bottom: 2px solid var(--cde-blue);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Post Loops & Comments */
.cde-post-entry {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--cde-gray-border);
}
.cde-pagination {
    margin: 2rem 0;
    display: flex;
    gap: 0.5rem;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE QUERIES (Eliminates 390px overflow)
   ========================================================================== */
@media (max-width: 1024px) {
    .cde-hero-grid {
        grid-template-columns: 1fr;
    }
    .cde-trust-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cde-promo-grid {
        grid-template-columns: 1fr;
    }
    .cde-shop-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cde-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .cde-search-form {
        max-width: 100%;
        width: 100%;
    }
    .cde-nav-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .cde-category-btn {
        width: 100%;
        justify-content: center;
    }
    .cde-nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 0;
    }
    .cde-parts-row {
        grid-template-columns: 1fr;
    }
    .cde-trust-grid {
        grid-template-columns: 1fr;
    }
    .cde-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    .cde-product-card {
        padding: 0.75rem;
    }
    .cde-product-title {
        font-size: 0.85rem;
    }
    .cde-product-price {
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .cde-top-bar-inner {
        flex-direction: column;
        text-align: center;
    }
    .cde-product-grid {
        grid-template-columns: 1fr;
    }
}
