/**
 * Main Content Spacing Stylesheet
 * Provides consistent spacing for main content areas across all pages
 * Part of Phase 1: Core Pages Structure (Cleanup Project)
 * Last Updated: October 16, 2025
 */

/* =============================================
   HTML SCROLL PADDING (Fix for Fixed Header)
   ============================================= */

html {
    /* Ensure content isn't hidden behind fixed header when scrolling to anchors */
    scroll-padding-top: 200px; /* Match main content padding-top */
}

/* =============================================
   MAIN CONTENT WRAPPER
   ============================================= */

/**
 * Main content container
 * Ensures consistent spacing from header and footer
 * Supports both full-width and container-based layouts
 */
/* Add padding-top to body to account for fixed header */
body {
    padding-top: 120px !important; /* Fixed header height: 40px (top) + 80px (main) */
    margin-top: 0;
}

main.main-content {
    padding-top: 0;           /* No extra padding - page-specific spacing handled by page CSS */
    padding-bottom: 100px;    /* Space above footer */
    min-height: calc(100vh - 300px);
    position: relative;
    width: 100%;
}

/* Alternative main wrapper for flexibility */
main {
    padding-top: 0;
    padding-bottom: 100px;
}

/* =============================================
   HERO SECTIONS (Full-width banners)
   ============================================= */

/**
 * Hero sections that should extend full width
 * Negative margin offsets the main padding for seamless design
 */
.hero-section,
.hero-slider-section,
.banner-section,
.about-hero-section,
.collection-hero,
.collection-hero-section,
.about-page-wrapper {
    margin-top: 0;
    margin-bottom: 0;
    width: 100%;
    position: relative;
}

/* =============================================
   CONTENT CONTAINERS
   ============================================= */

/**
 * Standard content container
 * Limits width and centers content
 */
.content-container,
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Section wrapper */
.content-section,
.page-section {
    margin-bottom: 60px;
}

/* First section should have less top margin */
.content-section:first-of-type,
.page-section:first-of-type {
    margin-top: 0;
    margin-bottom: 60px;
}

/* =============================================
   PAGE-SPECIFIC SPACING
   ============================================= */

/* Welcome/Homepage */
.welcome-content {
    padding-top: 40px;
}

.welcome-hero {
    margin-top: -60px;
    padding-top: 60px;
}

/* Products Listing Page */
.products-container {
    padding-top: 40px;
}

.products-header {
    margin-bottom: 40px;
    padding-top: 0;
}

.products-grid {
    margin-bottom: 60px;
}

/* Product Detail Page */
.product-detail-container {
    padding-top: 40px;
}

.product-detail-section {
    margin-bottom: 60px;
}

/* Product Detail Page spacing already handled by body padding-top and main padding-top */
.product-main-container {
    padding-top: 0;
    margin-top: 0;
}

/* Cart Page */
.cart-container,
.cart-main-container {
    padding-top: 40px;
}

.cart-content {
    margin-bottom: 60px;
}

/* Checkout Page */
.checkout-container,
.checkout-section {
    padding-top: 40px;
}

.checkout-form {
    margin-bottom: 60px;
}

/* Collection/Category Pages */
.collection-container,
.category-container {
    padding-top: 40px;
}

/* About/Info Pages */
.about-container,
.info-container,
.page-info-container {
    padding-top: 40px;
}

.about-section,
.info-section {
    margin-bottom: 60px;
}

/* =============================================
   RESPONSIVE SPACING
   ============================================= */

/* Tablet Devices (768px - 1024px) */
@media (max-width: 1024px) {
    html {
        scroll-padding-top: 120px;
    }

    body {
        padding-top: 115px !important; /* Adjusted for tablet header */
    }

    main.main-content,
    main {
        padding-top: 0;
        padding-bottom: 100px;
    }

    .hero-section,
    .hero-slider-section,
    .banner-section,
    .about-hero-section,
    .collection-hero,
    .collection-hero-section,
    .about-page-wrapper {
        margin-top: 0;
        padding-top: 0;
    }

    .content-section,
    .page-section {
        margin-bottom: 50px;
    }

    .content-section:first-of-type,
    .page-section:first-of-type {
        margin-bottom: 50px;
    }

    .products-container,
    .product-detail-container,
    .cart-container,
    .checkout-container,
    .collection-container,
    .category-container,
    .about-container,
    .info-container,
    .page-info-container {
        padding-top: 30px;
    }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
    html {
        scroll-padding-top: 110px;
    }

    body {
        padding-top: 70px !important; /* Adjusted for mobile header: 35px (top) + 35px (main reduced) */
    }

    main.main-content,
    main {
        padding-top: 0;
        padding-bottom: 80px;
        min-height: calc(100vh - 200px);
    }

    .hero-section,
    .hero-slider-section,
    .banner-section,
    .about-hero-section,
    .collection-hero,
    .collection-hero-section,
    .about-page-wrapper {
        margin-top: 0;
        padding-top: 0;
        width: 100%;
    }

    .content-section,
    .page-section {
        margin-bottom: 40px;
    }

    .content-section:first-of-type,
    .page-section:first-of-type {
        margin-bottom: 40px;
    }

    .products-container,
    .product-detail-container,
    .cart-container,
    .checkout-container,
    .collection-container,
    .category-container,
    .about-container,
    .info-container,
    .page-info-container {
        padding-top: 20px;
    }

    .products-grid {
        margin-bottom: 40px;
    }

    .products-header {
        margin-bottom: 30px;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    html {
        scroll-padding-top: 70px;
    }

    body {
        padding-top: 70px !important;
    }

    main.main-content,
    main {
        padding-top: 0;
        padding-bottom: 70px;
    }

    .hero-section,
    .hero-slider-section,
    .banner-section,
    .about-hero-section,
    .collection-hero,
    .collection-hero-section,
    .about-page-wrapper {
        margin-top: 0;
        padding-top: 0;
    }

    .content-section,
    .page-section {
        margin-bottom: 30px;
    }

    .content-section:first-of-type,
    .page-section:first-of-type {
        margin-bottom: 30px;
    }

    .products-container,
    .product-detail-container,
    .cart-container,
    .checkout-container,
    .collection-container,
    .category-container,
    .about-container,
    .info-container,
    .page-info-container {
        padding-top: 15px;
    }

    .products-grid {
        margin-bottom: 30px;
    }

    .products-header {
        margin-bottom: 20px;
    }
}

/* =============================================
   RTL (Arabic) ADJUSTMENTS
   ============================================= */

[dir="rtl"] main.main-content,
[dir="rtl"] main {
    direction: rtl;
}

[dir="rtl"] .hero-section,
[dir="rtl"] .hero-slider-section,
[dir="rtl"] .banner-section {
    direction: rtl;
}

/* =============================================
   UTILITY CLASSES
   ============================================= */

/* Add spacing above sections */
.mt-section {
    margin-top: 60px;
}

.mt-section-lg {
    margin-top: 80px;
}

.mt-section-sm {
    margin-top: 40px;
}

/* Add spacing below sections */
.mb-section {
    margin-bottom: 60px;
}

.mb-section-lg {
    margin-bottom: 80px;
}

.mb-section-sm {
    margin-bottom: 40px;
}

/* Remove default spacing if needed */
.no-spacing {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
