/**
 * FD Stamps Custom Design System
 * Modern Professional Theme for Stamp Collection Store
 * Version: 1.0.0
 */

/* ========================================
   1. CSS Variables & Design Tokens
   ======================================== */
:root {
    /* Primary Colors - Adjusted for stamp collecting theme */
    --primary: #2C5282;      /* Deep blue for trust and heritage */
    --primary-dark: #1A365D;
    --primary-light: #3182CE;
    --secondary: #D69E2E;    /* Gold for premium feel */
    --secondary-dark: #B7791F;
    --success: #38A169;
    --warning: #ED8936;
    --danger: #E53E3E;
    
    /* Neutral Colors */
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7FAFC;
    --bg-tertiary: #EDF2F7;
    --border: #E2E8F0;
    --border-dark: #CBD5E0;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 6px 10px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    
    /* Transitions */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   2. Typography System
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@400;700&display=swap');

body {
    font-family: var(--font-primary);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.site-title,
.widget-title {
    font-family: var(--font-serif);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1, .alpha { 
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2, .beta { 
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}

h3, .gamma { 
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
}

/* ========================================
   3. Header Redesign
   ======================================== */
.site-header {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.site-branding .site-title {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.site-branding .site-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    display: block;
}

/* Navigation Enhancement */
.main-navigation ul li a {
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.main-navigation ul li a:hover {
    color: var(--primary);
}

.main-navigation ul li.current-menu-item > a,
.main-navigation ul li.current_page_item > a {
    color: var(--primary);
}

.main-navigation ul li.current-menu-item > a::after,
.main-navigation ul li.current_page_item > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1em;
    right: 1em;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-sm);
}

/* ========================================
   4. Hero Section for Stamps
   ======================================== */
.hero-section,
.storefront-hero {
    background: linear-gradient(135deg, #2C5282 0%, #D69E2E 100%);
    position: relative;
    padding: 6rem 2rem;
    margin-bottom: 4rem;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-section h1 {
    color: white;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease-out;
}

.hero-section p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.25rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* ========================================
   5. Button Redesign
   ======================================== */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.button,
.wp-block-button__link,
.added_to_cart,
.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-md);
    display: inline-block;
    text-decoration: none;
}

button:hover,
input[type="button"]:hover,
.button:hover,
.added_to_cart:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
}

/* ========================================
   6. Product Cards for Stamps
   ======================================== */
.products .product,
.type-product {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: var(--transition-base);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.products .product:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--secondary);
}

.products .product .price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
}

/* Stamp-specific product styling */
.products .product img {
    border-radius: var(--radius-md);
    transition: var(--transition-base);
}

.products .product:hover img {
    transform: scale(1.05);
}

/* ========================================
   7. Cart Display Fix
   ======================================== */
.site-header-cart {
    display: block !important;
}

.site-header-cart .cart-contents {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white !important;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: var(--transition-fast);
}

.site-header-cart .cart-contents:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Add cart icon */
.site-header-cart .cart-contents::before {
    content: "🛒";
    font-size: 1.2rem;
}

/* Hide duplicate carts */
.site-header-cart + .site-header-cart,
.site-header .site-header-cart:not(:first-of-type) {
    display: none !important;
}

/* ========================================
   8. Form Styling
   ======================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: var(--transition-fast);
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
    background: white;
}

/* ========================================
   9. Footer Enhancement
   ======================================== */
.site-footer {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-top: 1px solid var(--border);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-widgets .widget {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.footer-widgets .widget-title {
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* ========================================
   10. Mobile Navigation
   ======================================== */
@media (max-width: 768px) {
    .main-navigation.toggled {
        background: white;
        box-shadow: var(--shadow-xl);
        border-radius: var(--radius-lg);
        margin-top: 1rem;
    }
    
    .main-navigation.toggled ul li a {
        padding: 1rem;
        border-bottom: 1px solid var(--border);
    }
    
    .main-navigation.toggled ul li a:hover {
        background: var(--bg-secondary);
        padding-left: 1.5rem;
    }
}

/* ========================================
   11. Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========================================
   12. WooCommerce Overrides
   ======================================== */
.woocommerce-message,
.woocommerce-info {
    background: linear-gradient(135deg, #EBF8FF 0%, #E6FFFA 100%);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
}

.woocommerce-error {
    background: linear-gradient(135deg, #FFF5F5 0%, #FED7D7 100%);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-md);
}

/* Breadcrumbs */
.woocommerce-breadcrumb {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin: 2rem 0;
    box-shadow: var(--shadow-sm);
}

.woocommerce-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.woocommerce-breadcrumb a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ========================================
   13. Stamp Collection Specific
   ======================================== */
.stamp-category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--secondary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.stamp-condition {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.stamp-year {
    color: var(--text-secondary);
    font-weight: 600;
    font-family: var(--font-serif);
}

/* ========================================
   14. Responsive Design
   ======================================== */
@media (max-width: 768px) {
    h1, .alpha {
        font-size: 2rem;
    }
    
    h2, .beta {
        font-size: 1.5rem;
    }
    
    .hero-section {
        padding: 4rem 1rem;
    }
    
    .products {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   15. Utility Classes
   ======================================== */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.bg-primary { background-color: var(--primary); }
.bg-white { background-color: white; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }

/* ========================================
   16. Layout Fixes for Sidebar & Content
   ======================================== */
/* Fix for WooCommerce sidebar layout */
.right-sidebar .content-area,
.left-sidebar .content-area {
    width: 100%;
    float: none;
    margin-right: 0;
}

.widget-area {
    width: 100%;
    float: none;
    margin-left: 0;
}

@media (min-width: 768px) {
    .right-sidebar .content-area {
        width: 73.9130434783%;
        float: left;
        margin-right: 4.347826087%;
    }
    
    .right-sidebar .widget-area {
        width: 21.7391304348%;
        float: right;
        margin-right: 0;
    }
    
    .left-sidebar .content-area {
        width: 73.9130434783%;
        float: right;
        margin-right: 0;
    }
    
    .left-sidebar .widget-area {
        width: 21.7391304348%;
        float: left;
        margin-right: 4.347826087%;
    }
}

/* Fix header cart positioning */
.site-header-cart {
    float: right;
    margin-left: auto;
}

/* Fix product grid spacing */
ul.products {
    margin-left: 0;
    clear: both;
}

ul.products li.product {
    margin-right: 3.8%;
    margin-bottom: 2.992em;
}

ul.products li.product.last {
    margin-right: 0;
}

/* Ensure proper column widths */
ul.products.columns-3 li.product {
    width: 30.75%;
}

ul.products.columns-4 li.product {
    width: 22.05%;
}

ul.products.columns-5 li.product {
    width: 16.96%;
}

@media (max-width: 768px) {
    ul.products li.product {
        width: 48%;
        margin-right: 3.8%;
    }
    
    ul.products li.product:nth-child(2n) {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    ul.products li.product {
        width: 100%;
        margin-right: 0;
    }
}

/* Fix widget spacing in sidebar */
.widget-area .widget {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Prevent content overflow */
.site-main {
    overflow-x: hidden;
}

.col-full {
    max-width: 100%;
    padding: 0 1rem;
}

/* Fix storefront specific layout issues */
.storefront-full-width-content .content-area,
.storefront-full-width-content .widget-area {
    margin-right: 0;
}

.storefront-full-width-content.woocommerce-page ul.products li.product,
.storefront-full-width-content .related ul.products li.product,
.storefront-full-width-content .upsells ul.products li.product {
    margin-right: 3.8%;
}

.storefront-full-width-content.woocommerce-page ul.products li.product.last,
.storefront-full-width-content .related ul.products li.product.last,
.storefront-full-width-content .upsells ul.products li.product.last {
    margin-right: 0;
}