/**
 * Department Tabs Styles - Vertical Sidebar Layout
 * 
 * Organized structure:
 * 1. CSS Custom Properties (Variables)
 * 2. Base Layout & Components
 * 3. Tab Navigation Styles (Pills, Underline, Cards)
 * 4. Tab Content & Subcategory Layout
 * 5. Responsive Breakpoints
 * 6. Accessibility & Motion Preferences
 * 
 * @package SnipesBrandGrid
 * @since   1.0.0
 */

/* ==========================================================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ========================================================================== */

:root {
    /* Brand Colors */
    --snipes-primary: #8B8564;
    --snipes-primary-dark: #4e4a34;
    --snipes-primary-light: #6B5D47;
    
    /* Spacing */
    --tab-gap: 2rem;
    --tab-padding: 1rem 1.5rem;
    --content-gap: 1.5rem;
    
    /* Brand Grid */
    --brand-card-min-width: 140px;
    --brand-card-gap: 1.5rem;
    --brand-card-padding: 10px;
    
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-standard: all 0.3s ease;
    
    /* Shadows */
    --shadow-light: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-heavy: 0 6px 16px rgba(139,133,100,0.25);
}

/* Enable smooth scrolling for the entire page */
html {
    scroll-behavior: smooth;
}

/* Prevent initial anchor jump on page load */
html:not(.js-tabs-initialized) {
    scroll-behavior: auto;
}

/* ==========================================================================
   BASE LAYOUT COMPONENTS
   ========================================================================== */

.department-tabs-container {
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    padding: 0;
}

/* Department Header - Above the entire layout */
.department-header {
    text-align: left;
    margin-bottom: 2rem;
    padding: 0;
}

/* Main content area with tabs and content */
.tabs-main-content {
    display: flex;
    gap: var(--tab-gap);
    align-items: flex-start;
}

.department-title {
    font-size: 2rem;
    font-weight: 600;
    color: #8B8564;
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: "Arial", sans-serif;
}

.department-description {
    font-size: 1rem;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* ==========================================================================
   TAB NAVIGATION STYLES
   ========================================================================== */

.tab-navigation {
    flex: 0 0 280px; /* Fixed width sidebar */
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.tab-nav-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
}

/* Default Tab Style - Vertical Pills (Sidebar) - Enhanced Interactive */
.tab-style-pills .tab-button,
.tab-navigation .tab-button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 1.5rem;
    background: #f8f8f8;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    font-weight: 500;
    color: #8B8564;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    width: 100%;
    margin: 0;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transform: translateX(0);
    overflow: hidden;
}

/* Subtle shimmer effect for interactivity hint */
.tab-style-pills .tab-button::before,
.tab-navigation .tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.tab-style-pills .tab-button:hover::before,
.tab-navigation .tab-button:hover::before {
    left: 100%;
}
/* 
.tab-style-pills .tab-button:first-child,
.tab-navigation .tab-button:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.tab-style-pills .tab-button:last-child,
.tab-navigation .tab-button:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom: none;
} */

.tab-style-pills .tab-button:hover,
.tab-navigation .tab-button:hover {
    background: #ffffff;
    color: #6B5D47;
    border-color: #8B8564;
    box-shadow: 0 4px 12px rgba(139,133,100,0.15);
    transform: translateX(4px);
}

.tab-style-pills .tab-button.active,
.tab-navigation .tab-button.active {
    background: #4e4a34;
    color: #fff;
    font-weight: 600;
    border-color: #4e4a34;
    box-shadow: 0 6px 16px rgba(139,133,100,0.25);
    transform: translateX(6px);
}

.tab-style-pills .tab-button.active::before,
.tab-navigation .tab-button.active::before {
    display: none; /* No shimmer on active state */
}

.tab-button .tab-label {
    flex: 1;
}

.tab-button .tab-count {
    opacity: 0.7;
    font-size: 0.85rem;
    margin-left: 0.5rem;
    background: rgba(139,133,100,0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.tab-button:hover .tab-count {
    opacity: 1;
    background: rgba(139,133,100,0.15);
}

.tab-button.active .tab-count {
    background: rgba(255,255,255,0.2);
    opacity: 1;
}

/* Add a subtle indicator arrow */
.tab-style-pills .tab-button::after,
.tab-navigation .tab-button::after {
    content: '>';
    position: absolute;
    right: 1rem;
    font-size: 1.2rem;
    opacity: 0;
    transition: all 0.3s ease;
    transform: translateX(-10px);
}

.tab-style-pills .tab-button:hover::after,
.tab-navigation .tab-button:hover::after {
    opacity: 0.5;
    transform: translateX(0);
}

.tab-style-pills .tab-button.active::after,
.tab-navigation .tab-button.active::after {
    opacity: 1;
    color: #fff;
}

/* --------------------------------------------------------------------------
   Underline Tab Style
   -------------------------------------------------------------------------- */

.tab-style-underline .tab-navigation {
    background: transparent;
    border-bottom: 2px solid #e5e5e5;
}

.tab-style-underline .tab-nav-scroll {
    flex-direction: row;
    gap: 2rem;
    background: transparent;
}

.tab-style-underline .tab-button {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 1rem 0;
    color: #666;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    flex: none;
    position: relative;
    cursor: pointer;
}

.tab-style-underline .tab-button::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    width: 0;
    height: 3px;
    background: #8B8564;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.tab-style-underline .tab-button:hover {
    color: #8B8564;
    border-bottom-color: #8B8564;
    background: transparent;
    transform: translateY(-2px);
}

.tab-style-underline .tab-button:hover::before {
    width: 50%;
}

.tab-style-underline .tab-button.active {
    color: #8B8564;
    border-bottom-color: #8B8564;
    background: transparent;
    font-weight: 600;
}

.tab-style-underline .tab-button.active::before {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Cards Tab Style
   -------------------------------------------------------------------------- */

.tab-style-cards .tab-nav-scroll {
    flex-direction: column;
    gap: 0.5rem;
    background: transparent;
}

.tab-style-cards .tab-button {
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    color: #666;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.tab-style-cards .tab-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(139,133,100,0.1), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}

.tab-style-cards .tab-button:hover {
    background: #f8f8f8;
    border-color: #8B8564;
    color: #8B8564;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    transform: translateY(-3px) scale(1.02);
}

.tab-style-cards .tab-button:hover::before {
    left: 100%;
}

.tab-style-cards .tab-button.active {
    background: #8B8564;
    border-color: #8B8564;
    color: #fff;
    box-shadow: 0 8px 20px rgba(139,133,100,0.4);
    font-weight: 600;
    transform: translateY(-2px);
}

.tab-style-cards .tab-button.active::before {
    display: none;
}

/* ==========================================================================
   TAB CONTENT AREA
   ========================================================================== */

.tab-content-container {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    scroll-margin-top: 100px; /* Offset for smooth scroll positioning */
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =================================== */
/* SUBCATEGORY CONTENT LAYOUT */
/* =================================== */

.subcategory-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Full-width hero image at top */
.subcategory-hero-image {
    width: 100%;
    margin-bottom: 1rem;
}

.subcategory-hero-image img {
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

/* Single-column stacked layout (Desktop) */
.subcategory-two-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: stretch;
    padding: 2rem;
    background-color: #EFEFE6;
    border-radius: 10px;
}

/* Brands Column (Full width) */
.subcategory-brands-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* Description Column (Full width) */
.subcategory-description-column {
    width: 100%;
}

.subcategory-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

.subcategory-description h1,
.subcategory-description h2,
.subcategory-description h3 {
    color: #8B8564;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
}

.subcategory-description h1 { font-size: 1.75rem; }
.subcategory-description h2 { font-size: 1.5rem; }
.subcategory-description h3 { font-size: 1.25rem; }

.no-brands {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Legacy support for old .subcategory-brands class */
.subcategory-brands {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.brands-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #8B8564;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Larger minimum for 16:9 aspect ratio */
    gap: 1.5rem;
    margin: 0;
}

.brands-grid .brand-card {
    border-radius: 8px;
    padding: 3px;
    transition: all 0.3s ease;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brands-grid .brand-card:hover {
    border-color: #8B8564;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    background-color: rgba(139, 133, 100, 0.15);
}

.brands-grid .brand-card:hover .brand-logo img {
    filter: none;
    transform: scale(1.05);
}

.brands-grid .brand-card-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brands-grid .brand-logo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brands-grid .brand-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(100%) brightness(0.6) contrast(1.2);
    border-radius: 0 !important;
    transition: filter 0.3s ease, transform 0.2s ease;
}

.brands-expand {
    text-align: center;
    margin-top: 1rem;
}

.btn-expand-brands {
    background: transparent;
    border: 2px solid #8B8564;
    color: #8B8564;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-expand-brands:hover {
    background: #8B8564;
    color: #fff;
}

/* =================================== */
/* LIFESTYLE GALLERY */
/* =================================== */

.subcategory-gallery {
    grid-column: 1 / -1;
}

.gallery-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #8B8564;
    margin: 0 0 1.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* =================================== */
/* CALL TO ACTION */
/* =================================== */

.subcategory-cta {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 2rem;
}

.btn-cta {
    display: inline-block;
    background: #8B8564;
    color: #fff;
    padding: 1rem 2.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn-cta:hover {
    background: #6B5D47;
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139,133,100,0.3);
}

/* =================================== */
/* RESPONSIVE DESIGN */
/* =================================== */

/* =================================== */
/* LAYOUT VARIATIONS */
/* =================================== */

/* Horizontal Layout */
.layout-horizontal .tabs-main-content {
    flex-direction: column;
    gap: 2rem;
}

.layout-horizontal .tab-navigation {
    flex: none;
    width: 100%;
}

.layout-horizontal .tab-nav-scroll {
    flex-direction: row;
    overflow-x: auto;
    gap: 0;
    background: #f8f8f8;
    border-radius: 8px;
    padding: 0.25rem;
}

.layout-horizontal .tab-button {
    flex: 1;
    min-width: 140px;
    border-radius: 6px !important;
    border: none !important;
    text-align: center;
    margin: 0 0.25rem;
}

/* Stacked Layout */
.layout-stacked .tabs-main-content {
    flex-direction: column;
    gap: 0;
}

.layout-stacked .tab-navigation {
    display: none; /* Hide tabs in stacked layout */
}

.layout-stacked .tab-content {
    display: block !important; /* Show all content */
    margin-bottom: 4rem;
    padding-bottom: 4rem;
    border-bottom: 2px solid #e5e5e5;
}

.layout-stacked .tab-content:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.layout-stacked .brands-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

/* Content Order Variations */
.content-order-brands-first .subcategory-content {
    grid-template-columns: 1fr 1fr;
}

.content-order-brands-first .subcategory-brands {
    order: 1;
}

.content-order-brands-first .subcategory-hero {
    order: 2;
}

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

/* Large Tablet Layout */
@media (max-width: 1200px) and (min-width: 1025px) {
    .subcategory-two-column {
        gap: 1.5rem; /* Maintain consistent gap for stacked layout */
    }
    
    .brands-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

/* Tablet Layout */
@media (max-width: 1024px) {
    .tabs-main-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .tab-navigation {
        flex: none;
        width: 100%;
    }
    
    .tab-nav-scroll {
        flex-direction: row;
        overflow-x: auto;
        gap: 0;
        background: #f8f8f8;
        border-radius: 8px;
        padding: 0.25rem;
    }
    
    .tab-button {
        flex: 1;
        min-width: 140px;
        border-radius: 6px !important;
        border: none !important;
        text-align: center;
        margin: 0 0.25rem;
    }
    
    .subcategory-two-column {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    /* Reset padding on mobile for full-width columns */
    .subcategory-description-column,
    .subcategory-brands-column {
        padding: 0;
        width: 100%;
    }
    
    /* Adjust brands grid for tablet - maintain good aspect ratio */
    .brands-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
}

/* Mobile Layout - Stacked Sections (No Tabs) */
@media (max-width: 768px) {
    .department-header {
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .department-title {
        font-size: 1.5rem;
    }
    
    /* Hide tab navigation completely on mobile */
    .tab-navigation {
        display: none !important;
    }
    
    /* Show all tab content as stacked sections - center aligned */
    .tab-content {
        display: block !important;
        margin-bottom: 3rem;
        padding: 1rem;
        background-color: #EFEFE6;
        border-radius: 10px;
        border-bottom: none;
        text-align: center;
    }
    
    .tab-content:last-child {
        margin-bottom: 0;
    }
    
    /* Add subcategory section headers - centered */
    .tab-content::before {
        content: attr(data-subcategory-name);
        display: block;
        font-size: 1.75rem;
        font-family: var(--e-global-typography-primary-font-family), sans-serif;
        font-weight: 600;
        color: #8B8564;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 1.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 3px solid #8B8564;
        text-align: center;
    }
    
    /* Adjust main content layout for mobile stacked sections */
    .tabs-main-content {
        flex-direction: column;
        gap: 0;
    }
    
    .tab-content-container {
        width: 100%;
    }
    
    /* Mobile-specific subcategory content adjustments - center aligned */
    .subcategory-content {
        gap: 1.5rem;
        text-align: center;
    }
    
    .subcategory-hero {
        gap: 1rem;
        text-align: center;
    }
    
    .brands-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        text-align: center;
    }
	
	.subcategory-two-column {
		padding: 0 !important;
	}
    
    /* Center align subcategory description */
    .subcategory-description {
        text-align: center;
    }
    
    /* Center align subcategory columns */
    .subcategory-brands-column,
    .subcategory-description-column {
        text-align: center;
    }
    
    /* Ensure proper spacing between sections */
    .subcategory-hero-image {
        margin: 2rem 0;
    }
    
    .subcategory-gallery {
        margin-top: 2rem;
    }
    
    .brands-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
    
    .brands-grid .brand-card {
        padding: 0.75rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .subcategory-gallery {
        margin-top: 2rem;
        padding-top: 2rem;
        text-align: center;
    }
    
    /* Center align gallery title */
    .gallery-title {
        text-align: center;
    }
    
    /* Center align CTA section */
    .subcategory-cta {
        text-align: center;
    }
}

/* Small Mobile - Enhanced Stacked Layout */
@media (max-width: 480px) {
    .department-tabs-container {
        gap: 1.5rem;
        text-align: center;
    }
    
    /* Smaller section headers for very small screens - centered */
    .tab-content::before {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    /* Adjust section spacing - center aligned */
    .tab-content {
        margin-bottom: 2.5rem;
        padding: 1.5rem;
        background-color: #EFEFE6;
        border-radius: 10px;
        text-align: center;
    }
    
    .brands-title {
        font-size: 1.1rem;
        text-align: center;
    }
    
    /* Center align all content on small mobile */
    .subcategory-content,
    .subcategory-hero,
    .subcategory-description,
    .subcategory-brands-column,
    .subcategory-description-column,
    .subcategory-gallery,
    .subcategory-cta {
        text-align: center;
    }
    
	.subcategory-two-column {
		padding: 0 !important;
	}
    .brands-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
        min-height: 140px; /* Adjusted for 16:9 aspect ratio on small screens */
    }
    
    .btn-cta {
        padding: 0.875rem 2rem;
        font-size: 0.9rem;
    }
}

/* =================================== */
/* ACCESSIBILITY */
/* =================================== */

.tab-button:focus {
    outline: 2px solid #8B8564;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(139,133,100,0.2);
}

.tab-button:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Enhanced focus for keyboard navigation */
.tab-button:focus-visible {
    outline: 3px solid #8B8564;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(139,133,100,0.15);
    z-index: 10;
}

/* Loading state for tab content transitions */
.tab-content.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tab-content.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #8B8564;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    .tab-content,
    .brands-grid .brand-card,
    .btn-cta,
    .gallery-item img,
    .tab-button,
    .tab-button::before,
    .tab-button::after {
        animation: none;
        transition: none;
    }
    
    .brands-grid .brand-card:hover,
    .gallery-item:hover img,
    .btn-cta:hover,
    .tab-button:hover {
        transform: none;
    }
    
    .tab-content.loading::after {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .tab-button {
        border: 2px solid;
    }
    
    .brands-grid .brand-card {
        border: 2px solid;
    }
}