/* ============================================================
   GenStore — storefront theme
   A clean, neutral, hand-built design. All colours are driven by
   CSS variables so the admin theme editor can override them later.
   ============================================================ */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --border: #e3e6ea;
    --text: #1c2430;
    --muted: #6b7480;
    --primary: #3b5bdb;
    --primary-600: #364fc7;
    --primary-050: #edf0fe;
    --success-bg: #e6f7ed;
    --success-fg: #1b7a44;
    --danger-bg: #fdecec;
    --danger-fg: #b42318;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --container: 1140px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 20px;
}

.muted { color: var(--muted); }
.link { color: var(--primary); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    padding: .65rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .02s ease;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .45rem .8rem; font-size: .875rem; }
.btn-lg { padding: .85rem 1.5rem; font-size: 1.05rem; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand__mark {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: var(--primary); color: #fff;
    border-radius: 9px; font-weight: 800;
}
.brand__name { font-size: 1.1rem; }

.main-nav { display: flex; gap: 1.25rem; margin-inline-start: 1rem; }
.main-nav a { color: var(--muted); font-weight: 600; }
.main-nav a:hover { color: var(--text); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: .6rem; margin-inline-start: auto; }

/* ---------- Dropdown (language) ---------- */
.dropdown { position: relative; }
.dropdown > summary {
    list-style: none;
    cursor: pointer;
    padding: .5rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-weight: 600;
    font-size: .9rem;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown__menu {
    position: absolute;
    inset-inline-end: 0;
    margin-top: .4rem;
    min-width: 160px;
    list-style: none;
    padding: .35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.dropdown__menu li a {
    display: block;
    padding: .5rem .6rem;
    border-radius: 6px;
    color: var(--text);
}
.dropdown__menu li a:hover { background: var(--surface-2); text-decoration: none; }
.dropdown__menu li a.is-active { color: var(--primary); font-weight: 700; }

/* ---------- Hero ---------- */
.hero {
    background:
        radial-gradient(1200px 400px at 80% -10%, var(--primary-050), transparent),
        var(--bg);
    padding: 5rem 0 3.5rem;
}
.hero__copy { max-width: 640px; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin: 0 0 1rem; letter-spacing: -.02em; }
.hero__lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 1.75rem; }
.hero__cta { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.5rem; }
.section__head h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }

/* ---------- Product grid ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.product-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(16, 24, 40, .10); }
.product-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--surface-2), #e9edf3);
    display: grid; place-items: center;
}
.product-card__placeholder { font-size: 2.5rem; font-weight: 800; color: #b8c0cc; }
.product-card__body { padding: 1rem 1rem .5rem; flex: 1; }
.product-card__title { margin: 0 0 .35rem; font-size: 1.05rem; }
.product-card__desc { margin: 0; color: var(--muted); font-size: .9rem; }
.product-card__foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1rem 1rem;
}
.price { font-weight: 800; font-size: 1.1rem; }

.badge {
    display: inline-block;
    padding: .2rem .55rem; border-radius: 999px;
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border);
}
/* On product cards the badge overlays the media thumbnail. */
.product-card__media .badge {
    position: absolute; top: .6rem; inset-inline-start: .6rem;
    background: rgba(255, 255, 255, .9);
}
.badge--key { color: var(--primary); }
.badge--file { color: #0b7285; }
.badge--voucher { color: #b8860b; }
.badge--service { color: #6741d9; }

/* ---------- Features ---------- */
.features { background: var(--surface); border-top: 1px solid var(--border); padding: 3rem 0; }
.features__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feature__icon { font-size: 1.75rem; }
.feature h3 { margin: .5rem 0 .35rem; font-size: 1.1rem; }
.feature p { margin: 0; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { margin: 1rem 0; padding: .8rem 1rem; border-radius: var(--radius-sm); font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success-fg); }
.alert-danger { background: var(--danger-bg); color: var(--danger-fg); }

/* ---------- Ad slots ---------- */
.ad-slot { margin: 1rem auto; max-width: var(--container); padding-inline: 20px; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--border); background: var(--surface); }
.site-footer__inner { padding: 2rem 20px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer p { margin: 0; }

/* ---------- Error page ---------- */
.error-page { max-width: 560px; margin: 5rem auto; text-align: center; padding: 0 20px; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--primary); line-height: 1; }

/* ---------- Forms (used by auth/admin later) ---------- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }
.form-control {
    width: 100%; padding: .65rem .8rem; font: inherit;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-050); }
.form-error { color: var(--danger-fg); font-size: .85rem; margin-top: .3rem; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .main-nav { display: none; }
    .features__grid { grid-template-columns: 1fr; }
    .hero { padding: 3rem 0 2rem; }
}

/* Very narrow phones: keep the header on one tidy row. */
@media (max-width: 480px) {
    .brand__name { display: none; }
    .site-header__inner { gap: .5rem; }
    .header-actions { gap: .4rem; }
    .header-actions .btn { padding: .55rem .75rem; }
    .dropdown > summary { padding: .5rem .6rem; }
    .container { padding-inline: 14px; }
}

/* ---------- Tickets & courses ---------- */
.status--open { background: #fff4e0; color: #b76e00; }
.status--answered { background: var(--success-bg); color: var(--success-fg); }
.status--closed { background: var(--surface-2); color: var(--muted); }
.reply { padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .75rem; background: var(--surface); }
.reply--staff { background: var(--primary-050); border-color: #d7defb; }
.reply__who { font-size: .8rem; font-weight: 700; margin-bottom: .35rem; }
.reply__body { white-space: pre-wrap; }
.lesson { margin-bottom: 1.25rem; }
.lesson__title { margin: 0 0 .75rem; font-size: 1.1rem; }
.lesson__video { width: 100%; border-radius: var(--radius-sm); background: #000; max-height: 70vh; }
.lesson__embed { position: relative; padding-top: 56.25%; border-radius: var(--radius-sm); overflow: hidden; }
.lesson__embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson__content { margin-top: .75rem; white-space: pre-wrap; }

/* ---------- Auth pages ---------- */
.auth-page { padding: 3.5rem 0; }
.auth-card { max-width: 420px; margin-inline: auto; padding: 2rem; }
.auth-card__title { margin: 0 0 1.25rem; font-size: 1.5rem; }
.auth-card__alt { margin: 1.25rem 0 0; text-align: center; }
.btn-block { width: 100%; }

/* ---------- Captcha ---------- */
.captcha { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.captcha__img { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.captcha__input { flex: 1; min-width: 120px; text-transform: uppercase; letter-spacing: .15em; }
.captcha-error { color: var(--danger-fg); font-size: .9rem; }

/* ---------- Account ---------- */
.account-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.account-head h1 { margin: 0; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.account-card { padding: 1.1rem 1.25rem; }
.account-card__label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.account-card__value { font-size: 1.15rem; font-weight: 700; margin-top: .25rem; word-break: break-word; }
.account-admin { margin: 1.5rem 0 0; }
.account-subtitle { margin: 2.5rem 0 1rem; font-size: 1.25rem; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .75rem 1rem; text-align: start; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }

.status { padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; text-transform: capitalize; }
.status--pending { background: #fff4e0; color: #b76e00; }
.status--paid, .status--delivered { background: var(--success-bg); color: var(--success-fg); }
.status--failed, .status--refunded { background: var(--danger-bg); color: var(--danger-fg); }

/* ---------- Product detail ---------- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
.product-detail__media { aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--surface-2), #e9edf3); border-radius: var(--radius); display: grid; place-items: center; border: 1px solid var(--border); overflow: hidden; }
.product-card__placeholder--lg { font-size: 5rem; }
.product-detail__title { margin: .5rem 0; font-size: 1.9rem; letter-spacing: -.01em; }
.product-detail__price { font-size: 1.6rem; font-weight: 800; margin-bottom: 1rem; }
.product-detail__desc { color: var(--muted); margin: 1rem 0; }
.stock-in { color: var(--success-fg); font-weight: 600; }
.stock-out { color: var(--danger-fg); font-weight: 600; }
.buy-form { margin: 1.5rem 0; max-width: 340px; }
.buy-form__row { margin-bottom: 1rem; }
.product-detail__back { margin-top: 1.5rem; }

/* ---------- Order detail ---------- */
.order-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.order-head h1 { margin: 0; }
.order-card { margin-bottom: 1.25rem; }
.order-card__body { padding: 1.25rem; }
.order-total td { border-top: 2px solid var(--border); }
.delivered-item { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.delivered-item:last-child { border-bottom: none; }
.delivered-item__name { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.delivered-item__payload { display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }

.twofa-qr { margin: 1rem 0; display: flex; justify-content: center; }
.twofa-qr img, .twofa-qr canvas { border: 1px solid var(--border); border-radius: var(--radius-sm); }

@media (max-width: 760px) { .product-detail { grid-template-columns: 1fr; } }

/* Credits */
.credits-chip { font-variant-numeric: tabular-nums; }
.credits-chip span { display: inline-grid; place-items: center; width: 1.2em; height: 1.2em; margin-left: .35em; border-radius: 50%; background: var(--primary, #3b5bdb); color: #fff; font-size: .8em; line-height: 1; }
.status--cancelled { background: var(--surface-2); color: var(--muted); }
.card__body { padding: 1.25rem 1.5rem; }
.field__hint { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; }
td.ok { color: var(--success-fg); font-weight: 600; }
td.bad { color: var(--danger-fg); font-weight: 600; }
.note { background: var(--surface-2); border-radius: 8px; padding: .8rem 1rem; }
