/* Main Wrapper */
#ais-wrapper {
    display: flex;
    gap: 30px;
    margin: 30px 0;
    font-family: inherit;
}

#ais-sidebar {
    width: 260px;
    flex-shrink: 0;
    padding-right: 20px;
    border-right: 1px solid #eee;
    overflow-y: auto;
    max-height: calc(100vh - 40px);
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

#ais-main {
    flex-grow: 1;
}

/* Fix Headers for Refinement Lists */
.ais-facet-wrapper {
    margin-bottom: 25px;
}

/* We inject headers via template, usually H3 or similar inside widget, 
   but instantsearch templates.header puts it inside the widget div. */

/* Hits Grid */
.ais-Hits-list {
    display: grid;
    grid-template-columns: repeat(var(--wais-columns-desktop, var(--wais-columns, 3)), minmax(0, 1fr));
    gap: var(--wais-gap-desktop, var(--wais-gap, 20px));
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

@media (max-width: 1024px) {
    .ais-Hits-list {
        grid-template-columns: repeat(var(--wais-columns-tablet, var(--wais-columns-desktop, 3)), minmax(0, 1fr));
        gap: var(--wais-gap-tablet, var(--wais-gap-desktop, 18px));
    }
}

@media (max-width: 640px) {
    .ais-Hits-list {
        grid-template-columns: repeat(var(--wais-columns-mobile, var(--wais-columns-tablet, 2)), minmax(0, 1fr));
        gap: var(--wais-gap-mobile, var(--wais-gap-tablet, 16px));
    }
}

.ais-Hits-item {
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: var(--wais-card-padding, 15px);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    background: #fff;
    display: flex;
    flex-direction: column;
    border-radius: var(--wais-card-radius, 4px);
    box-shadow: var(--wais-card-shadow, none);
}

.ais-Hits-item:hover {
    box-shadow: var(--wais-card-shadow, 0 5px 15px rgba(0,0,0,0.1));
    transform: translateY(-2px);
}

.ais-hit-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Hit Content */
.ais-hit-image {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
}

.ais-hit-image img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.ais-hit-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ais-hit-brand {
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
}

.ais-hit-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1a1a1a;
    text-decoration: none;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ais-hit-title:hover {
    color: var(--wais-link-hover, #002FA7);
}

.ais-hit-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.ais-hit-row {
    font-size: 13px;
    color: #444;
    line-height: 1.4;
}

.ais-hit-label {
    color: #777;
}

.ais-hit-value {
    color: #111;
    font-weight: 500;
}

.ais-hit-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.ais-hit-price-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ais-hit-price-label {
    font-size: 12px;
    color: #777;
}

.ais-hit-price {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

/* Sale Price Display */
.ais-hit-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.ais-hit-price-original {
    font-size: 14px;
    font-weight: 500;
    color: #999;
    text-decoration: line-through;
    line-height: 1.2;
}

.ais-hit-price--sale {
    color: #FC361D;
}

/* Sale Badge */
.ais-hit-image {
    position: relative;
}

.ais-hit-sale-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: #FC361D;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 3px;
    line-height: 1.3;
}

.ais-hit-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #F0C14B;
    color: #111;
    padding: 10px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #c9a227;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.ais-hit-cart svg {
    flex-shrink: 0;
}

.ais-hit-cart:hover {
    background: #e3b340;
    border-color: #a68920;
    color: #111;
}

/* Refinement Lists */
.ais-RefinementList-item {
    margin-bottom: 8px;
}

.ais-RefinementList-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: color 0.15s ease;
}

.ais-RefinementList-label:hover {
    color: #111;
}

.ais-RefinementList-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-right: 10px;
    border: 2px solid #ccc;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.ais-RefinementList-checkbox:hover {
    border-color: #F0C14B;
}

.ais-RefinementList-checkbox:checked {
    background: #F0C14B;
    border-color: #c9a227;
}

.ais-RefinementList-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.ais-RefinementList-labelText {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ais-RefinementList-count {
    background: #f1f1f1;
    color: #666;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Show More Buttons */
.ais-RefinementList-showMore,
.ais-HierarchicalMenu-showMore,
.ais-Menu-showMore {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ais-RefinementList-showMore:hover,
.ais-HierarchicalMenu-showMore:hover,
.ais-Menu-showMore:hover {
    border-color: #c9a227;
    color: #111;
    background: #fffbf0;
}

.ais-RefinementList-showMore:focus,
.ais-HierarchicalMenu-showMore:focus,
.ais-Menu-showMore:focus {
    outline: none;
    border-color: #F0C14B;
    box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.15);
}

/* Fix selection highlight for show more buttons */
.ais-RefinementList-showMore::selection,
.ais-HierarchicalMenu-showMore::selection,
.ais-Menu-showMore::selection {
    background: #F0C14B;
    color: #111;
}

.ais-RefinementList-showMore--disabled,
.ais-HierarchicalMenu-showMore--disabled,
.ais-Menu-showMore--disabled {
    display: none;
}

/* Clear Refinements Button */
#clear-refinements {
    margin-bottom: 16px;
}

.ais-ClearRefinements-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ais-ClearRefinements-button:hover {
    border-color: #c9a227;
    color: #111;
    background: #fffbf0;
}

.ais-ClearRefinements-button--disabled {
    display: none;
}

/* Current Refinements / Chips */
#current-refinements {
    margin-bottom: 20px;
}

.ais-CurrentRefinements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-CurrentRefinements-item {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    background: transparent;
    border: none;
}

.ais-CurrentRefinements-label {
    display: none;
}

.ais-CurrentRefinements-category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    background: linear-gradient(to bottom, #fff, #f8f8f8);
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.15s ease;
}

.ais-CurrentRefinements-category:hover {
    border-color: #bbb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.ais-CurrentRefinements-categoryLabel {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ais-CurrentRefinements-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    background: #e5e5e5;
    border: none;
    border-radius: 50%;
    color: #666;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ais-CurrentRefinements-delete:hover {
    background: #d32f2f;
    color: #fff;
}

/* Stats */
#stats {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* SearchBox */
.ais-SearchBox {
    margin-bottom: 20px;
}

.ais-SearchBox-form {
    display: flex;
    align-items: center;
}

.ais-SearchBox-form::before {
    display: none !important;
    content: none !important;
}

.ais-SearchBox-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ais-SearchBox-input:focus {
    outline: none;
    border-color: #F0C14B;
    box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.15);
}

.ais-SearchBox-input::placeholder {
    color: #999;
}

.ais-SearchBox-submit,
.ais-SearchBox-reset,
.ais-SearchBox-loadingIndicator {
    display: none !important;
}

/* Dynamic Widgets Container */
.ais-dynamic-widgets-container {
    margin-top: 20px;
}

.ais-panel-header {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
    font-size: 14px;
    text-transform: uppercase;
    color: #333;
}
.ais-Panel-header {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
    font-size: 14px;
    text-transform: uppercase;
    color: #333;
}

/* Pagination */
#pagination {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.ais-Pagination {
    width: 100%;
}

.ais-Pagination-list {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.ais-Pagination-item {
    display: flex;
}

.ais-Pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.ais-Pagination-link:hover {
    border-color: #F0C14B;
    background: #fffbf0;
    color: #111;
}

.ais-Pagination-item--selected .ais-Pagination-link {
    background: #F0C14B;
    border-color: #c9a227;
    color: #111;
    font-weight: 600;
}

.ais-Pagination-item--disabled .ais-Pagination-link {
    color: #ccc;
    border-color: #eee;
    background: #fafafa;
    cursor: not-allowed;
    pointer-events: none;
}

.ais-Pagination-item--firstPage .ais-Pagination-link,
.ais-Pagination-item--previousPage .ais-Pagination-link,
.ais-Pagination-item--nextPage .ais-Pagination-link,
.ais-Pagination-item--lastPage .ais-Pagination-link {
    font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    #ais-wrapper {
        flex-direction: column;
    }
    
    #ais-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-bottom: 20px;
        position: static;
        max-height: none;
        align-self: auto;
    }
}

/* ========================================
   SKELETON LOADING ANIMATIONS
   ======================================== */

/* Hide skeletons when loaded */
#ais-wrapper:not(.wais-loading) .wais-skeleton-grid,
#ais-wrapper:not(.wais-loading) .wais-skeleton-filters,
#ais-wrapper:not(.wais-loading) .wais-skeleton-facet,
#ais-wrapper:not(.wais-loading) .wais-skeleton-stats {
    display: none !important;
}

/* Shimmer animation */
@keyframes wais-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.wais-skeleton-shimmer {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 0%, #e8e8e8 50%, #f0f0f0 100%);
    border-radius: inherit;
}

.wais-skeleton-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 50%,
        transparent 100%
    );
    animation: wais-shimmer 1.5s infinite;
}

/* Skeleton Grid */
.wais-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(var(--wais-columns-desktop, var(--wais-columns, 3)), minmax(0, 1fr));
    gap: var(--wais-gap-desktop, var(--wais-gap, 20px));
    list-style: none;
    padding: 0;
    margin: 0;
}

@media (max-width: 1024px) {
    .wais-skeleton-grid {
        grid-template-columns: repeat(var(--wais-columns-tablet, var(--wais-columns-desktop, 3)), minmax(0, 1fr));
        gap: var(--wais-gap-tablet, var(--wais-gap-desktop, 18px));
    }
}

@media (max-width: 640px) {
    .wais-skeleton-grid {
        grid-template-columns: repeat(var(--wais-columns-mobile, var(--wais-columns-tablet, 2)), minmax(0, 1fr));
        gap: var(--wais-gap-mobile, var(--wais-gap-tablet, 16px));
    }
}

/* Skeleton Card */
.wais-skeleton-card {
    border: 1px solid #e1e1e1;
    border-radius: var(--wais-card-radius, 4px);
    padding: var(--wais-card-padding, 15px);
    background: #fff;
    display: flex;
    flex-direction: column;
}

.wais-skeleton-image {
    height: 180px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.wais-skeleton-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.wais-skeleton-brand {
    height: 14px;
    width: 60%;
    background: #f5f5f5;
    border-radius: 3px;
    margin-bottom: 8px;
    overflow: hidden;
}

.wais-skeleton-title {
    height: 16px;
    width: 100%;
    background: #f5f5f5;
    border-radius: 3px;
    margin-bottom: 6px;
    overflow: hidden;
}

.wais-skeleton-title--short {
    width: 75%;
    margin-bottom: 12px;
}

.wais-skeleton-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.wais-skeleton-meta-row {
    height: 14px;
    width: 80%;
    background: #f5f5f5;
    border-radius: 3px;
    overflow: hidden;
}

.wais-skeleton-meta-row:last-child {
    width: 65%;
}

.wais-skeleton-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.wais-skeleton-price {
    height: 24px;
    width: 70px;
    background: #f5f5f5;
    border-radius: 3px;
    overflow: hidden;
}

.wais-skeleton-button {
    height: 40px;
    width: 90px;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

/* Skeleton Filters (Sidebar) */
.wais-skeleton-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wais-skeleton-filter-item {
    height: 22px;
    width: 100%;
    background: #f5f5f5;
    border-radius: 3px;
    overflow: hidden;
}

.wais-skeleton-filter-item:nth-child(2) {
    width: 85%;
}

.wais-skeleton-filter-item:nth-child(3) {
    width: 70%;
}

.wais-skeleton-filter-item:nth-child(4) {
    width: 90%;
}

.wais-skeleton-filter-item:nth-child(5) {
    width: 55%;
}

/* Skeleton Facets */
.wais-skeleton-facet {
    margin-bottom: 25px;
}

.wais-skeleton-facet-title {
    height: 18px;
    width: 100px;
    background: #e0e0e0;
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}

/* Skeleton Stats */
.wais-skeleton-stats {
    height: 16px;
    width: 180px;
    background: #f5f5f5;
    border-radius: 3px;
    overflow: hidden;
}
