/* ============================================================
   ROOT VARIABLES — Premium Design System
   ============================================================ */
:root {
    --primary:     #00e5ff;
    --primary-dk:  #00b8d4;
    --primary-glow:rgba(0, 229, 255, 0.15);
    --accent:      #7c3aed;
    --accent-glow: rgba(124, 58, 237, 0.12);
    --bg:          #050810;
    --bg-2:        #080d18;
    --card-bg:     rgba(15, 20, 35, 0.85);
    --card-border: rgba(255, 255, 255, 0.06);
    --text:        #f1f5f9;
    --muted:       #64748b;
    --border:      rgba(255, 255, 255, 0.08);
    --red:         #f43f5e;
    --green:       #22d3ee;
    --shadow:      0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(0, 229, 255, 0.08);
    --ease:        all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --radius:      16px;
    --radius-sm:   10px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================================
   ANIMATED BACKGROUND — Aceternity-style mesh gradient
   ============================================================ */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, rgba(0, 229, 255, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(124, 58, 237, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse 100% 80% at 50% 100%, rgba(0, 229, 255, 0.02) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    animation: meshPulse 12s ease-in-out infinite alternate;
}

@keyframes meshPulse {
    0%   { opacity: 0.6; }
    100% { opacity: 1; }
}

body > * { position: relative; z-index: 1; }

.container {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   HEADER — Glassmorphism sticky nav
   ============================================================ */
header {
    background: rgba(5, 8, 16, 0.75);
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, #fff 30%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-accent {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.total-stats-pill {
    background: rgba(0, 229, 255, 0.07);
    color: var(--primary);
    padding: 0.45rem 1.1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid rgba(0, 229, 255, 0.2);
    letter-spacing: 0.3px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.08);
    transition: var(--ease);
}

.total-stats-pill:hover {
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.4);
}

/* ============================================================
   INTELLIGENCE DASHBOARD — Bento Grid
   ============================================================ */
.insight-section { margin: 2.5rem 0 2rem; }

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 95px);
    gap: 1rem;
}

/* Aceternity-style glassmorphism card */
.bento-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    overflow: hidden;
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    transition: var(--ease);
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: default;
}

.bento-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(0,229,255,0.15) 0%, transparent 60%, rgba(124,58,237,0.1) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.bento-card:hover {
    transform: translateY(-5px) scale(1.01);
    border-color: rgba(0, 229, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 255, 0.06);
}

.bento-card:hover::before { opacity: 1; }

.main-insight {
    grid-column: span 2;
    grid-row: span 2;
    background: linear-gradient(135deg,
        rgba(15, 20, 35, 0.9) 0%,
        rgba(0, 229, 255, 0.04) 100%);
}

.main-insight h2 {
    font-size: 2.4rem;
    background: linear-gradient(135deg, var(--primary), #fff 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0.3rem 0;
    letter-spacing: -1.5px;
    font-weight: 800;
}

/* Mouse-tracking spotlight glow */
.card-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(0, 229, 255, 0.1),
        transparent 40%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    border-radius: var(--radius);
}

.bento-card:hover .card-glow { opacity: 1; }

.card-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
}

.insight-val {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    margin: 0.25rem 0;
    letter-spacing: -0.5px;
}

.card-detail {
    font-size: 0.78rem;
    color: var(--muted);
}

/* ============================================================
   SEARCH & FILTER CONTROLS — Glass Panel
   ============================================================ */
.controls-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.search-container {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
}

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

.search-input-wrap input {
    width: 100%;
    padding-right: 2.5rem;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    display: none;
    transition: color 0.2s;
}

.search-clear-btn:hover {
    color: var(--text);
    background: none;
    transform: none;
}

input[type="text"],
input[type="number"],
select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.92rem;
    transition: var(--ease);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1), 0 0 20px rgba(0, 229, 255, 0.08);
    background: rgba(0, 229, 255, 0.03);
}

select option {
    background: #0d1117;
    color: var(--text);
}

button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dk));
    color: #000;
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-family: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    transition: var(--ease-bounce);
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.2s;
    border-radius: inherit;
}

button:hover {
    background: linear-gradient(135deg, var(--primary-dk), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 229, 255, 0.3);
}

button:active { transform: translateY(0); }

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.price-column-span { grid-column: span 2; }

.price-inputs { display: flex; gap: 10px; }

.price-inputs input {
    flex: 1;
    text-align: center;
    -moz-appearance: textfield;
}

/* Hide browser spinner arrows on number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* ============================================================
   ACTIVE FILTER PILLS
   ============================================================ */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.75rem;
    min-height: 0;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 229, 255, 0.08);
    color: var(--primary);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 50px;
    padding: 5px 14px;
    font-size: 0.79rem;
    font-weight: 600;
    animation: fadeDown 0.25s ease;
}

.filter-pill button {
    background: none;
    color: var(--primary);
    border: none;
    padding: 0;
    margin: 0;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1;
    transform: none;
}

.filter-pill button:hover {
    color: var(--red);
    background: none;
    transform: none;
    box-shadow: none;
}

.clear-all-btn {
    background: none;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 5px 14px;
    font-size: 0.79rem;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--ease);
}

.clear-all-btn:hover {
    color: var(--red);
    border-color: rgba(244, 63, 94, 0.4);
    background: rgba(244, 63, 94, 0.06);
    transform: none;
    box-shadow: none;
}

/* ============================================================
   RESULTS INFO & SEARCH STATUS ALERTS
   ============================================================ */
.results-section { margin-top: 0.5rem; }

.results-info-text {
    font-size: 0.88rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    font-weight: 500;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.search-status { margin-bottom: 1rem; }

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    backdrop-filter: blur(12px);
    margin-bottom: 1rem;
    animation: fadeDown 0.3s ease;
}

.alert-success { background: rgba(34, 211, 238, 0.06); border-color: var(--green); color: #67e8f9; }
.alert-info    { background: rgba(99, 102, 241, 0.06); border-color: #6366f1;    color: #a5b4fc; }
.alert-warning { background: rgba(251, 191, 36, 0.06); border-color: #fbbf24;   color: #fcd34d; }

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PRODUCT GRID & CARDS — Aceternity-style
   ============================================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.loader-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

/* Skeleton Cards */
.skeleton-card {
    height: 410px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.skeleton-pulse {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.04), transparent);
    animation: skeleton-wave 1.8s infinite ease-in-out;
}

@keyframes skeleton-wave {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-img   { width: 100%; height: 180px; background: rgba(255,255,255,0.03); border-radius: 10px; margin-bottom: 1rem; }
.skeleton-text  { height: 12px; background: rgba(255,255,255,0.03); border-radius: 6px; margin-bottom: 8px; }
.skeleton-price { height: 22px; background: rgba(0,229,255,0.05); border-radius: 6px; margin-top: 12px; width: 50%; }

.loader {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 1rem;
    color: var(--muted);
}

/* Product Card — Premium Glass Treatment */
.product-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                border-color 0.3s ease,
                box-shadow 0.35s ease;
    animation: cardIn 0.5s ease both;
}

.card-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        350px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(0, 229, 255, 0.09),
        transparent 40%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    border-radius: var(--radius);
    z-index: 0;
}

.product-card:hover {
    transform: translateY(-6px);
    border-color: rgba(0, 229, 255, 0.22);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 30px rgba(0, 229, 255, 0.07);
}

.product-card:hover .card-glow { opacity: 1; }

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

/* ============================================================
   PRODUCT IMAGE
   ============================================================ */
.product-image-container {
    width: 100%;
    height: 195px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1.25rem;
    transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.5s ease;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.12));
    opacity: 0;
}

.product-image-container img.loaded { opacity: 1; }

.product-card:hover .product-image-container img {
    transform: scale(1.06);
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4);
}

/* ============================================================
   PRODUCT INFO
   ============================================================ */
.product-info {
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    z-index: 1;
}

.product-brand {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.product-name {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6rem;
    color: rgba(241, 245, 249, 0.9);
}

.product-name a { text-decoration: none; color: inherit; }
.product-name a:hover { color: var(--primary); }

.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    color: var(--muted);
}

.star { color: #fbbf24; }

.price-container { margin-top: auto; }

.current-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.original-price {
    font-size: 0.8rem;
    text-decoration: line-through;
    color: var(--muted);
    margin-left: 8px;
}

.view-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: var(--ease);
    letter-spacing: 0.3px;
}

.view-link:hover {
    color: var(--text);
    transform: translateX(5px);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.87rem;
    font-family: inherit;
    font-weight: 500;
    transition: var(--ease);
    backdrop-filter: blur(8px);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
}
.page-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================================
   SCROLL TO TOP BUTTON
   ============================================================ */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dk));
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 25px rgba(0, 229, 255, 0.35);
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 35px rgba(0, 229, 255, 0.5);
}

/* ============================================================
   BACK TO TOP LINK
   ============================================================ */
.back-to-top-link {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
}

.back-to-top-link:hover { color: var(--primary); }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    background: rgba(5, 8, 16, 0.8);
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    backdrop-filter: blur(12px);
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
    .main-insight {
        grid-column: span 2;
        grid-row: span 1;
    }
    .main-insight h2 { font-size: 1.6rem; }
    .search-container { flex-direction: column; }
    .filters-grid { grid-template-columns: 1fr; }
    .price-column-span { grid-column: span 1; }
    .price-inputs { flex-direction: column; }
    .scroll-top-btn { bottom: 1.25rem; right: 1.25rem; }
    .controls-section { padding: 1.25rem; }
}
