/**
 * AllStars Algolia AI & Agentic Search Styles
 * Brand: AllStars UAE (#f4a51c amber/gold, #0f172a slate)
 */

:root {
    --as-search-gold: #f4a51c;
    --as-search-gold-hover: #df9313;
    --as-search-gold-light: rgba(244, 165, 28, 0.12);
    --as-search-dark: #0f172a;
    --as-search-card-bg: #ffffff;
    --as-search-border: #e2e8f0;
    --as-search-text: #1e293b;
    --as-search-muted: #64748b;
    --as-search-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.25), 0 10px 20px -5px rgba(15, 23, 42, 0.15);
}

/* Modal Overlay */
.as-algolia-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh;
    opacity: 0;
    transition: opacity 0.22s ease;
    box-sizing: border-box;
}

.as-algolia-modal.as-active {
    display: flex;
    opacity: 1;
}

/* Container */
.as-algolia-container {
    width: 92%;
    max-width: 820px;
    background: var(--as-search-card-bg);
    border-radius: 20px;
    box-shadow: var(--as-search-shadow);
    border: 1px solid rgba(244, 165, 28, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 86vh;
    animation: asSlideDown 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes asSlideDown {
    from {
        opacity: 0;
        transform: translateY(-24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Search Header */
.as-algolia-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--as-search-border);
    background: #ffffff;
    position: relative;
}

.as-algolia-search-icon {
    display: flex;
    align-items: center;
    color: var(--as-search-gold);
    flex-shrink: 0;
}

.as-algolia-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.as-algolia-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 600;
    color: var(--as-search-dark);
    background: transparent;
    padding: 4px 0;
    box-shadow: none !important;
}

.as-algolia-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.as-algolia-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 6px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.as-algolia-clear-btn:hover {
    color: var(--as-search-dark);
    background: #f1f5f9;
}

.as-algolia-close-btn {
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--as-search-muted);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.as-algolia-close-btn:hover {
    background: #e2e8f0;
    color: var(--as-search-dark);
}

/* Quick Tags / Filters Bar */
.as-algolia-tags-bar {
    padding: 10px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--as-search-border);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.as-algolia-tags-bar::-webkit-scrollbar {
    display: none;
}

.as-algolia-tag-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.as-algolia-chip {
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--as-search-text);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.as-algolia-chip:hover {
    border-color: var(--as-search-gold);
    color: var(--as-search-gold);
    background: var(--as-search-gold-light);
}

.as-algolia-chip.as-active {
    background: var(--as-search-gold);
    color: #ffffff;
    border-color: var(--as-search-gold);
}

/* Results Content Area */
.as-algolia-content {
    overflow-y: auto;
    flex: 1;
    padding: 16px 24px;
    min-height: 220px;
    max-height: 60vh;
}

/* Highlighted match */
.as-algolia-highlight {
    background: rgba(244, 165, 28, 0.28);
    color: #92400e;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 4px;
}

/* Products Grid */
.as-algolia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* Product Card */
.as-algolia-card {
    border: 1px solid var(--as-search-border);
    border-radius: 14px;
    padding: 12px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
}

.as-algolia-card:hover {
    border-color: var(--as-search-gold);
    box-shadow: 0 8px 24px rgba(244, 165, 28, 0.15);
    transform: translateY(-2px);
}

.as-algolia-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    position: relative;
    margin-bottom: 10px;
}

.as-algolia-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.as-algolia-card:hover .as-algolia-img {
    transform: scale(1.05);
}

.as-algolia-badge-sale {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.as-algolia-cat-name {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-algolia-prod-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--as-search-dark);
    line-height: 1.35;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 36px;
}

.as-algolia-bottom {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.as-algolia-prices {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.as-algolia-price-current {
    font-size: 15px;
    font-weight: 800;
    color: var(--as-search-gold);
}

.as-algolia-price-old {
    font-size: 12px;
    color: #94a3b8;
    text-decoration: line-through;
}

.as-algolia-view-btn {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.as-algolia-card:hover .as-algolia-view-btn {
    background: var(--as-search-gold);
    color: #ffffff;
}

/* Footer & Stats */
.as-algolia-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--as-search-border);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #94a3b8;
}

.as-algolia-logo-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-weight: 600;
}

.as-algolia-logo-brand svg {
    height: 14px;
}

/* Empty / Initial State */
.as-algolia-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--as-search-muted);
}

.as-algolia-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.as-algolia-empty h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--as-search-dark);
    margin: 0 0 8px 0;
}

.as-algolia-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

/* RTL Specific Overrides */
.rtl .as-algolia-modal {
    direction: rtl;
    text-align: right;
}

.rtl .as-algolia-badge-sale {
    right: auto;
    left: 8px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .as-algolia-modal {
        padding-top: 0;
    }

    .as-algolia-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .as-algolia-header {
        padding: 14px 16px;
    }

    .as-algolia-content {
        padding: 12px 16px;
    }

    .as-algolia-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .as-algolia-card {
        padding: 8px;
    }

    .as-algolia-prod-title {
        font-size: 12.5px;
        height: 34px;
    }

    .as-algolia-price-current {
        font-size: 13.5px;
    }
}
