/*
Theme Name: S.M Garments Pro
Author: S.M Garments
Version: 2.5.0
Text Domain: sm-garments
Description: A custom WooCommerce theme with full-width mega menus and responsive footer.
*/

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;800&family=Playfair+Display:ital,wght@0,400;0,600;0,800;1,400&display=swap');

/* --- COLOR VARIABLES --- */
:root {
    --sm-red: #D0021B;
    --sm-black: #111111;
    --sm-white: #FFFFFF;
    --sm-grey-bg: #F5F5F5;
    --sm-grey-text: #777777;
    --font-head: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
}

/* --- RESET --- */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font-body); color: var(--sm-black); background: var(--sm-white); margin: 0; overflow-x: hidden; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); margin: 0 0 1rem; font-weight: 700; line-height: 1.2; color: var(--sm-black); }
a { text-decoration: none; color: inherit; transition: 0.3s; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
input, button { font-family: inherit; }

/* --- UTILITIES --- */
.container-fluid { width: 100%; padding-right: 5%; padding-left: 5%; margin-right: auto; margin-left: auto; position: relative; }
.text-uppercase { text-transform: uppercase; }
.btn { display: inline-block; padding: 15px 35px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; border: 2px solid transparent; cursor: pointer; }
.btn-primary { background: var(--sm-red); color: var(--sm-white); border-color: var(--sm-red); }
.btn-primary:hover { background: #a00015; border-color: #a00015; }
.btn-outline { background: transparent; color: var(--sm-black); border-color: var(--sm-black); }
.btn-outline:hover { background: var(--sm-black); color: var(--sm-white); }

/* --- HEADER LAYOUT --- */
.top-bar { background: var(--sm-black); color: var(--sm-white); font-size: 11px; padding: 8px 0; text-align: center; letter-spacing: 1px; }

.main-header { background: var(--sm-white); position: sticky; top: 0; z-index: 1000; transition: 0.3s; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }

/* Row 1: Logo & Icons */
.header-top-row { 
    display: flex; 
    align-items: center; 
    padding: 20px 0; 
    border-bottom: 1px solid #eee; 
    position: relative; 
}
.header-left { flex: 1; text-align: left; }
.header-center { flex: 0 0 auto; text-align: center; }
.header-right { flex: 1; text-align: right; }

/* Logo Group */
.site-branding { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
}
.site-logo-text { 
    font-family: var(--font-head); 
    font-size: 32px; 
    font-weight: 800; 
    letter-spacing: -1px; 
    text-transform: uppercase; 
    color: var(--sm-black); 
    line-height: 1;
}
.site-title { 
    font-size: 11px; 
    font-weight: 700; 
    letter-spacing: 3px; 
    text-transform: uppercase; 
    margin: 10px 0 2px 0; 
    color: var(--sm-black);
}
.site-tagline { 
    font-size: 10px; 
    color: var(--sm-grey-text); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

/* Icons */
.header-icon { 
    font-size: 20px; 
    cursor: pointer; 
    position: relative; 
    color: var(--sm-black); 
    margin: 0 10px; 
    transition: color 0.3s;
}
.header-icon:hover { color: var(--sm-red); }
.cart-count { 
    position: absolute; 
    top: -8px; 
    right: -5px; 
    background: var(--sm-red); 
    color: var(--sm-white); 
    font-size: 10px; 
    width: 18px; 
    height: 18px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.mobile-toggle { display: none; font-size: 24px; cursor: pointer; }

/* Row 2: Navigation */
.header-bottom-row { background: var(--sm-white); padding: 0; position: relative; }
.nav-menu { display: flex; justify-content: center; list-style: none; }

/* --- MEGA MENU STYLING --- */
.nav-menu > li { 
    margin: 0 20px; 
    position: static; 
} 

.nav-menu > li > a { 
    font-weight: 600; 
    text-transform: uppercase; 
    font-size: 13px; 
    padding: 20px 0; 
    display: block; 
    color: var(--sm-black); 
    position: relative;
}

/* Hover Underline Animation */
.nav-menu > li > a::after { 
    content: ''; 
    display: block; 
    width: 0; 
    height: 2px; 
    background: var(--sm-red); 
    transition: width 0.3s; 
    margin-top: 5px;
}
.nav-menu > li > a:hover::after { width: 100%; }

/* The Mega Menu Container */
.sub-menu {
    display: none;
    position: absolute;
    left: 0;
    width: 100%; 
    background: var(--sm-white);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    z-index: 999;
    top: 100%; 
    padding: 40px 50px;
    border-top: 3px solid var(--sm-red);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

/* Show Menu on Hover */
.nav-menu > li:hover > .sub-menu {
    display: grid !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu li {
    list-style: none;
    padding: 0;
}
.sub-menu li a {
    display: block;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--sm-black);
    border-bottom: 1px solid #f0f0f0;
    text-transform: capitalize;
}
.sub-menu li a:hover {
    color: var(--sm-red);
    padding-left: 5px; 
}

/* Image Column Styling */
.mega-img-col {
    grid-column: span 1; 
    height: 100%;
    min-height: 250px;
    overflow: hidden;
    border-radius: 4px;
}
.mega-img-col img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.mega-img-col:hover img {
    transform: scale(1.05);
}

/* --- HERO & LAYOUT --- */
.hero-section { position: relative; height: 85vh; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; background-image: url('https://picsum.photos/seed/fashionhero/1920/1080'); }
.hero-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.1); }
.hero-content { position: relative; z-index: 2; text-align: center; color: var(--sm-white); }
.hero-subtitle { font-size: 14px; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 20px; display: block; }
.hero-title { font-size: 60px; margin-bottom: 30px; text-transform: uppercase; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }

/* --- PRODUCTS (WooCommerce Overrides) --- */
.products-section { padding: 80px 0; }
.products-section.grey-bg { background: var(--sm-grey-bg); }
.section-header { text-align: center; margin-bottom: 60px; }
.section-title { font-size: 36px; text-transform: uppercase; color: var(--sm-black); }
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }
.product-card { position: relative; }
.product-image { position: relative; overflow: hidden; aspect-ratio: 3/4; margin-bottom: 15px; background: #eee; }
.product-image img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.product-card:hover .product-image img { transform: scale(1.05); }
.quick-add { position: absolute; bottom: -50px; left: 0; width: 100%; background: var(--sm-white); text-align: center; padding: 15px; transition: 0.3s; text-transform: uppercase; font-size: 12px; font-weight: 700; color: var(--sm-black); cursor: pointer; }
.product-card:hover .quick-add { bottom: 0; }
.product-title { font-size: 14px; font-weight: 700; text-transform: uppercase; margin-bottom: 5px; color: var(--sm-black); }
.product-price { font-size: 14px; color: var(--sm-grey-text); }

/* --- FOOTER --- */
footer { background: var(--sm-black); color: var(--sm-white); padding: 80px 0 30px; }
footer .footer-col h5 { color: var(--sm-white); font-size: 14px; margin-bottom: 25px; text-transform: uppercase; letter-spacing: 1px; }
footer a { color: #999; font-size: 13px; display: block; margin-bottom: 12px; }
footer a:hover { color: var(--sm-white); }
.footer-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 30px; }
.footer-bottom { border-top: 1px solid #333; margin-top: 60px; padding-top: 30px; text-align: center; font-size: 12px; color: #666; }

/* --- COMPONENTS --- */
.search-overlay { position: fixed; inset: 0; background: var(--sm-white); z-index: 2000; display: none; align-items: center; justify-content: center; }
.search-overlay.active { display: flex; }
.search-input { width: 60%; font-size: 24px; border: none; border-bottom: 2px solid var(--sm-black); padding: 10px; font-family: var(--font-head); outline: none; }
.close-search { position: absolute; top: 30px; right: 30px; font-size: 30px; cursor: pointer; }

/* --- MINI CART UPDATES --- */

/* 1. Ensure the sidebar allows scrolling so the button isn't pushed off-screen */
.mini-cart-sidebar {
    position: fixed;
    top: 0;
    right: -500px; /* Hidden by default */
    width: 450px;
    height: 100vh;
    background: var(--sm-white);
    z-index: 1600;
    transition: 0.4s;
    padding: 60px 40px 40px 40px; /* Increased top padding to account for button */
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
    overflow-y: auto; /* Allows content to scroll */
    display: flex;
    flex-direction: column;
}

.mini-cart-sidebar.active {
    right: 0;
}

.mini-cart-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--sm-black);
    transition: color 0.3s ease;
    padding: 0;
    margin: 0;
    
    /* CRITICAL FIXES: Ensure the button is clickable and on top */
    z-index: 9999 !important;
    pointer-events: auto !important;
}

.mini-cart-close-btn:hover {
    color: var(--sm-red);
    transform: scale(1.1);
}

/* 3. Ensure Cart Header and Content are distinct */
.cart-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.cart-content {
    flex-grow: 1; /* Ensures content fills available space */
}

/* --- RESPONSIVE --- */
@media(max-width: 992px) {
    .header-top-row { padding: 15px 0; }
    .mobile-toggle { display: block; }
    .header-bottom-row { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: #fff; padding: 0; box-shadow: 0 10px 20px rgba(0,0,0,0.1); max-height: 0; overflow: hidden; }
    .mobile-menu-active .header-bottom-row { display: block; max-height: 100vh; overflow-y: auto; padding: 20px; }
    .nav-menu { flex-direction: column; text-align: left; }
    .nav-menu > li { margin: 0; border-bottom: 1px solid #eee; width: 100%; }
    .nav-menu > li > a { padding: 15px 10px; }
    .sub-menu { position: static; transform: none; width: 100%; grid-template-columns: 1fr; box-shadow: none; padding: 0; display: none; background: #fafafa; opacity: 1; visibility: visible; }
    .show-mobile-submenu .sub-menu { display: block !important; }
    .mega-img-col { display: none; }
    .mega-links-col { padding: 20px; border: none; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-title { font-size: 36px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .mini-cart-sidebar { width: 100%; }
}

@media(max-width: 576px) {
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .product-grid { grid-template-columns: 1fr; }
    .header-left, .header-right { flex: 0 0 auto; }
}