:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --accent: #e85d4c;
    --accent-hover: #d44a39;
    --border: #e5e7eb;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

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

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 480px; }

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
}

.logo-icon { font-size: 1.4rem; }

.nav { display: flex; align-items: center; gap: 24px; }

.nav-link {
    color: var(--text);
    font-weight: 500;
    font-size: .925rem;
    position: relative;
}

.nav-link-muted { color: var(--text-muted); }

.cart-link { display: flex; align-items: center; gap: 6px; }

.cart-badge {
    background: var(--accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

.main { flex: 1; }

/* Hero */
.hero {
    padding: 48px 0 32px;
    text-align: center;
}

.hero-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 8px;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Categories */
.categories { padding-bottom: 24px; }

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
    flex-shrink: 0;
    padding: 10px 20px;
    border-radius: 100px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.category-tab:hover { color: var(--text); border-color: #ccc; }

.category-tab.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

/* Product grid */
.catalog { padding-bottom: 64px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.product-card-link { flex: 1; color: inherit; }
.product-card-link:hover { color: inherit; }

.product-image {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info { padding: 16px; }

.product-category {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 500;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 4px 0 8px;
    line-height: 1.3;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.stars { display: inline-flex; gap: 1px; }

.star { color: #d1d5db; font-size: .85rem; }
.star.filled { color: #fbbf24; }

.rating-count { font-size: .8rem; color: var(--text-muted); }

.product-kbju {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.product-kbju span {
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 6px;
}

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

.product-price {
    font-weight: 700;
    font-size: 1.05rem;
}

.product-price-lg { font-size: 1.5rem; }

.product-card .btn-add-cart {
    margin: 0 16px 16px;
    width: calc(100% - 32px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .925rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-block { width: 100%; }

/* Product detail */
.product-page { padding: 32px 0 64px; }

.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: .9rem;
}

.back-link:hover { color: var(--text); }

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
}

.product-detail-image {
    border-radius: var(--radius);
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    aspect-ratio: 1;
}

.product-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-detail-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 8px 0 12px;
    letter-spacing: -.02em;
}

.product-description {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.7;
}

.kbju-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.kbju-item {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.kbju-value { display: block; font-weight: 700; font-size: 1.1rem; }
.kbju-label { font-size: .75rem; color: var(--text-muted); }

.product-detail-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Reviews */
.reviews-section { border-top: 1px solid var(--border); padding-top: 40px; }

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.review-form {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.review-hint { color: var(--text-muted); margin-bottom: 20px; }

.reviews-list { display: flex; flex-direction: column; gap: 16px; }

.review-card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.review-header time {
    color: var(--text-muted);
    font-size: .8rem;
    margin-left: auto;
}

.rating-input {
    display: flex;
    flex-direction: row-reverse;
    gap: 4px;
}

.rating-input input { display: none; }

.rating-input label {
    font-size: 1.5rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color var(--transition);
}

.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label { color: #fbbf24; }

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .925rem;
    background: var(--surface);
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Auth */
.auth-page { padding: 48px 0 64px; }

.auth-card {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 28px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: .9rem;
    color: var(--text-muted);
}

/* Cart */
.cart-page, .checkout-page, .profile-page { padding: 32px 0 64px; }

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: -.02em;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

.cart-items { display: flex; flex-direction: column; gap: 12px; }

.cart-item {
    display: grid;
    grid-template-columns: 72px 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.cart-item-image {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg);
}

.cart-item-info h3 { font-size: .95rem; font-weight: 600; margin-bottom: 4px; }

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.qty-btn:hover { background: var(--border); }

.qty-value { font-weight: 600; min-width: 20px; text-align: center; }

.cart-item-subtotal { font-weight: 700; white-space: nowrap; }

.cart-item-remove {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.cart-item-remove:hover { color: var(--accent); }

.cart-summary {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 88px;
}

.cart-summary h2 { font-size: 1.1rem; margin-bottom: 16px; }

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: var(--text-muted);
}

.summary-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 16px;
}

.checkout-summary {
    display: flex;
    justify-content: space-between;
    font-size: 1.15rem;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    margin-bottom: 16px;
}

.order-success {
    text-align: center;
    padding: 48px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.success-icon {
    width: 64px;
    height: 64px;
    background: #10b981;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 20px;
}

.order-success h2 { margin-bottom: 8px; }
.order-success p { color: var(--text-muted); margin-bottom: 24px; }

/* Profile */
.profile-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}

.profile-card h2 { margin-bottom: 4px; }
.profile-card p { color: var(--text-muted); }

.orders-list { display: flex; flex-direction: column; gap: 12px; }

.order-card {
    background: var(--surface);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.order-header {
    display: flex;
    justify-content: space-between;
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

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

.order-status {
    font-size: .8rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg);
    text-transform: capitalize;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 16px;
}

.alert-error { background: #fef2f2; color: #dc2626; }
.alert-success { background: #ecfdf5; color: #059669; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 20px;
}

.empty-cart { text-align: center; }
.empty-cart .btn { margin-top: 16px; }

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: auto;
}

.footer-inner { text-align: center; }

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 8px;
}

.footer-text { color: var(--text-muted); font-size: .875rem; margin-bottom: 8px; }
.footer-copy { color: var(--text-muted); font-size: .8rem; }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: #fff;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all .3s ease;
    z-index: 1000;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }

    .nav {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 20px;
        gap: 16px;
        border-bottom: 1px solid var(--border);
        transform: translateY(-120%);
        opacity: 0;
        transition: all .3s ease;
    }

    .nav.open { transform: translateY(0); opacity: 1; }

    .product-detail { grid-template-columns: 1fr; gap: 24px; }

    .kbju-grid { grid-template-columns: repeat(2, 1fr); }

    .cart-layout { grid-template-columns: 1fr; }

    .cart-item {
        grid-template-columns: 60px 1fr;
        grid-template-rows: auto auto;
    }

    .cart-item-qty { grid-column: 1 / -1; }
    .cart-item-subtotal { grid-column: 2; }
    .cart-item-remove { position: absolute; right: 16px; top: 16px; }

    .cart-item { position: relative; }

    .auth-card { padding: 28px 20px; }
}
