:root {
    --primary: #5b3bc4;
    --primary-dark: #3d258f;
    --primary-soft: #eee9ff;
    --accent: #f59e0b;
    --success: #16834a;
    --danger: #c0392b;
    --info: #1976d2;
    --text: #24212f;
    --muted: #6f6b7a;
    --surface: #fff;
    --background: #f7f5fb;
    --border: #e6e1ef;
    --shadow: 0 16px 45px rgba(48, 31, 89, .09);
    --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--text);
    background: var(--background);
    font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
.container { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.nav-wrap { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: .4px; }
.brand-mark {
    display: grid; place-items: center; width: 42px; height: 42px;
    color: white; background: linear-gradient(135deg, var(--primary), #896ae8);
    border-radius: 14px; font-weight: 900; box-shadow: 0 8px 20px rgba(91, 59, 196, .28);
}
.main-nav { display: flex; align-items: center; gap: 24px; font-weight: 650; }
.main-nav a:hover { color: var(--primary); }
.cart-link { padding: 10px 14px; background: var(--primary-soft); border-radius: 13px; }
.cart-link span { display: inline-grid; place-items: center; min-width: 23px; height: 23px; margin-left: 5px; color: white; background: var(--primary); border-radius: 20px; font-size: 12px; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 25px; }
.hero {
    padding: 72px 0;
    background:
        radial-gradient(circle at 85% 25%, rgba(255,255,255,.18), transparent 25%),
        linear-gradient(135deg, #321b7b, #7251da 65%, #9b7eef);
    color: white; overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 55px; align-items: center; }
.hero h1 { margin: 0 0 18px; max-width: 700px; font-size: clamp(38px, 6vw, 68px); line-height: 1.03; }
.hero p { margin: 0 0 28px; max-width: 620px; color: rgba(255,255,255,.82); font-size: 18px; }
.hero-card { padding: 25px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2); border-radius: 32px; backdrop-filter: blur(12px); transform: rotate(2deg); }
.hero-card-inner { min-height: 320px; display: grid; place-items: center; background: white; border-radius: 24px; color: var(--primary); font-size: 110px; }
.btn {
    display: inline-flex; justify-content: center; align-items: center; gap: 8px;
    min-height: 46px; padding: 11px 19px; border: 0; border-radius: 14px;
    background: var(--primary); color: white; font-weight: 750; cursor: pointer;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-light { background: white; color: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: var(--danger); }
.btn-sm { min-height: 36px; padding: 7px 12px; border-radius: 10px; font-size: 13px; }
.section { padding: 58px 0; }
.section-soft { background: #f0ecfa; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.section-head h2, .page-title { margin: 0; font-size: clamp(28px, 4vw, 40px); }
.section-head p, .page-subtitle { color: var(--muted); margin: 7px 0 0; }
.category-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.category-card {
    padding: 20px; background: white; border: 1px solid var(--border);
    border-radius: 18px; font-weight: 800; text-align: center; transition: .2s;
}
.category-card:hover { color: var(--primary); border-color: #bcaef0; transform: translateY(-3px); box-shadow: var(--shadow); }
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.product-card { overflow: hidden; background: white; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 8px 24px rgba(41,30,77,.05); }
.product-image { position: relative; aspect-ratio: 1; background: #f1eef8; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.product-card:hover .product-image img { transform: scale(1.045); }
.product-badge { position: absolute; top: 12px; left: 12px; padding: 5px 9px; border-radius: 20px; color: #117640; background: #def7e8; font-size: 12px; font-weight: 800; }
.product-body { padding: 17px; }
.product-title { min-height: 45px; margin: 0 0 8px; font-size: 16px; line-height: 1.35; }
.product-price { color: var(--primary); font-size: 20px; font-weight: 900; }
.product-old-price { margin-left: 7px; color: var(--muted); font-size: 13px; text-decoration: line-through; }
.product-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.page-header { padding: 42px 0 24px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 28px; }
.form-control {
    width: 100%; min-height: 47px; padding: 11px 14px;
    border: 1px solid var(--border); border-radius: 13px; background: white; color: var(--text);
}
.toolbar .form-control { width: auto; min-width: 190px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 750; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 22px; }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 24px; align-items: start; }
.summary-card { position: sticky; top: 95px; }
.summary-row { display: flex; justify-content: space-between; gap: 15px; padding: 9px 0; }
.summary-row.total { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 19px; font-weight: 900; }
.cart-item { display: grid; grid-template-columns: 92px minmax(0,1fr) 110px 120px 42px; gap: 16px; align-items: center; padding: 17px; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: 0; }
.cart-thumb { width: 92px; height: 92px; border-radius: 15px; object-fit: cover; background: #f1eef8; }
.quantity-input { width: 78px; }
.auth-wrap { width: min(480px, calc(100% - 32px)); margin: 55px auto; }
.auth-card { padding: 30px; }
.flash { margin-top: 14px; padding: 13px 16px; border-radius: 12px; font-weight: 650; }
.flash-success { color: #0d6638; background: #dcf7e8; }
.flash-error { color: #8e211a; background: #fee6e4; }
.address-card, .order-card { padding: 20px; margin-bottom: 14px; background: white; border: 1px solid var(--border); border-radius: 18px; }
.address-card.default { border: 2px solid var(--primary); }
.address-head, .order-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; }
.badge, .status {
    display: inline-flex; align-items: center; padding: 5px 10px;
    border-radius: 30px; font-size: 12px; font-weight: 850;
}
.badge { color: var(--primary); background: var(--primary-soft); }
.status-success { color: #0b723b; background: #dcf7e8; }
.status-info { color: #155fa4; background: #e0f0ff; }
.status-warning { color: #9a5c00; background: #fff1ce; }
.status-danger { color: #9e2a21; background: #fee4e2; }
.status-neutral { color: #5c5768; background: #efedf3; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--border); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f4f1fa; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.empty-state { padding: 65px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 65px; margin-bottom: 12px; }
.pagination { display: flex; justify-content: center; gap: 7px; margin-top: 24px; }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 38px; height: 38px; background: white; border: 1px solid var(--border); border-radius: 10px; }
.pagination .active { color: white; background: var(--primary); }
.site-footer { margin-top: 60px; padding-top: 52px; color: #dcd4f7; background: #24154f; }
.footer-grid { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 40px; padding-bottom: 40px; }
.site-footer h4 { margin-top: 0; color: white; }
.site-footer a { display: block; margin: 8px 0; }
.footer-brand { color: white; }
.copyright { padding: 18px; text-align: center; border-top: 1px solid rgba(255,255,255,.1); }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 245px minmax(0,1fr); min-height: 100vh; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; color: #e8e2ff; background: #251453; }
.admin-sidebar nav { margin-top: 30px; }
.admin-sidebar nav a { display: flex; gap: 10px; margin: 7px 0; padding: 12px 13px; border-radius: 12px; font-weight: 700; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { color: white; background: rgba(255,255,255,.12); }
.admin-content { min-width: 0; padding: 28px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; background: white; border: 1px solid var(--border); border-radius: 18px; }
.stat-number { margin-top: 8px; font-size: 28px; font-weight: 900; }

@media (max-width: 1000px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .two-column { grid-template-columns: 1fr; }
    .summary-card { position: static; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .menu-toggle { display: block; }
    .main-nav { display: none; position: absolute; top: 72px; left: 16px; right: 16px; padding: 18px; align-items: stretch; flex-direction: column; gap: 13px; background: white; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
    .main-nav.open { display: flex; }
    .hero { padding: 48px 0; }
    .hero-grid { grid-template-columns: 1fr; }
    .hero-card { display: none; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .cart-item { grid-template-columns: 72px 1fr; }
    .cart-item > :nth-child(n+3) { grid-column: 2; }
    .footer-grid { grid-template-columns: 1fr; }
    .admin-shell { display: block; }
    .admin-sidebar { position: static; width: 100%; height: auto; }
    .admin-sidebar nav { display: flex; flex-wrap: wrap; margin-top: 15px; }
    .admin-content { padding: 18px; }
}
@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .address-head, .order-head, .section-head { align-items: stretch; flex-direction: column; }
}
