/**
 * B05 Category Showcase - Category + Subcategories + Products Display
 * CSS ISOLATION: ALL classes prefixed with .saly-ps-
 * NO generic class names like .showcase, .hero, .card
 *
 * FIGMA DESIGN: Two layout variants (from builder-service)
 * - layout='left': sidebar on left, hero on right
 * - layout='right': hero on left, sidebar on right (default)
 */

/* ===================================
   SPARTAN FONT IMPORT (from Figma)
   =================================== */
@import url('https://fonts.googleapis.com/css2?family=Spartan:wght@400;500;600;700&display=swap');

/* ===================================
   MAIN LAYOUT (Figma Two-Column)
   =================================== */

/* Two-column grid - DEFAULT: Hero on LEFT, Sidebar on RIGHT */
.saly-ps-block-category-showcase {
    display: grid;
    grid-template-columns: 1fr 196px;  /* Hero takes remaining space, Sidebar fixed */
    gap: 24px;  /* Figma spec */
    width: 100%;
    background: #FFFFFF;  /* Figma: white background for entire block */
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);  /* Subtle shadow from Figma */
    box-sizing: border-box;
    align-items: stretch;  /* Sidebar stretches to match hero height */
}

/* LEFT variant: Sidebar on LEFT, Hero on RIGHT */
.saly-ps-block-category-showcase[data-ps-layout="left"] {
    grid-template-columns: 196px 1fr;  /* Sidebar fixed, Hero takes remaining */
}

/* Hero Section (Horizontal Layout with Background Image Mask) */
.saly-ps-showcase-hero {
    position: relative;
    min-height: auto;  /* Dynamic height based on content */
    padding: 20px;
    border-radius: 8px;
    overflow-x: hidden;  /* Prevent horizontal overflow (carousel) */
    overflow-y: visible; /* Allow vertical growth for taller cards */
}

/* Hero background image - masked to 334px height (Figma Mask Group) */
.saly-ps-hero-background-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 334px;  /* Figma: Mask Group height */
    background-size: cover;
    background-position: center;
    background-color: #667eea;  /* Fallback color */
    border-radius: 8px;
    z-index: 1;
}

/* Gradient overlay on hero background (same as banners) */
.saly-ps-hero-background-mask::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 8px;
}

/* Hero title (Figma: Spartan Bold 18px, positioned at top) */
.saly-ps-hero-title {
    position: relative;
    z-index: 2;  /* Above background */
    font-family: 'Spartan', sans-serif;
    font-weight: 700;  /* Bold */
    font-size: 18px;
    line-height: 28px;
    letter-spacing: -0.36px;
    color: #FFFFFF;
    margin: 0 0 26px 0;  /* Figma: carousel at y=74, title ends at y=48 → 26px gap */
}

/* Product Carousel Container - starts at y=54px (Figma: y=74 - 20px padding) */
.saly-ps-showcase-products-carousel {
    position: relative;
    z-index: 2;  /* Above background image */
    width: 100%;
    /* Carousel extends below the 334px background image mask */
}

/* Remove B03 header margin when embedded in B05 */
.saly-ps-showcase-products-carousel .saly-ps-block-header {
    margin-bottom: 0;
}

/* Remove B03 carousel margin when embedded in B05 (prevents extra height) */
.saly-ps-showcase-products-carousel .saly-ps-block-products-carousel {
    margin-bottom: 0;
}

/* Extend carousel wrapper width in B05 to show partial card */
.saly-ps-showcase-products-carousel .saly-ps-carousel-wrapper {
    width: 102%;
}

/* B05-specific: Override B03 card width for 3.35 items visible (3 full + ~70% partial, same as B03) */
.saly-ps-showcase-products-carousel .saly-ps-carousel-container[data-ps-items-visible="3.35"] .saly-ps-carousel-item {
    width: calc(100% / 3.35);
}

/* Navigation Buttons Container (Figma: top-right corner, transparent buttons) */
.saly-ps-b05-carousel-nav-buttons {
    position: absolute;
    top: 16px;  /* Figma: 16px from top (including hero padding: 20px - 4px visual adjustment) */
    right: 20px;  /* Aligned with hero padding */
    z-index: 10;  /* Above all other elements */
    display: flex;
    gap: 16px;  /* Figma spec */
    align-items: center;
}

/* Navigation Arrow Buttons (Figma: transparent with white border, 42×40px) */
.saly-ps-b05-carousel-arrow {
    width: 42px;
    height: 40px;
    border-radius: 4px;
    background: transparent;  /* Figma: transparent background */
    border: 1px solid #FFFFFF;  /* Figma: white border */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px 12px;  /* Figma spec */
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: #FFFFFF;  /* White icons */
}

/* Hover state - add subtle dark background for better visibility */
.saly-ps-b05-carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.2);  /* Semi-transparent dark background */
}

/* Disabled state */
.saly-ps-b05-carousel-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Icon styling (SVG inherits color from parent) */
.saly-ps-b05-carousel-arrow svg {
    display: block;
    width: 18px;  /* Figma: 18×18px */
    height: 18px;
    stroke: currentColor;  /* Inherits white from parent */
}

/* Category Sidebar (Figma: 479px height, 196px width from grid) */
.saly-ps-showcase-sidebar {
    min-height: 479px;  /* Dynamic - expands with hero/carousel */
    display: flex;
    flex-direction: column;
    gap: 8px;  /* Figma: 8px gap between links */
}

/* Sidebar subcategory link (Figma: Spartan Medium 12px, 18px height) */
.saly-ps-sidebar-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 18px;  /* Figma: each link row is 18px */
    flex-shrink: 0;
    align-self: stretch;
    font-family: 'Spartan', sans-serif;
    font-weight: 500;  /* Medium */
    font-size: 12px;
    line-height: 20px;
    letter-spacing: -0.24px;  /* Figma: -2% */
    color: #333333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.saly-ps-sidebar-link:hover {
    color: #4B1195;  /* Primary purple from Figma */
}

/* "Browse All" button in sidebar (Figma: 151×40px, scales with sidebar) */
.saly-ps-sidebar-browse-all {
    margin-top: auto;  /* Push to bottom of sidebar */
    margin-bottom: 2.3rem;
    width: 100%;
    max-width: 151px;  /* Figma spec - don't exceed on larger screens */
    height: 40px;
    border: 1px solid #4B1195;
    border-radius: 4px;
    background: transparent;
    color: #4B1195;
    font-family: 'Spartan', sans-serif;
    font-weight: 600;  /* SemiBold */
    font-size: 12px;
    text-align: center;
    line-height: 40px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.saly-ps-sidebar-browse-all:hover {
    background-color: #F5F0FA;  /* Light purple tint */
    transform: translateY(-1px);
}

/* ===================================
   NOTE: Product card styles are provided by B03_ProductsCarousel.css
   B05 only handles layout, sidebar, and hero section.
   All product styling comes from the embedded B03 component.
   =================================== */

/* ===================================
   RESPONSIVE BREAKPOINTS
   =================================== */

/* Tablet: Stack sidebar below hero */
@media (max-width: 1199px) {
    .saly-ps-block-category-showcase,
    .saly-ps-block-category-showcase[data-ps-layout="left"] {
        grid-template-columns: 1fr;  /* Single column */
        max-width: 100%;
    }

    .saly-ps-showcase-sidebar {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }

    .saly-ps-showcase-hero {
        min-height: 280px;  /* Dynamic height on tablet */
    }

    /* Tablet: 1 full card + ~35% of second (1.35 items visible, same ratio as B03) */
    .saly-ps-showcase-products-carousel .saly-ps-carousel-container[data-ps-items-visible="3.35"] .saly-ps-carousel-item {
        width: calc(100% / 1.35);
    }
}

/* Mobile: Further adjustments */
@media (max-width: 767px) {
    .saly-ps-showcase-hero {
        min-height: 250px;  /* Dynamic height on mobile */
    }

    .saly-ps-hero-title {
        font-size: 16px;
        line-height: 24px;
    }

    .saly-ps-sidebar-browse-all {
        width: 100%;
    }
}

/* ===================================
   VIEWPORT SIMULATION (test-runner)
   =================================== */

/* Tablet viewport simulation for test-runner environment */
.viewport-tablet .saly-ps-showcase-products-carousel .saly-ps-carousel-container[data-ps-items-visible="3.35"] .saly-ps-carousel-item {
    width: calc(100% / 1.35) !important;
}

/* ===================================
   ACCESSIBILITY & PRINT STYLES
   =================================== */

/* Accessibility - focus states for B05 specific elements */
.saly-ps-b05-carousel-arrow:focus,
.saly-ps-sidebar-link:focus,
.saly-ps-sidebar-browse-all:focus {
    outline: 2px solid #4B1195;
    outline-offset: 2px;
}

/* Print styles - hide navigation arrows */
@media print {
    .saly-ps-b05-carousel-nav-buttons {
        display: none;
    }

    .saly-ps-sidebar-browse-all {
        display: none;
    }
}
