/**
 * Negroni Store - Global Layout & Design System
 * Centralized, reusable header and footer with mobile responsiveness
 */

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #212529;
    background-color: #ffffff;
    line-height: 1.6;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main Content Area */
.site-main {
    flex: 1;
    width: 100%;
    padding: 2rem 0;
}

/* WooCommerce Content Fix */
#content,
.woocommerce-wrapper {
    min-height: auto;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

/* WooCommerce Shop Page Layout Fix */
/* Use flexbox for modern responsive layout */
.woocommerce-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .woocommerce-wrapper {
        flex-direction: row;
        padding: 0 1.5rem;
    }
}

@media (min-width: 1200px) {
    .container {
        padding: 0 2rem;
    }
    
    .woocommerce-wrapper {
        padding: 0 2rem;
    }
}

/* Main content area - flexible width */
.woocommerce .site-main,
.woocommerce-page .site-main {
    flex: 1;
    min-width: 0; /* Prevent overflow */
    padding: 2rem 0;
    margin-bottom: 0;
}

/* Sidebar - fixed width on large screens */
.woocommerce aside.widget-area,
.woocommerce-page aside.widget-area {
    width: 100%;
    margin-bottom: 0;
}

@media (min-width: 1024px) {
    .woocommerce aside.widget-area,
    .woocommerce-page aside.widget-area {
        width: 300px;
        flex-shrink: 0;
        padding-left: 2rem;
    }
}

/* Fix footer positioning */
.site-footer {
    clear: both !important;
    position: relative !important;
    width: 100% !important;
    margin-top: 3rem !important;
}

/* Ensure body has min-height */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Make main content area grow */
#page {
    flex: 1 0 auto;
}

/* Clear floats after content */
#content:after,
.site-content:after,
.woocommerce-wrapper:after {
    content: "";
    display: table;
    clear: both;
}

/* PERMANENTLY Hide Recent Posts and Recent Comments widgets */
.widget_recent_entries,
.widget_recent_comments,
#recent-posts-2,
#recent-comments-2,
.widget h2:contains('Recent Posts'),
.widget h2:contains('Recent Comments') {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Also hide by widget title text */
.widget-area .widget {
    margin-bottom: 2rem;
}

.widget-area .widget:has(h2:contains('Recent Posts')),
.widget-area .widget:has(h2:contains('Recent Comments')) {
    display: none !important;
}

/* Mobile: Stack sidebar below content */
@media (max-width: 768px) {
    .woocommerce .site-main,
    .woocommerce-page .site-main,
    .woocommerce aside.widget-area,
    .woocommerce-page aside.widget-area {
        float: none;
        width: 100%;
        padding-right: 0;
    }
    
    .woocommerce aside.widget-area,
    .woocommerce-page aside.widget-area {
        margin-top: 2rem;
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Global Header - Full Width with Campari Branding */
.site-header {
    background: linear-gradient(135deg, #c80f2f, #a00c26);
    color: #ffffff;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 2rem;
}

/* Logo */
.site-logo {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.site-logo:hover {
    transform: translateY(-2px);
    color: #ffffff;
}

/* Main Navigation */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.main-menu a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.main-menu a:hover,
.main-menu .current-menu-item a {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

/* User Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.coin-balance-header {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.cart-link {
    color: #ffffff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cart-link:hover {
    background: rgba(255,255,255,0.1);
}

/* Buttons in Header */
.header-nav .btn {
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    white-space: nowrap;
}

.header-nav .btn-outline {
    color: #ffffff;
    border-color: #ffffff;
}

.header-nav .btn-outline:hover {
    background: #ffffff;
    color: #c80f2f;
    transform: translateY(-2px);
}

.header-nav .btn-primary {
    background: #ffffff;
    color: #c80f2f;
}

.header-nav .btn-primary:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Global Footer - Full Width */
.site-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    width: 100%;
    margin-top: auto;
    padding: 3rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    color: #c80f2f;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-column a:hover {
    color: #c80f2f;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
    color: #6c757d;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Container */
    .container {
        padding: 0 0.75rem;
    }
    
    /* Header Mobile */
    .header-content {
        flex-wrap: wrap;
        padding: 0.75rem 0;
    }
    
    .site-logo {
        font-size: 1.25rem;
    }
    
    /* Mobile Navigation */
    .mobile-menu-toggle {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: #c80f2f;
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem;
        transition: left 0.3s ease;
        z-index: 1001;
    }
    
    .main-nav.active {
        left: 0;
    }
    
    .main-menu {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .main-menu a {
        display: block;
        width: 100%;
        padding: 1rem;
        text-align: left;
    }
    
    /* User Nav Mobile */
    .header-nav {
        width: 100%;
        justify-content: space-between;
        order: 3;
        margin-top: 0.5rem;
        flex-wrap: wrap;
    }
    
    .coin-balance-header {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .cart-link {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .header-nav .btn {
        font-size: 0.875rem;
        padding: 0.375rem 1rem;
    }
    
    /* Footer Mobile */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-column {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    .site-logo {
        font-size: 1.125rem;
    }
    
    .header-nav {
        gap: 0.5rem;
    }
    
    .coin-balance-header,
    .cart-link {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Global Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #c80f2f, #a00c26);
    color: #ffffff;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a00c26, #800a1f);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(200, 15, 47, 0.3);
    color: #ffffff;
}

/* Accessibility */
.site-header a:focus,
.site-footer a:focus,
.btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    background: #c80f2f;
    color: #ffffff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
    left: 0;
    top: 0;
    z-index: 1002;
}