/* ===== Design tokens ===== */
:root {
    /* Color */
    --c-bg: #f6f8fb;
    --c-surface: #ffffff;
    --c-surface-alt: #eef2f7;
    --c-border: #e2e8f0;
    --c-border-strong: #cbd5e1;
    --c-text: #0b1220;
    --c-text-muted: #5b6b81;
    --c-text-subtle: #94a3b8;
    --c-brand: #4f46e5;          /* indigo — trust */
    --c-brand-hover: #4338ca;
    --c-brand-soft: #e0e7ff;
    --c-brand-dark: #1e1b4b;
    --c-cta: #f97316;            /* orange — action / prices */
    --c-cta-hover: #ea580c;
    --c-cta-soft: #ffedd5;
    --c-accent: #f43f5e;         /* deals / sale — hot rose */
    --c-accent-soft: #ffe4ea;
    --c-warning: #f59e0b;
    --c-info: #0ea5e9;

    /* Gradients */
    --g-brand: linear-gradient(120deg, #4f46e5 0%, #6366f1 55%, #8b5cf6 100%);
    --g-hero: linear-gradient(130deg, #0f0d2e 0%, #1e1b4b 35%, #3730a3 70%, #7c3aed 140%);
    --g-hot: linear-gradient(120deg, #f43f5e, #fb923c);
    --g-cta: linear-gradient(120deg, #f97316, #fb923c);
    --g-text: linear-gradient(100deg, #a5b4fc, #c4b5fd 55%, #f0abfc);

    /* Type */
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Geometry */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-pill: 9999px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, .06), 0 2px 4px -2px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 24px -8px rgba(15, 23, 42, .12), 0 4px 8px -4px rgba(15, 23, 42, .08);

    /* Spacing scale (rem) */
    --container: 1200px;
}

/* ===== Reset / base ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.55;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-brand); text-decoration: none; }
a:hover { color: var(--c-brand-hover); text-decoration: underline; }

h1, h2, h3, h4 {
    margin: 0 0 .5rem;
    line-height: 1.2;
    color: var(--c-text);
    font-weight: 700;
    letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); }
h2 { font-size: 1.5rem; margin-top: 2rem; }
h3 { font-size: 1.125rem; }
p  { margin: 0 0 1rem; }
small, .small { font-size: 0.85rem; color: var(--c-text-muted); }

h1:focus { outline: none; }

/* ===== Layout helpers ===== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
.stack-sm > * + * { margin-top: 0.5rem; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.75rem; }
.muted { color: var(--c-text-muted); }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gap-sm { gap: .5rem; } .gap { gap: 1rem; } .gap-lg { gap: 1.5rem; }
.text-center { text-align: center; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .5rem;
    font-family: inherit; font-weight: 600; font-size: 0.95rem;
    padding: .625rem 1.125rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, transform .05s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }

.btn-primary {
    background: var(--g-brand); color: #fff;
    box-shadow: 0 4px 14px -3px rgba(79, 70, 229, .40);
}
.btn-primary:hover {
    color: #fff; text-decoration: none;
    filter: brightness(1.07);
    box-shadow: 0 6px 20px -4px rgba(79, 70, 229, .55);
}

.btn-ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-surface-alt); color: var(--c-text); text-decoration: none; }

.btn-link { background: transparent; color: var(--c-brand); padding: 0; border: 0; }
.btn-link:hover { color: var(--c-brand-hover); text-decoration: underline; }

.btn-danger-link { background: transparent; color: var(--c-accent); border: 0; padding: 0; cursor: pointer; font: inherit; }
.btn-danger-link:hover { text-decoration: underline; }

.btn-sm { padding: .375rem .75rem; font-size: .85rem; }
.btn-lg { padding: .875rem 1.5rem; font-size: 1rem; }

/* ===== Cards ===== */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-body { padding: 1.25rem; }
.card-hover { transition: transform .2s cubic-bezier(.2,.8,.3,1.2), box-shadow .2s, border-color .2s; }
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 36px -12px rgba(79, 70, 229, .20), 0 6px 12px -6px rgba(15, 23, 42, .1);
    border-color: rgba(79, 70, 229, .35);
}

/* ===== Badges / pills ===== */
.badge {
    display: inline-flex; align-items: center;
    font-size: .75rem; font-weight: 700; letter-spacing: .02em;
    padding: .2rem .55rem;
    border-radius: var(--radius-pill);
    background: var(--c-surface-alt);
    color: var(--c-text-muted);
    text-transform: uppercase;
}
.badge-sale {
    background: var(--g-hot); color: #fff;
    box-shadow: 0 4px 12px -3px rgba(244, 63, 94, .5);
}
.badge-low  { background: var(--c-brand-soft); color: var(--c-brand-dark); }
.badge-stock { background: #ecfdf5; color: var(--c-brand-dark); }
.badge-out  { background: #fef2f2; color: var(--c-accent); }

/* ===== Forms ===== */
.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
select, textarea {
    font-family: inherit; font-size: 1rem;
    width: 100%;
    padding: .625rem .85rem;
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--c-brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
label.field { display: block; margin-bottom: 1rem; }
label.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; color: var(--c-text); }

.valid.modified:not([type=checkbox]) { outline: none; border-color: var(--c-brand); }
.invalid { border-color: var(--c-accent); }
.validation-message { color: var(--c-accent); font-size: .85rem; margin-top: .25rem; }

/* ===== Tables ===== */
.table {
    width: 100%; border-collapse: collapse;
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--c-border);
}
.table th, .table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--c-border); }
.table th { background: var(--c-surface-alt); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-best { background: var(--c-brand-soft); }
.table tbody tr.is-best td { font-weight: 600; }

/* ===== Alerts ===== */
.alert { padding: .85rem 1rem; border-radius: var(--radius); border: 1px solid; }
.alert-success { background: var(--c-brand-soft); border-color: #6ee7b7; color: var(--c-brand-dark); }
.alert-error { background: var(--c-accent-soft); border-color: #fca5a5; color: #991b1b; }

/* ===== Hero ===== */
.hero {
    position: relative;
    background: var(--g-hero);
    background-size: 200% 200%;
    animation: hero-shift 14s ease-in-out infinite;
    color: #fff;
    border-radius: 20px;
    padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 4vw, 3.5rem);
    margin: 1.5rem 0 2.25rem;
    overflow: hidden;
    box-shadow: 0 24px 48px -16px rgba(30, 27, 75, .45);
}
@keyframes hero-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.hero::before {
    content: ""; position: absolute; inset: 0;
    background-image:
        radial-gradient(600px circle at 85% 15%, rgba(196, 181, 253, .30) 0, transparent 50%),
        radial-gradient(500px circle at 10% 90%, rgba(56, 189, 248, .25) 0, transparent 50%),
        radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.6) 50%, transparent 51%),
        radial-gradient(2px 2px at 70% 65%, rgba(255,255,255,.5) 50%, transparent 51%),
        radial-gradient(2px 2px at 45% 15%, rgba(255,255,255,.4) 50%, transparent 51%),
        radial-gradient(2px 2px at 90% 80%, rgba(255,255,255,.5) 50%, transparent 51%);
    pointer-events: none;
}
.hero::after {
    content: "";
    position: absolute; right: -80px; top: -80px;
    width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgba(167, 139, 250, .35), transparent 65%);
    filter: blur(10px);
    animation: hero-float 9s ease-in-out infinite;
    pointer-events: none;
}
@keyframes hero-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(24px) scale(1.08); }
}
.hero h1 {
    color: #fff; max-width: 22ch;
    font-size: clamp(2.4rem, 1.2rem + 4vw, 4rem);
    font-weight: 800; letter-spacing: -0.03em; line-height: 1.05;
    margin-bottom: .75rem;
}
.hero h1 .grad {
    background: var(--g-text);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.hero p { color: rgba(255,255,255,.82); max-width: 56ch; font-size: 1.15rem; }
.hero .hero-form { display: flex; gap: .6rem; max-width: 520px; margin-top: 1.75rem; position: relative; }
.hero .hero-form input {
    background: rgba(255,255,255,.97); border-color: transparent;
    padding: .8rem 1.1rem; border-radius: 12px; font-size: 1rem;
}
.hero .hero-form .btn-primary {
    background: var(--g-text); color: #032117; border-radius: 12px;
    padding: .8rem 1.4rem; font-weight: 700; white-space: nowrap;
    box-shadow: 0 8px 24px -6px rgba(249, 115, 22, .55);
}
.hero .hero-form .btn-primary:hover { filter: brightness(1.08); }
.hero .hero-msg { margin-top: .85rem; color: #c7d2fe; font-size: .95rem; font-weight: 600; }
.hero .hero-msg.err { color: #fecdd3; }
.hero-stats {
    display: flex; gap: 2.5rem; margin-top: 2.25rem; position: relative; flex-wrap: wrap;
}
.hero-stats .stat .num {
    display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em;
    background: var(--g-text);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.hero-stats .stat .lbl { color: rgba(255,255,255,.65); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }

/* ===== Product grid ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.product-card { display: flex; flex-direction: column; }
.product-card .thumb {
    aspect-ratio: 1;
    background: radial-gradient(120% 100% at 50% 0%, #fff 0%, var(--c-surface-alt) 100%);
    display: flex;
    align-items: center; justify-content: center; padding: 1rem;
    position: relative; overflow: hidden;
}
.product-card .thumb img { max-height: 100%; object-fit: contain; transition: transform .3s ease; }
.product-card:hover .thumb img { transform: scale(1.06); }
.product-card .thumb .badge { position: absolute; top: .75rem; left: .75rem; }
.product-card .body { padding: 1rem 1.25rem 1.25rem; flex: 1; display: flex; flex-direction: column; }
.product-card .brand { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); }
.product-card .title { font-size: 1rem; font-weight: 600; margin: .25rem 0 .75rem; line-height: 1.35; }
.product-card .title a { color: inherit; }
.product-card .title a:hover { color: var(--c-brand); text-decoration: none; }
.product-card .price-row { display: flex; align-items: baseline; gap: .5rem; margin-top: auto; padding-top: .5rem; }
.product-card .price { font-size: 1.4rem; font-weight: 800; color: var(--c-cta); letter-spacing: -.02em; }
.product-card .was-price { font-size: .95rem; color: var(--c-text-subtle); text-decoration: line-through; }
.product-card .retailer { font-size: .85rem; color: var(--c-text-muted); }
.product-card .cta { margin-top: 1rem; width: 100%; }

/* ===== Footer ===== */
.site-footer {
    margin-top: 4rem;
    padding: 2.5rem 0 2rem;
    background: #0f172a;
    color: #cbd5e1;
}
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.site-footer h4 { color: #fff; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-brand { font-size: 1.25rem; font-weight: 700; color: #fff; margin-bottom: .5rem; }
.footer-tagline { color: #94a3b8; font-size: .9rem; max-width: 32ch; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 1.25rem; font-size: .85rem; color: #94a3b8; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
@media (max-width: 720px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid > :first-child { grid-column: 1 / -1; }
}

/* ===== Section header ===== */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 2.5rem 0 1.15rem; }
.section-head h2 {
    margin: 0; font-size: 1.65rem; letter-spacing: -.02em;
    position: relative; padding-left: .9rem;
}
.section-head h2::before {
    content: ""; position: absolute; left: 0; top: .18em; bottom: .18em;
    width: 5px; border-radius: 3px; background: var(--g-brand);
}
.section-head .link { font-weight: 700; }

/* ===== Motion preferences ===== */
@media (prefers-reduced-motion: reduce) {
    .hero, .hero::after { animation: none; }
    .card-hover, .product-card .thumb img { transition: none; }
}

/* ===== Blazor error UI ===== */
#blazor-error-ui {
    background: #1e293b; color: #fff;
    bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed;
    width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: #fff; border-radius: var(--radius); }
.blazor-error-boundary::after { content: "An error has occurred."; }
