:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-alt: #e8eef7;
    --text: #1f2c3d;
    --muted: #617185;
    --line: #d5deea;
    --brand: #1f6feb;
    --brand-dark: #164ea8;
    --accent: #0f9d7a;
    --danger: #d94c4c;
    --shadow: 0 18px 45px rgba(31, 44, 61, 0.08);
}

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

html, body {
    min-height: 100%;
    background: radial-gradient(circle at top left, #eef4ff 0, #f4f7fb 38%, #edf2f8 100%);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

body {
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
}

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

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(17, 29, 48, 0.94);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo h1 {
    color: #fff;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    flex: 1;
    margin-left: 2rem;
}

.nav-menu a,
.admin-link {
    color: #dfe8f5;
    text-decoration: none;
    font-weight: 600;
    padding: 0.25rem 0.4rem;
    border-bottom: 2px solid transparent;
}

.nav-menu a:hover,
.nav-menu a.active,
.admin-link:hover {
    border-color: #8ec5ff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-label {
    color: #dfe8f5;
    font-weight: 700;
}

.auth-links {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.auth-links a,
.link-button {
    color: #dfe8f5;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
}

.cart-toggle,
.form-actions button,
.status-card a {
    border: none;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

.cart-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), #4ca8ff);
    color: #fff;
    padding: 0.7rem 1.1rem;
    font-weight: 700;
}

.cart-badge {
    min-width: 1.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #fff;
    color: var(--brand-dark);
    text-align: center;
}

.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 2rem 0;
    color: var(--muted);
}

main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

.hero {
    background: linear-gradient(145deg, #0f2748, #244f7a 60%, #3a7abb);
    color: #fff;
    border-radius: 28px;
    padding: 3rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.hero-kicker,
.detail-kicker,
.product-category-badge {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    font-weight: 700;
}

.hero h2 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    margin: 0.4rem 0 1rem;
}

.toolbar,
.admin-panel,
.product-detail,
.status-card {
    background: var(--surface);
    border: 1px solid rgba(213, 222, 234, 0.85);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: end;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.section-title,
.category-title,
.related-products h2,
.admin-panel h3 {
    font-size: 1.8rem;
    margin-bottom: 0.35rem;
}

.section-subtitle,
#productCountText,
.section-heading p,
.product-description,
.footer-column p,
.footer-column li,
.detail-kicker {
    color: var(--muted);
}

.filter-form,
.admin-form {
    display: grid;
    gap: 0.7rem;
}

.filter-form label,
.admin-form label,
.quantity-selector label {
    font-weight: 700;
}

select,
input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.8rem 0.9rem;
    font: inherit;
    background: #fff;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--surface);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(213, 222, 234, 0.8);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 42px rgba(31, 44, 61, 0.14);
}

.product-image-link {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(145deg, #edf4ff, #dde7f4);
}

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

.product-card-body {
    padding: 1rem;
    display: grid;
    gap: 0.65rem;
}

.product-name-link {
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
}

.product-price,
.product-price-large {
    color: var(--accent);
    font-weight: 800;
}

.product-price-large {
    font-size: 2rem;
}

.add-to-cart-btn,
.form-actions button {
    border-radius: 14px;
    padding: 0.85rem 1rem;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
}

.add-to-cart-btn:hover,
.form-actions button:hover,
.status-card a:hover {
    background: var(--brand-dark);
}

.add-to-cart-btn.large {
    min-width: 220px;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(320px, 1fr);
    gap: 2rem;
    padding: 2rem;
    margin-bottom: 2rem;
}

.product-image-large {
    width: 100%;
    border-radius: 18px;
    background: var(--surface-alt);
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.product-info-section {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.product-actions {
    display: flex;
    align-items: end;
    gap: 1rem;
}

.quantity-selector {
    min-width: 120px;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: var(--surface);
    box-shadow: -20px 0 40px rgba(17, 29, 48, 0.18);
    z-index: 1000;
    transition: right 0.25s ease;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header,
.cart-footer {
    padding: 1.2rem;
    border-bottom: 1px solid var(--line);
}

.cart-footer {
    border-top: 1px solid var(--line);
    border-bottom: none;
    margin-top: auto;
}

.close-cart {
    background: transparent;
    color: var(--text);
    font-size: 1.2rem;
}

.cart-items {
    padding: 1rem;
    overflow-y: auto;
}

.cart-item {
    display: grid;
    grid-template-columns: 1fr 84px auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfdff;
    margin-bottom: 0.8rem;
}

.cart-item-price {
    color: var(--muted);
    font-size: 0.92rem;
}

.cart-item-remove,
.danger-btn {
    background: var(--danger);
}

.secondary-btn {
    background: #7f8ea3;
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 30, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 999;
}

.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.admin-intro {
    margin-bottom: 1.5rem;
}

.auth-main {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 90px);
}

.auth-card {
    width: min(100%, 520px);
    background: var(--surface);
    border: 1px solid rgba(213, 222, 234, 0.85);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.auth-card h2 {
    margin-bottom: 0.4rem;
}

.auth-switch {
    margin-top: 1rem;
    color: var(--muted);
}

.form-status {
    min-height: 1.5rem;
    margin-top: 0.4rem;
    font-weight: 700;
    color: var(--accent);
}

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

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.admin-panel {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.4rem;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 1.25rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.8rem;
    border-bottom: 1px solid var(--line);
}

footer {
    margin-top: auto;
    background: #102138;
    color: #dce4ef;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.footer-column h4 {
    margin-bottom: 0.6rem;
}

.footer-column ul {
    list-style: none;
    display: grid;
    gap: 0.45rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 2rem;
    text-align: center;
    color: #9eb0c4;
}

.empty-state,
.empty-cart {
    padding: 1rem;
    color: var(--muted);
}

.status-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.status-card {
    max-width: 520px;
    padding: 2rem;
    text-align: center;
}

.status-card h1 {
    margin-bottom: 0.7rem;
}

.status-card a {
    display: inline-block;
    margin-top: 1rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    padding: 0.8rem 1.2rem;
}

.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1200;
    border-radius: 16px;
    background: #103d2f;
    color: #fff;
    padding: 0.9rem 1.1rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
    transform: translateY(-10px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

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

@media (max-width: 860px) {
    .nav-container,
    main,
    .breadcrumb,
    .footer-content,
    .footer-bottom {
        padding-left: 1rem;
        padding-right: 1rem;
    }

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

    .product-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .nav-container {
        flex-wrap: wrap;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .hero,
    .admin-panel,
    .toolbar,
    .product-detail {
        padding: 1.25rem;
    }

    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

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