/* =============================================
   DESIGN TOKENS
============================================= */
:root {
    --font-body: 'Inter', sans-serif;
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
    --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    --color-bg: #f7f6f2;
    --color-surface: #f9f8f5;
    --color-surface-2: #ffffff;
    --color-border: #d4d1ca;
    --color-divider: #dcd9d5;
    --color-text: #28251d;
    --color-text-muted: #7a7974;
    --color-text-faint: #bab9b4;
    --color-primary: #01696f;
    --color-primary-hover: #0c4e54;
    --color-error: #a12c7b;
    --color-success: #437a22;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
    --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
    --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);

    --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
    --content-wide: 1200px;
}

/* =============================================
   BASE RESET
============================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100dvh;
    line-height: 1.6;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

ul {
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* =============================================
   LAYOUT
============================================= */
.container {
    max-width: var(--content-wide);
    margin-inline: auto;
    padding-inline: var(--space-6);
}

.main-content {
    padding-top: 88px;
    padding-bottom: var(--space-10);
}

/* =============================================
   SHOP LAYOUT
============================================= */
.shop-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-8);
    align-items: start;
}

/* Sidebar Categories */

.sidebar h3 {
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.sidebar-links a {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    transition: background var(--transition), color var(--transition);
}

.sidebar-links a:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.sidebar-links a.active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

/* =============================================
   PRODUCT LIST
============================================= */
.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.shop-header h2 {
    font-size: var(--text-lg);
    font-weight: 700;
}

.product-count {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.product-card {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: var(--space-5);
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.product-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    flex-shrink: 0;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.product-category {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-primary);
}

.product-name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-text);
}

.product-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 55ch;
}

.product-price {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-primary);
}

.product-stock {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
}

.product-stock.low {
    color: var(--color-error);
}

.product-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* Quantity Selector */
.qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--color-bg);
}

.qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text-muted);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.qty-btn:hover {
    background: var(--color-primary);
    color: #fff;
}

.qty-input {
    width: 44px;
    height: 36px;
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 700;
    border: none;
    background: transparent;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* Add to Cart Button */
.btn-cart {
    padding: var(--space-2) var(--space-5);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    white-space: nowrap;
}

.btn-cart:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-cart:active {
    transform: scale(0.97);
}

/* =============================================
   CHECKOUT PAGE
============================================= */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: var(--space-8);
    align-items: start;
}

.checkout-form-box,
.order-summary-box {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-divider);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.form-group label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}

.form-group input,
.form-group textarea {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    background: var(--color-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Order Summary */
.summary-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.summary-item-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    flex-shrink: 0;
}

.summary-item-info {
    flex: 1;
}

.summary-item-name {
    font-size: var(--text-sm);
    font-weight: 600;
}

.summary-item-qty {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.summary-item-price {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-primary);
}

.summary-divider {
    border: none;
    border-top: 1px solid var(--color-divider);
    margin-block: var(--space-4);
}

.summary-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-lg);
    font-weight: 700;
}

.summary-total-amount {
    color: var(--color-primary);
}

.btn-pay {
    width: 100%;
    padding: var(--space-4);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: 700;
    margin-top: var(--space-6);
    transition: background var(--transition), box-shadow var(--transition);
}

.btn-pay:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

/* =============================================
   SUCCESS / FAILED PAGES
============================================= */
.status-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-16);
    gap: var(--space-6);
}

.status-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-icon.success {
    background: #d4dfcc;
    color: var(--color-success);
}

.status-icon.failed {
    background: #e0ced7;
    color: var(--color-error);
}

.status-page h1 {
    font-size: var(--text-xl);
    font-weight: 700;
}

.status-page p {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    max-width: 40ch;
}

.btn-home {
    padding: var(--space-3) var(--space-8);
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--text-sm);
    transition: background var(--transition);
}

.btn-home:hover {
    background: var(--color-primary-hover);
}

/* =============================================
   EMPTY STATE
============================================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-16) var(--space-8);
    color: var(--color-text-muted);
    gap: var(--space-4);
}

.empty-state svg {
    color: var(--color-text-faint);
}

.empty-state h3 {
    font-size: var(--text-lg);
    color: var(--color-text);
}

/* =============================================
   ALERT / FLASH MESSAGES
============================================= */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-6);
}

.alert-success {
    background: #d4dfcc;
    color: var(--color-success);
}

.alert-error {
    background: #e0ced7;
    color: var(--color-error);
}

/* =============================================
   DYNAMIC PAGE CONTENT
============================================= */
.page-content-area {
    color: var(--color-text);
    line-height: 1.8;
    font-size: var(--text-base);
}

.page-content-area h1,
.page-content-area h2,
.page-content-area h3,
.page-content-area h4 {
    margin: 0 0 14px;
    color: var(--color-text);
}

.page-content-area p {
    margin: 0 0 16px;
    color: var(--color-text);
}

.page-content-area ul,
.page-content-area ol {
    margin: 0 0 16px 20px;
}

.page-content-area a {
    color: var(--color-primary);
    text-decoration: none;
}

.page-content-area a:hover {
    text-decoration: underline;
}

/* =============================================
   FOOTER
============================================= */
.site-footer {
    margin-top: 56px;
    background: #111111;
    color: rgba(255,255,255,0.86);
    padding-top: 48px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.footer-col {
    min-width: 0;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 1.55rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 16px;
}

.footer-text {
    color: rgba(255,255,255,0.70);
    max-width: 34ch;
    line-height: 1.8;
    font-size: 15px;
}

.footer-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: #ffffff;
    margin: 4px 0 16px;
}

.footer-links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links-list a {
    color: rgba(255,255,255,0.74);
    text-decoration: none;
    font-size: 15px;
    transition: 0.25s ease;
}

.footer-links-list a:hover {
    color: #ffffff;
    transform: translateX(3px);
}

.footer-bottom {
    margin-top: 34px;
    padding: 18px 0 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    color: rgba(255,255,255,0.58);
    font-size: 14px;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #01696f;
    color: #ffffff;
    border-color: #01696f;
}

.btn-primary:hover {
    background: #0c4e54;
    border-color: #0c4e54;
    color: #ffffff;
}

.btn-secondary {
    background: #f3f0ec;
    color: #28251d;
    border-color: #d4d1ca;
}

.btn-secondary:hover {
    background: #e7e2dc;
    color: #28251d;
}

.btn-danger {
    background: #a12c2c;
    color: #ffffff;
    border-color: #a12c2c;
}

.btn-danger:hover {
    background: #7f1f1f;
    border-color: #7f1f1f;
    color: #ffffff;
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 900px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        align-items: center;
        top: auto;
    }

    .sidebar h3 {
        width: 100%;
    }

    .sidebar-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .site-footer {
        padding-top: 36px;
    }
}

@media (max-width: 600px) {
    .container {
        padding-inline: var(--space-4);
    }

    .main-content {
        padding-top: 56px;
        padding-bottom: var(--space-8);
    }

    .product-card {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto;
    }

    .product-img {
        width: 80px;
        height: 80px;
    }

    .product-action {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
    }

    .shop-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .checkout-form-box,
    .order-summary-box {
        padding: var(--space-6);
    }
}