@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
    --bg: #0c1017;
    --bg-elevated: #121822;
    --surface: #161d2a;
    --surface-2: #1c2535;
    --surface-hover: #252f42;
    --text: #eef2f7;
    --muted: #8b98b0;
    --accent: #4aa8ff;
    --accent-soft: rgba(74, 168, 255, 0.18);
    --accent-hover: #6bb8ff;
    --danger: #f07178;
    --success: #7fd99a;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
    --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --transition: 0.22s ease;
}

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

html {
    height: 100%;
}

body.page-body {
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    position: relative;
}

body.page-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(ellipse 120% 80% at 0% -20%, rgba(74, 168, 255, 0.12), transparent 50%),
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(127, 217, 154, 0.06), transparent 45%),
        radial-gradient(ellipse 60% 50% at 50% 100%, rgba(240, 113, 120, 0.05), transparent 40%);
}

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

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(22, 29, 42, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand:hover {
    text-decoration: none;
    filter: brightness(1.08);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
}

.main-nav > a {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.main-nav > a:hover {
    color: var(--text);
    background: var(--surface-hover);
    text-decoration: none;
}

.user-greeting {
    color: var(--muted);
    font-size: 0.85rem;
    padding-left: 0.35rem;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.35rem 3.5rem;
}

.site-footer {
    margin-top: auto;
    padding: 1.75rem 1.25rem;
    text-align: center;
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer p {
    margin: 0.2rem 0;
}

.site-footer p:first-child {
    color: var(--text);
    font-weight: 500;
    opacity: 0.85;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.6rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.page-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 400;
    max-width: 36rem;
}

.panel {
    background: linear-gradient(165deg, var(--surface-2) 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    box-shadow: var(--shadow);
}

.panel.narrow {
    max-width: 440px;
    margin: 0 auto;
}

.panel.narrow h1 {
    margin-top: 0;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

.detail-panel {
    max-width: 800px;
}

.detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 220px) 1fr;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

@media (max-width: 640px) {
    .detail-hero {
        grid-template-columns: 1fr;
    }
}

.detail-hero-visual {
    min-height: 200px;
    background: linear-gradient(145deg, #2a3548, #1a2332);
}

.detail-hero-visual[data-category="1"] {
    background: linear-gradient(145deg, #3d5a80, #1e2d44);
}

.detail-hero-visual[data-category="2"] {
    background: linear-gradient(145deg, #4a6fa5, #1f2840);
}

.detail-hero-visual[data-category="3"] {
    background: linear-gradient(145deg, #5c4a7a, #241d36);
}

.detail-hero-visual[data-category="4"] {
    background: linear-gradient(145deg, #3d6b5c, #1a2e28);
}

.detail-hero-body {
    padding: 1.75rem 2rem 2rem;
}

.detail-hero-body h1 {
    margin: 0 0 0.75rem;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
}

.detail-hero-body .lead {
    margin-top: 0;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin: 1rem 0 1.25rem;
}

.detail-meta .product-price {
    margin: 0;
}

.back-link {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

.lead {
    color: var(--muted);
    font-size: 1.05rem;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1rem;
}

.stack-form label {
    font-weight: 600;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.stack-form input[type="text"],
.stack-form input[type="email"],
.stack-form input[type="password"],
.stack-form input[type="number"] {
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    max-width: 100%;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.stack-form input:focus {
    outline: none;
    border-color: rgba(74, 168, 255, 0.45);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
    display: inline-block;
    padding: 0.7rem 1.35rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    transition: transform 0.15s ease, box-shadow var(--transition), background var(--transition);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
    color: #0a0e14;
    box-shadow: 0 4px 16px rgba(74, 168, 255, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.06);
}

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

.btn-secondary:hover {
    border-color: rgba(74, 168, 255, 0.35);
    color: var(--accent-hover);
}

.btn-danger {
    background: linear-gradient(180deg, #ff8a90 0%, var(--danger) 100%);
    color: #1a0a0a;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

.msg-error {
    color: #ffc9cc;
    background: rgba(240, 113, 120, 0.12);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(240, 113, 120, 0.28);
    font-size: 0.92rem;
}

.muted {
    color: var(--muted);
}

.catalog-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.75rem;
    align-items: start;
}

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

.category-sidebar {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow);
}

.category-sidebar h2 {
    margin: 0 0 0.85rem;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-list li {
    margin-bottom: 0.25rem;
}

.category-list a {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    transition: background var(--transition), color var(--transition);
}

.category-list a:hover {
    background: var(--surface-hover);
    text-decoration: none;
}

.category-list a.is-active {
    background: var(--accent-soft);
    color: var(--accent-hover);
    font-weight: 600;
}

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

.product-card {
    position: relative;
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 55%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

@media (prefers-reduced-motion: reduce) {
    .product-card,
    .btn {
        transition: none;
    }

    .btn:active {
        transform: none;
    }
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(74, 168, 255, 0.2);
}

.product-card-visual {
    height: 132px;
    flex-shrink: 0;
    position: relative;
    background: linear-gradient(135deg, #2a3548 0%, #151b26 100%);
}

.product-card-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 45%);
}

.product-card[data-category="1"] .product-card-visual {
    background: linear-gradient(135deg, #4a7ab8 0%, #1e2a42 100%);
}

.product-card[data-category="2"] .product-card-visual {
    background: linear-gradient(135deg, #5b7fc4 0%, #1a2540 100%);
}

.product-card[data-category="3"] .product-card-visual {
    background: linear-gradient(135deg, #7a5cb8 0%, #251d38 100%);
}

.product-card[data-category="4"] .product-card-visual {
    background: linear-gradient(135deg, #4a9a7a 0%, #152a22 100%);
}

.product-card-body {
    padding: 1.15rem 1.35rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-title {
    margin: 0 0 0.5rem;
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
}

.product-desc {
    flex: 1;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-footer {
    padding: 1.15rem 1.35rem 1.35rem;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.12);
}

.product-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.product-price {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}

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

.stock-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.stock-pill--ok {
    background: rgba(127, 217, 154, 0.15);
    color: var(--success);
    border: 1px solid rgba(127, 217, 154, 0.25);
}

.stock-pill--bad {
    background: rgba(240, 113, 120, 0.12);
    color: #ffb3b8;
    border: 1px solid rgba(240, 113, 120, 0.25);
}

.product-stock {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    color: var(--muted);
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.inline-add {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.inline-add input[type="number"] {
    width: 4.75rem;
    padding: 0.45rem 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}

.inline-add input[type="number"]:focus {
    outline: none;
    border-color: rgba(74, 168, 255, 0.45);
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

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

.data-table th {
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 600;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.cart-total {
    margin: 1.35rem 0 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
