:root {
    --bg: #f5f1e8;
    --bg-soft: #efe8da;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --text: #1e1d1a;
    --text-soft: #5d5a52;
    --line: #e2d8c6;
    --brand: #1f6f78;
    --brand-strong: #15545b;
    --accent: #c75c3d;
    --success: #2f7a4f;
    --danger: #a6342a;
    --shadow: 0 10px 30px rgba(40, 31, 21, 0.09);
    --radius-md: 12px;
    --radius-lg: 18px;
}

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

body {
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

.container {
    width: min(1180px, 92vw);
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: var(--brand);
}

a:hover {
    color: var(--brand-strong);
}

header {
    color: var(--text);
    border-bottom: 1px solid rgba(120, 94, 54, 0.15);
    backdrop-filter: blur(4px);
}

header .container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    flex-wrap: wrap;
}

header h1 {
    font-size: 1.55rem;
    letter-spacing: 0.4px;
    margin-right: auto;
}

.auth-status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#user-indicator {
    font-weight: 600;
    color: var(--text-soft);
    margin-right: 4px;
}

.auth-status-bar a,
.auth-status-bar button,
.shopping-list-trigger,
.btn,
.add-to-cart-btn,
.add-to-cart-btn-large,
.checkout-btn {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}

.auth-status-bar a,
.auth-status-bar button {
    padding: 6px 12px;
    background: rgba(31, 111, 120, 0.09);
    color: var(--brand-strong);
    font-size: 0.84rem;
    font-weight: 600;
}

.auth-status-bar a:hover,
.auth-status-bar button:hover {
    background: rgba(31, 111, 120, 0.17);
}

.shopping-list-widget {
    margin-left: 2px;
    position: relative;
}

.shopping-list-trigger {
    background: linear-gradient(135deg, #cd6f4f, #b84d34);
    color: #fff;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 8px 18px rgba(184, 77, 52, 0.25);
}

.shopping-list-trigger:hover {
    transform: translateY(-1px);
}

.shopping-list-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px;
    min-width: 320px;
    box-shadow: var(--shadow);
    z-index: 20;
}

.shopping-list-dropdown.is-open {
    display: block;
}

.is-hidden {
    display: none !important;
}

.is-visible-block {
    display: block !important;
}

.is-visible-flex {
    display: flex !important;
}

.shopping-list-widget:hover .shopping-list-dropdown,
.shopping-list-widget:focus-within .shopping-list-dropdown {
    display: block;
}

.shopping-list-dropdown h3 {
    margin-bottom: 10px;
    color: var(--text);
    font-size: 1rem;
}

.cart-items {
    list-style: none;
    margin-bottom: 12px;
}

.cart-items li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #efe5d6;
}

.item-name {
    flex: 1;
}

.qty-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #d5c8b6;
    border-radius: 8px;
    background: #f8f1e6;
    cursor: pointer;
}

.quantity-input {
    width: 56px;
    padding: 4px;
    border: 1px solid #d8ccb9;
    border-radius: 8px;
    text-align: center;
}

.item-price {
    min-width: 62px;
    text-align: right;
    font-weight: 600;
}

.item-remove {
    border: 0;
    background: transparent;
    color: var(--danger);
    font-size: 1.1rem;
    cursor: pointer;
}

.cart-total {
    border-top: 1px solid #efe5d6;
    margin-bottom: 10px;
    padding-top: 10px;
    text-align: right;
    font-weight: 700;
}

.cart-empty {
    color: var(--text-soft);
    font-style: italic;
    justify-content: center;
}

.checkout-btn {
    width: 100%;
    background: var(--success);
    color: #fff;
    padding: 10px;
    font-weight: 700;
}

.breadcrumb {
    border-bottom: 1px solid rgba(120, 94, 54, 0.13);
    background: rgba(255, 255, 255, 0.35);
}

.breadcrumb .container {
    padding: 10px 0;
}

.breadcrumb ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-soft);
}

.breadcrumb li:not(:last-child)::after {
    content: ">";
    margin-left: 6px;
    color: #857864;
}

.main-content {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
    margin: 26px 0;
}

.categories-sidebar,
.product-details,
.product-card,
.auth-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.categories-sidebar {
    padding: 20px;
    height: fit-content;
}

.categories-sidebar h2,
.products-section h2 {
    margin-bottom: 14px;
}

.category-list {
    list-style: none;
}

.category-list li {
    border-bottom: 1px solid #f0e7d8;
}

.category-list a {
    display: block;
    padding: 9px 0;
    color: var(--text-soft);
}

.category-list a:hover,
.active-cat {
    color: var(--brand-strong);
    font-weight: 700;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.product-card {
    padding: 14px;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card:hover {
    transform: translateY(-3px);
}

.product-link {
    color: inherit;
}

.product-thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
    background: #f7f1e7;
}

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

.product-name {
    font-size: 1.02rem;
    margin-bottom: 6px;
}

.product-price {
    color: var(--accent);
    font-size: 1.22rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.add-to-cart-btn,
.add-to-cart-btn-large {
    background: var(--brand);
    color: #fff;
    padding: 10px 16px;
    font-weight: 700;
}

.add-to-cart-btn:hover,
.add-to-cart-btn-large:hover {
    background: var(--brand-strong);
}

#product-error {
    display: none;
    margin: 28px 0;
    padding: 18px;
    text-align: center;
    color: var(--danger);
    background: #fdebe9;
    border: 1px solid #f4c6c1;
    border-radius: var(--radius-md);
}

#product-details {
    display: none;
}

.product-details {
    margin: 26px 0;
    padding: 24px;
    display: flex;
    gap: 24px;
}

.product-images {
    flex: 0 0 min(500px, 48%);
}

.product-image {
    width: 100%;
    border-radius: 14px;
    object-fit: contain;
    background: #f8f2e8;
}

.product-info {
    flex: 1;
}

.product-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

.product-price-large {
    font-size: 1.8rem;
    color: var(--accent);
    font-weight: 800;
    margin-bottom: 18px;
}

.product-description {
    margin-bottom: 18px;
}

.product-description h3 {
    margin-bottom: 8px;
}

footer {
    margin-top: 28px;
    border-top: 1px solid rgba(120, 94, 54, 0.15);
    padding: 20px 0;
}

.btn {
    padding: 9px 15px;
    font-weight: 700;
}

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

.btn-primary:hover {
    background: var(--brand-strong);
}

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

.btn-success:hover {
    background: #276641;
}

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

.auth-shell {
    max-width: 560px;
    margin-top: 42px;
    margin-bottom: 42px;
}

.auth-card {
    padding: 24px;
}

.auth-title {
    margin-bottom: 14px;
    font-size: 1.5rem;
}

.auth-msg {
    min-height: 24px;
    margin-bottom: 10px;
    color: var(--danger);
}

.auth-msg-success {
    color: var(--success);
}

.auth-msg-error {
    color: var(--danger);
}

.auth-field {
    margin-bottom: 12px;
}

.auth-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-soft);
}

.auth-field input,
.auth-field select,
.auth-field textarea {
    width: 100%;
    border: 1px solid #d8ccb9;
    background: #fff;
    border-radius: 10px;
    padding: 10px 11px;
    font: inherit;
}

.auth-links p {
    margin-top: 10px;
}

@media (max-width: 1080px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    header .container {
        align-items: flex-start;
    }

    header h1 {
        width: 100%;
        margin-right: 0;
    }

    .shopping-list-widget {
        margin-left: auto;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .product-details {
        flex-direction: column;
    }

    .product-images {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(1180px, 94vw);
    }

    .auth-status-bar {
        width: 100%;
        order: 2;
    }

    .shopping-list-widget {
        order: 3;
    }

    .shopping-list-dropdown {
        right: -8px;
        min-width: min(320px, 90vw);
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

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