/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --sidebar-w: 420px;
    --navbar-h: 64px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-h);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    z-index: 100;
    display: flex;
    align-items: center;
}
.navbar-inner {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
    white-space: nowrap;
}
.navbar-brand span {
    font-weight: 400;
    color: var(--gray-500);
}
.navbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.navbar-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}
.navbar-search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    font-size: .875rem;
    background: var(--gray-50);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.navbar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    background: #fff;
}
.cart-toggle {
    position: relative;
    background: none;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-700);
    transition: border-color .2s, background .2s;
}
.cart-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.cart-badge:empty, .cart-badge[data-count="0"] { display: none; }

/* ===== CART SIDEBAR ===== */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-w);
    max-width: 100vw;
    background: #fff;
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -10px 0 40px rgba(0,0,0,.15);
}
.cart-sidebar.open {
    transform: translateX(0);
}
.cart-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}
.cart-sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}
.cart-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0 4px;
    line-height: 1;
    transition: color .2s;
}
.cart-close:hover { color: var(--gray-900); }

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Cart empty state */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    gap: 12px;
    text-align: center;
}
.cart-empty p {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 1rem;
}
.cart-empty span {
    color: var(--gray-400);
    font-size: .875rem;
}

/* Cart items */
.cart-items {
    padding: 12px 16px;
}
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.cart-item-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item-details {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-weight: 600;
    font-size: .85rem;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-meta {
    font-size: .75rem;
    color: var(--gray-400);
    margin-top: 2px;
}
.cart-item-price {
    font-size: .8rem;
    color: var(--gray-600);
    margin-top: 2px;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}
.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    color: var(--gray-600);
}
.qty-btn:hover { background: var(--gray-100); }
.qty-input {
    width: 40px;
    text-align: center;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: .8rem;
    padding: 4px 2px;
    outline: none;
}
.qty-input:focus { border-color: var(--primary); }
.cart-item-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    border-radius: 6px;
    transition: all .15s;
    display: flex;
    align-items: center;
}
.cart-item-remove:hover { color: var(--danger); background: #fef2f2; }
.cart-item-rabat {
    font-size: .7rem;
    color: #16a34a;
    font-weight: 500;
    margin-top: 2px;
}
.cart-item-subtotal {
    font-size: .75rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 4px;
}

/* Cart summary */
.cart-summary {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.cart-rabat-info {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}
.cart-rabat-title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.cart-rabat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: .8rem;
    color: var(--gray-600);
}
.rabat-readonly {
    width: 55px;
    padding: 3px 6px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: .78rem;
    text-align: center;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: default;
}
.rabat-field {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    overflow: hidden;
    transition: border-color .2s;
}
.rabat-field:focus-within {
    border-color: var(--primary);
}
.rabat-input {
    width: 50px;
    padding: 3px 4px;
    border: none;
    outline: none;
    font-size: .78rem;
    text-align: right;
    background: #fff;
    color: var(--gray-800);
    -moz-appearance: textfield;
}
.rabat-input::-webkit-outer-spin-button,
.rabat-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.rabat-unit {
    padding: 3px 5px 3px 2px;
    font-size: .78rem;
    color: var(--gray-500);
    background: var(--gray-100);
    line-height: 1;
}
.cart-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: .85rem;
}
.cart-summary-row label {
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
}
.rabat-info { color: var(--gray-500); font-size: .8rem; }
.total-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: .95rem;
}
.cart-total-price { color: var(--primary); }

/* Cart checkout */
.cart-checkout {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.checkout-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.checkout-field label {
    font-size: .8rem;
    font-weight: 500;
    color: var(--gray-600);
}
.checkout-field input,
.checkout-field textarea {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    outline: none;
    font-family: inherit;
    transition: border-color .2s;
    resize: vertical;
}
.checkout-field input:focus,
.checkout-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.checkout-field input[readonly] {
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: default;
}
.btn-checkout {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.btn-checkout:hover:not(:disabled) { background: var(--primary-hover); }
.btn-checkout:disabled { opacity: .5; cursor: not-allowed; }
.btn-clear-cart {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--gray-600);
    font-size: .8rem;
    cursor: pointer;
    transition: all .15s;
}
.btn-clear-cart:hover { border-color: var(--danger); color: var(--danger); }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-top: var(--navbar-h);
    padding: 24px;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
}
.alert {
    padding: 12px 16px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: .875rem;
}

/* ===== SHOP LAYOUT ===== */
.shop-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

/* Categories sidebar */
.categories-sidebar {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    position: sticky;
    top: calc(var(--navbar-h) + 24px);
}
.categories-sidebar h3 {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gray-400);
    margin-bottom: 16px;
    font-weight: 600;
}
.category-nav {
    list-style: none;
}
.cat-item {
    margin-bottom: 2px;
}
.cat-btn, .subcat-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--gray-700);
    transition: all .15s;
    font-family: inherit;
}
.cat-btn:hover, .subcat-btn:hover {
    background: var(--gray-100);
}
.cat-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.subcat-btn.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}
.cat-count {
    font-size: .7rem;
    background: var(--gray-100);
    color: var(--gray-500);
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 500;
}
.subcat-btn.active .cat-count {
    background: rgba(255,255,255,.2);
    color: #fff;
}
.subcat-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s cubic-bezier(.4,0,.2,1);
    padding-left: 12px;
}
.subcat-list.open {
    max-height: 1000px;
}

/* ===== PRODUCTS ===== */
.products-area {
    min-height: 400px;
}
.subcategory-section {
    scroll-margin-top: 105px;
}
.section-header {
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}
.section-breadcrumb {
    font-size: .8rem;
    color: var(--gray-400);
}
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.product-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.product-card-img {
    height: 160px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}
.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: transform .3s;
}
.product-card:hover .product-card-img img {
    transform: scale(1.05);
}
.product-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-card-body {
    padding: 14px 16px 8px;
    flex: 1;
}
.product-name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-meta {
    display: flex;
    gap: 8px;
    font-size: .75rem;
    color: var(--gray-400);
    margin-bottom: 4px;
}
.product-trpak {
    font-size: .74rem;
    color: #6366f1;
    margin-bottom: 8px;
    letter-spacing: .2px;
}
.product-trpak strong {
    font-weight: 700;
}
.product-prices {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.price-main {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}
.price-main small {
    font-weight: 400;
    font-size: .75rem;
    color: var(--gray-400);
}
.price-nopdv {
    font-size: .75rem;
    color: var(--gray-400);
}

/* Product card footer */
.product-card-footer {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--gray-100);
}
.ajax-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.add-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.add-qty-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 6px;
}
.trpak-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: .3px;
    line-height: 1.4;
}
.add-qty-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.add-qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-50);
    font-size: 1rem;
    cursor: pointer;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.add-qty-btn:hover { background: var(--gray-200); }
.add-qty-input {
    width: 38px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200);
    font-size: .8rem;
    padding: 4px 0;
    outline: none;
    -moz-appearance: textfield;
}
.add-qty-input::-webkit-outer-spin-button,
.add-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn-add-cart {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
}
.btn-add-cart:hover { background: var(--primary-hover); }
.btn-add-cart.added {
    background: var(--success);
}

/* Welcome state */
.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    gap: 16px;
}
.welcome-state h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-700);
}
.welcome-state p {
    color: var(--gray-400);
    font-size: .95rem;
}
.no-products {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
}

/* ===== IMAGE MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex;
}
.modal-box {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}
.modal-box img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius);
}
.modal-box p {
    text-align: center;
    color: #ccc;
    margin-top: 12px;
    font-size: .9rem;
}
.modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    color: var(--gray-700);
    z-index: 1;
    transition: transform .15s;
}
.modal-close:hover { transform: scale(1.1); }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn .3s ease-out;
    max-width: 320px;
}
.toast.success { background: #065f46; color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.removing { animation: toastOut .3s ease-in forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(12px) scale(.95); }
}

/* ===== NAVBAR USER ===== */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--gray-200);
    margin-left: auto;
}
.user-greeting {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--gray-600);
    font-weight: 500;
    white-space: nowrap;
}
.logout-link {
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: 6px;
    color: var(--gray-400);
    transition: all .15s;
}
.logout-link:hover { color: var(--danger); background: #fef2f2; }

/* ===== LOGIN PAGE ===== */
.login-page {
    background: linear-gradient(135deg, var(--gray-50) 0%, #e0e7ff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}
.login-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px 32px;
}
.login-header {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-light);
    margin-bottom: 16px;
}
.login-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
}
.login-header h1 span {
    font-weight: 400;
    color: var(--gray-500);
}
.login-header p {
    color: var(--gray-400);
    font-size: .875rem;
    margin-top: 4px;
}
.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: #fef2f2;
    color: var(--danger);
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid #fecaca;
}
.login-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid #bfdbfe;
    line-height: 1.4;
}
.login-notice svg { flex-shrink: 0; margin-top: 1px; }
.login-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    margin-bottom: 20px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
}
.login-user-info svg { flex-shrink: 0; }
.change-user-link {
    margin-left: auto;
    font-size: .75rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}
.change-user-link:hover { text-decoration: underline; }
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.login-form label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-700);
}
.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon-wrap > svg:first-child {
    position: absolute;
    left: 12px;
    color: var(--gray-400);
    pointer-events: none;
}
.input-icon-wrap input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-family: inherit;
    background: var(--gray-50);
    transition: border-color .2s, box-shadow .2s, background .2s;
    outline: none;
    color: var(--gray-800);
}
.input-icon-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
    background: #fff;
}
.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color .15s;
}
.toggle-password:hover { color: var(--gray-600); }
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    font-family: inherit;
    margin-top: 4px;
}
.login-btn:hover { background: var(--primary-hover); }

/* Remember-me checkbox */
.remember-me-group { margin-top: 4px; margin-bottom: 0; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: .85rem;
    color: var(--gray-400);
    user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid var(--gray-200);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .2s, background .2s;
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}
.checkbox-label:hover .checkbox-custom { border-color: var(--primary); }

.login-extras {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-100);
}
.back-to-site {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: .85rem;
    transition: color .2s;
}
.back-to-site:hover {
    color: var(--primary);
}
.partner-cta {
    color: var(--gray-400);
    font-size: .85rem;
}
.partner-cta a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.partner-cta a:hover {
    text-decoration: underline;
}
.login-footer {
    text-align: center;
    color: var(--gray-400);
    font-size: .75rem;
    margin-top: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }
    .categories-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    .welcome-state { padding: 48px 20px; }
    .welcome-state h2 { font-size: 1.25rem; }
}

@media (max-width: 640px) {
    /* Navbar - wrap to two rows so search stays visible */
    .navbar { height: auto; min-height: var(--navbar-h); }
    .navbar-inner {
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .navbar-brand { font-size: 1rem; }
    .navbar-search {
        order: 10;
        flex: none;
        width: 100%;
        max-width: 100%;
    }
    .navbar-search input { padding: 8px 14px 8px 36px; font-size: .8rem; }
    .navbar-user { border-left: none; padding-left: 0; gap: 4px; }
    /* Hide username text, keep icon */
    .user-greeting { font-size: 0; line-height: 0; gap: 0; }
    .user-greeting svg { width: 18px; height: 18px; }

    /* Main content */
    .main-content { padding: 12px; margin-top: calc(var(--navbar-h) + 40px); }

    /* Categories sidebar - collapsible on mobile */
    .categories-sidebar {
        padding: 12px;
    }
    .categories-sidebar h3 {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0;
        user-select: none;
        -webkit-user-select: none;
    }
    .categories-sidebar h3::after {
        content: '▾';
        font-size: .7rem;
        transition: transform .2s;
    }
    .categories-sidebar.collapsed h3 { margin-bottom: 0; }
    .categories-sidebar.collapsed h3::after {
        transform: rotate(-90deg);
    }
    .categories-sidebar.collapsed .category-nav {
        display: none;
    }
    .categories-sidebar:not(.collapsed) h3 {
        margin-bottom: 12px;
    }

    /* Products grid - 2 columns */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .product-card-img { height: 110px; }
    .product-card-body { padding: 8px 10px 4px; }
    .product-name { font-size: .78rem; }
    .product-meta { font-size: .68rem; gap: 4px; }
    .price-main { font-size: .88rem; }
    .price-nopdv { font-size: .68rem; }
    .product-card-footer { padding: 6px 10px 10px; }
    .btn-add-cart { min-height: 36px; }
    .add-qty-wrap { justify-content: center; }
    .add-qty-btn { width: 36px; height: 36px; }
    .add-qty-input { width: 44px; font-size: .8rem; }

    /* Cart sidebar - full width */
    .cart-sidebar { width: 100vw; }
    .cart-sidebar-header { padding: 16px; }
    .cart-items { padding: 10px 12px; }
    .cart-item-name { font-size: .8rem; }
    .qty-btn { width: 32px; height: 32px; }

    /* Section headers */
    .section-header h2 { font-size: 1.05rem; }
    .section-breadcrumb { font-size: .72rem; }

    /* Welcome state */
    .welcome-state { padding: 40px 16px; gap: 12px; }
    .welcome-state h2 { font-size: 1.15rem; }
    .welcome-state p { font-size: .85rem; }

    /* Toast - full width on mobile */
    .toast-container {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }
    .toast { max-width: 100%; }

    /* Login page */
    .login-card { padding: 28px 18px 22px; }
    .login-container { padding: 12px; }
    .login-header h1 { font-size: 1.2rem; }
    .login-logo { width: 56px; height: 56px; }
}

@media (max-width: 380px) {
    /* Very small screens */
    .navbar-brand { font-size: .9rem; }
    .products-grid { grid-template-columns: 1fr; }
    .product-card-img { height: 140px; }
    .product-card-body { padding: 10px 12px 6px; }
    .product-name { font-size: .82rem; }
    .price-main { font-size: .92rem; }
}

/* ===== VIEW TOGGLE ===== */
.view-toggle {
    display: flex;
    align-items: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    transition: background .15s, color .15s;
}
.view-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.view-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}
.view-btn + .view-btn {
    border-left: 1px solid var(--gray-200);
}

/* ===== UNDERCLASS SIDEBAR (3rd level) ===== */
.underclass-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s cubic-bezier(.4,0,.2,1);
    padding-left: 20px;
}
.underclass-list.open {
    max-height: 600px;
}
.underclass-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--gray-500);
    transition: all .15s;
    font-family: inherit;
}
.underclass-btn span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.underclass-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.underclass-btn.active {
    background: rgba(37,99,235,.08);
    color: var(--primary);
    font-weight: 600;
}
.underclass-btn.active .cat-count {
    background: rgba(37,99,235,.12);
    color: var(--primary);
}

/* ===== UNDERCLASS SECTION (products area) ===== */
.underclass-section {
    margin-bottom: 28px;
}
.underclass-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--gray-100);
}
.underclass-section-header h3 {
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ===== LIST VIEW ===== */
.products-area.list-view .products-grid {
    grid-template-columns: 1fr;
    gap: 6px;
}
/*
  Card: CSS Grid — image spans both rows (info + form),
  body top-right, footer bottom-right.
  This keeps the button always fully visible and avoids overflow clipping.
*/
.products-area.list-view .product-card {
    display: grid;
    grid-template-columns: 84px 1fr;
    grid-template-rows: 1fr auto;
    flex-direction: unset; /* reset card-mode flex */
}
.products-area.list-view .product-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}
/* Image fills both rows */
.products-area.list-view .product-card-img {
    grid-column: 1;
    grid-row: 1 / 3;
    height: auto;
    width: 100%;
    border-radius: var(--radius) 0 0 var(--radius);
}
/* Body: product info stacked */
.products-area.list-view .product-card-body {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 12px 16px 6px;
    /* reset grid from card mode */
    flex: unset;
}
.products-area.list-view .product-name {
    margin-bottom: 0;
    font-size: .875rem;
    display: block;               /* override -webkit-box */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.products-area.list-view .product-meta  { margin-bottom: 0; }
.products-area.list-view .product-trpak { margin-bottom: 0; }
.products-area.list-view .product-prices {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
/* Footer: sits below body in the same right column */
.products-area.list-view .product-card-footer {
    grid-column: 2;
    grid-row: 2;
    border-top: 1px solid var(--gray-100);
    border-left: none;
    padding: 6px 16px 10px;
    width: auto;
}
/* Form: qty-row (with label) + button side by side */
.products-area.list-view .ajax-add-form {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    width: 100%;
}
.products-area.list-view .add-qty-label { display: flex; }
.products-area.list-view .add-qty-row   { flex-shrink: 0; }
.products-area.list-view .btn-add-cart {
    flex: 1;
    width: auto;
    min-width: 130px;
    white-space: nowrap;
    font-size: .82rem;
    padding: 9px 14px;
}

/* Mobile: revert to normal card layout (grid → flex column) */
@media (max-width: 640px) {
    .products-area.list-view .product-card {
        display: flex;
        flex-direction: column;
    }
    .products-area.list-view .product-card-img {
        grid-column: unset;
        grid-row: unset;
        width: 100%;
        height: 140px;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .products-area.list-view .product-card-body {
        grid-column: unset;
        grid-row: unset;
        padding: 12px 14px 8px;
    }
    .products-area.list-view .product-name {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }
    .products-area.list-view .product-prices {
        flex-direction: column;
        align-items: flex-start;
    }
    .products-area.list-view .product-card-footer {
        grid-column: unset;
        grid-row: unset;
        border-top: 1px solid var(--gray-100);
        width: 100%;
        padding: 8px 14px 12px;
    }
    .products-area.list-view .ajax-add-form {
        flex-direction: column;
        flex-wrap: wrap;
        width: 100%;
    }
    .products-area.list-view .btn-add-cart {
        flex: none;
        min-width: unset;
        width: 100%;
    }
}