/**
 * AO Search App - Minimal Structural CSS Only
 * ALL styling is applied via React inline styles from Design Admin settings
 * This file contains ONLY layout and structural CSS, no visual styling
 * 
 * @package Instant_Alter_Search
 * @version 5.0.0 - React-Driven Styling
 */

/* ========================================
   Overlay - Full Screen Layout
======================================== */
.ao-search-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    z-index: 999999;
    overflow: hidden;
}

.ao-search-overlay.visible {
    display: flex;
}

.ao-search-overlay.hidden {
    display: none;
}

/* ========================================
   Search Header - Structural Only
======================================== */
.ao-search-header {
    flex: 0 0 auto;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
}

.ao-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
}

.ao-search-input:focus {
    outline: none;
}

/* ========================================
   Search Container - Main Content
======================================== */
.ao-search-container {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ========================================
   Filters Sidebar
======================================== */
.ao-search-filters {
    flex: 0 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(0,0,0,0.1);
}

/* ========================================
   Results Area - Structural
======================================== */
.ao-search-results {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.ao-search-hits {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ========================================
   Grid Layout - CRITICAL
======================================== */
.ao-instant-grid {
    display: grid;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
    overflow: visible;
    /* grid-template-columns and gap set via React inline styles */
}

/* Force grid children to respect grid cell boundaries */
.ao-instant-grid > * {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* ========================================
   Product Card - Structural Only
======================================== */
.ao-product-card {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    /* All styling (bg, border, shadow, padding, border-radius) from React inline styles */
}

.ao-product-image {
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
    /* Aspect ratio and styling from React inline styles */
}

.ao-product-image img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.ao-product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    /* Padding, background, color from React inline styles */
}

.ao-product-title {
    margin: 0;
    padding: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Font size, weight, color, line-clamp from React inline styles */
}

.ao-product-price {
    /* Font size, color, weight from React inline styles */
}

.ao-product-button {
    display: inline-block;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    /* Background, color, padding, border-radius, font-size, transition from React inline styles */
}

.ao-product-button:hover {
    /* Hover effects from React via :hover or JS */
}

/* ========================================
   Badges - Structural
======================================== */
.ao-sale-badge,
.ao-new-badge {
    position: absolute;
    font-weight: 700;
    font-size: 11px;
    /* Background, color, padding, border-radius, positioning from React inline styles */
}

/* ========================================
   Filter Elements - Structural
======================================== */
.ao-filter-group {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    /* Padding, background from React inline styles */
}

.ao-filter-title {
    margin: 0;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    /* Font styling from React inline styles */
}

.ao-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Padding from React inline styles */
}

.ao-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.ao-filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

/* ========================================
   Utilities
======================================== */
.ao-hidden {
    display: none !important;
}

.ao-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ao-loading-spinner {
    display: inline-block;
    animation: ao-spin 1s linear infinite;
}

@keyframes ao-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Responsive - Only layout adjustments
   Specific column counts set via React inline styles
======================================== */

@media (max-width: 768px) {
    .ao-search-overlay {
        position: fixed;
        inset: 0;
    }
    
    .ao-search-container {
        flex-direction: column;
    }
    
    .ao-search-filters {
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        max-height: 200px;
    }
}

/* ========================================
   Native Modal - Inherit WoodMart theme styling
======================================== */
#ao-native-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: block;
    background: white;
}

/* Native modal container - WoodMart classes for theme integration */
.ao-search-native-modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wd-search-full-screen-2 {
    width: 100%;
    height: 100%;
    display: flex !important;
    flex-direction: column;
    flex: 1;
}

.wd-search-full-screen-2.wd-scroll {
    overflow: hidden;
}

.wd-search-full-screen-2.wd-fill {
    height: 100%;
}

.wd-search-full-screen-2.wd-opened {
    display: flex !important;
}

/* Search topbar */
.wd-search-full-screen-2 .ao-search-topbar {
    flex-shrink: 0;
    width: 100%;
}

/* Search content area must be scrollable */
.wd-search-full-screen-2 .ao-search-content {
    flex: 1;
    overflow: auto;
    min-height: 0;
    width: 100%;
}

/* Search input styling - inherit from WoodMart but apply custom colors */
#ao-native-search-modal .s.wd-search-inited {
    width: 100%;
    padding: 12px 16px;
    height: 48px;
    box-sizing: border-box;
    font-size: 16px;
    border-width: 1px;
    border-style: solid;
}

/* Close button */
#ao-native-search-modal .ao-search-close-btn {
    z-index: 10001;
    transition: all 0.2s ease;
}

/* Print styles
======================================== */
@media print {
    .ao-search-overlay {
        display: none !important;
    }
}

