:root {
    --color-primary: #1f6f3e;
    --color-primary-dark: #17532e;
    --color-bg: #ffffff;
    --color-muted: #f4f4f2;
    --color-text: #222;
    --color-border: #ddd;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
}

a { color: var(--color-primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--color-border); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding: 0.8rem 1rem; }
.brand { text-decoration: none; }
.brand-name { font-size: 1.4rem; font-weight: 700; color: var(--color-primary); }
.brand-logo { max-height: 48px; display: block; }
.search { flex: 1; display: flex; gap: 0.4rem; }
.search input { flex: 1; padding: 0.45rem 0.6rem; border: 1px solid var(--color-border); border-radius: 4px; }
.header-actions { display: flex; gap: 1rem; align-items: center; }
.header-actions a { text-decoration: none; }
.cart-link { font-weight: 600; }

.category-nav { background: var(--color-muted); }
.category-nav .container { display: flex; gap: 1.2rem; flex-wrap: wrap; padding: 0.5rem 1rem; }
.category-nav a { text-decoration: none; font-weight: 500; color: var(--color-text); }
.category-nav a:hover { color: var(--color-primary); }

/* Flash messages */
.flash { padding: 0.7rem 1rem; border-radius: 4px; margin: 1rem 0; }
.flash-success { background: #e3f5e9; border: 1px solid #9fd6b0; }
.flash-notice { background: #fff7e0; border: 1px solid #eeda9d; }
.flash-error { background: #fdeaea; border: 1px solid #f2b8b8; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
}
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-link { border: none; background: none; color: var(--color-primary); cursor: pointer; padding: 0; }

/* Product grid */
.hero { text-align: center; padding: 2rem 0 1rem; }
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}
.product-card {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.8rem;
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.product-card:hover { border-color: var(--color-primary); }
.product-card img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.product-card-noimage { width: 100%; aspect-ratio: 1; background: var(--color-muted); border-radius: 4px; }
.product-card-noimage.large { max-width: 420px; }
.product-card-name { font-weight: 500; }
.product-card-price { color: var(--color-primary); font-weight: 700; }

/* Product page */
.product-page { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 2rem; margin-top: 1.5rem; }
.product-page-images img { width: 100%; object-fit: contain; }
.manufacturer { color: #666; }
.variants { margin: 1rem 0; display: flex; flex-direction: column; gap: 0.6rem; }
.variant-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
}
.variant-name { flex: 1; }
.variant-price { font-weight: 700; }
.variant-price s { color: #999; font-weight: 400; margin-right: 0.4rem; }

@media (max-width: 720px) {
    .product-page { grid-template-columns: 1fr; }
    .header-inner { flex-wrap: wrap; }
    .search { order: 3; width: 100%; flex-basis: 100%; }
}

/* Cart & checkout */
.cart-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.cart-table th, .cart-table td { text-align: left; padding: 0.6rem; border-bottom: 1px solid var(--color-border); }
.cart-table tfoot td { font-weight: 700; border-top: 2px solid var(--color-text); }
.cart-table input[type="number"] { width: 4.5rem; padding: 0.3rem; }
.cart-actions { text-align: right; }

.checkout-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.checkout-form fieldset { border: 1px solid var(--color-border); border-radius: 6px; margin-bottom: 1.2rem; padding: 1rem; }
.checkout-form label { display: block; margin: 0.5rem 0 0.2rem; font-weight: 500; }
.checkout-form input, .checkout-form select, .checkout-form textarea {
    width: 100%; padding: 0.5rem; border: 1px solid var(--color-border); border-radius: 4px;
}
.checkout-summary { background: var(--color-muted); border-radius: 6px; padding: 1rem 1.4rem; align-self: start; }
.summary-total { border-top: 1px solid var(--color-border); padding-top: 0.8rem; }

@media (max-width: 720px) {
    .checkout-layout { grid-template-columns: 1fr; }
}

/* Payment stub */
.payment-stub { max-width: 480px; margin: 3rem auto; border: 1px solid var(--color-border); border-radius: 8px; padding: 2rem; text-align: center; }
.payment-stub-note { color: #946200; background: #fff7e0; padding: 0.5rem; border-radius: 4px; }
.payment-stub form { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; }

/* Forms (security pages) */
.auth-form { max-width: 420px; margin: 2rem auto; }
.auth-form label { display: block; margin: 0.7rem 0 0.2rem; font-weight: 500; }
.auth-form input { width: 100%; padding: 0.5rem; border: 1px solid var(--color-border); border-radius: 4px; }
.auth-form button { margin-top: 1.2rem; }

/* Footer */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--color-border); background: var(--color-muted); padding: 1.5rem 0; font-size: 0.9rem; color: #555; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; margin: 1.5rem 0; }
.pagination a, .pagination .current { padding: 0.3rem 0.7rem; border: 1px solid var(--color-border); border-radius: 4px; text-decoration: none; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.subcategories { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.subcategories a {
    padding: 0.3rem 0.8rem; border: 1px solid var(--color-border); border-radius: 999px;
    text-decoration: none; color: var(--color-text); font-size: 0.92rem;
}
.subcategories a:hover { border-color: var(--color-primary); color: var(--color-primary); }
