:root {
    --bg-page: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #121212;
    --text-secondary: #6c757d;
    --accent: #28a745;
    --accent-dark: #218838;
    --border: #e1e4e8;
    --radius: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.08);
    --font-main: 'Inter', -apple-system, system-ui, sans-serif;
    --font-heading: 'Inter', -apple-system, system-ui, sans-serif;
    --header-height: 72px;
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* Top Bar (Static) */
.top-bar-fixed {
    min-height: 36px;
    height: auto;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    padding: 4px 15px;
    flex-wrap: wrap;
}


/* Layout */
.app-container {
    margin: 0;
    padding: 0 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    background: #1a1a1a;
    color: #ffffff;
    font-size: 13px;
    padding: 8px 0;
}

.top-bar-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-contacts {
    display: flex;
    gap: 20px;
}

.top-contact {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.top-contact:hover {
    opacity: 1;
}

.tg-link {
    color: #0088cc;
}

.tg-icon {
    fill: currentColor;
}

.top-bar-info {
    font-weight: 500;
    opacity: 0.7;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Header */
.site-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    position: sticky;
    top: 0;
    z-index: 900;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 40px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
    padding-left: 64px;
    width: 260px;
    flex-shrink: 0;
}

.header-contacts {
    display: flex;
    gap: 12px; /* Reduced from 24px */
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
}

.header-info-text {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
}

.header-contact {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    transition: color 0.2s;
    white-space: nowrap;
}

.header-contact-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.header-contact-icon:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.tg-link-header { background: #29a8eb !important; }
.viber-link-header { background: #7360f2 !important; }

.header-contact:hover {
    color: var(--accent);
}

.tg-link {
    color: #0088cc;
}

.viber-link {
    color: #7360f2;
}

.tg-icon,
.viber-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.promo-link {
    font-weight: 600;
}

.top-link {
    color: #ff9500 !important;
    font-weight: 600;
}

.cat-icon {
    margin-right: 4px;
}

.tg-icon {
    fill: currentColor;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon-wrapper {
    background: transparent;
    color: var(--accent);
    min-width: 44px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-wrench {
    display: none;
    /* Hidden on desktop by default unless img fails */
}

.logo-icon-wrapper img {
    max-height: 100%;
    width: auto;
    display: block;
}

.logo-area:hover .logo-icon-wrapper {
    transform: rotate(10deg) scale(1.05);
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 32px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.logo-main {
    color: var(--text-primary);
}

.logo-sub {
    color: var(--accent);
}

.logo-parts {
    color: #27ae60;
    font-weight: 800;
    font-size: 28px;
    letter-spacing: 6px;
    text-transform: uppercase;
}

.logo-divider {
    width: 2px;
    height: 24px;
    background: #e1e4e8;
    margin: 0 14px;
    border-radius: 2px;
}

.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.cart-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-primary);
    transition: transform 0.2s;
    margin-right: 24px;
}

.cart-btn:hover {
    transform: scale(1.1);
}

/* Cabinet / Profile Button */
.cabinet-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 4px;
}

.cabinet-btn:hover {
    transform: scale(1.1);
    background: rgba(0,0,0,0.06);
    color: var(--accent);
}

/* Register success */
.register-success {
    text-align: center;
    padding: 40px 20px;
}
.register-success .success-icon {
    font-size: 56px;
    margin-bottom: 16px;
}
.register-success h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
}
.register-success p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    height: 18px;
    min-width: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Main Content Grid */
.main-wrapper {
    max-width: 1400px;
    margin: 0;
    padding: 30px 10px 60px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    flex: 1;
    width: 100%;
}

/* Sidebar */
/* Animated gear for "All Products" */
.animated-gear {
    margin-right: 8px;
    vertical-align: middle;
    transition: color 0.3s;
    animation: rotateGear 6s linear infinite;
    display: inline-block;
}

.category-link:hover .animated-gear {
    color: var(--accent);
    animation-duration: 2s;
    /* Rotates faster on hover */
}

@keyframes rotateGear {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.cat-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    margin-right: 4px;
}

.sidebar {
    width: 260px;
    background: #ffffff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    align-self: start;
    position: sticky;
    top: calc(var(--header-height) + 24px);
    z-index: 50;
    border: 1px solid var(--border);
}

.feedback-banner {
    position: fixed;
    top: 70%; /* Moved lower to avoid overlap with sidebar blocks */
    left: 40px; 
    width: 260px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    border: 1px solid var(--border);
    z-index: 1000;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease; 
    opacity: 0;
    transform: translateY(100px); /* Start slightly lower */
    pointer-events: none;
}

.feedback-banner.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.feedback-banner .fb-text {
    font-weight: 700;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    text-align: center;
    line-height: 1.4;
}

.feedback-banner .fb-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.feedback-banner .fb-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    background: #fcfcfc;
    transition: border-color 0.3s;
}

.feedback-banner .fb-form input:focus {
    border-color: var(--accent);
}

.feedback-banner .fb-form button {
    background: #4caf50; /* Green like in the user's screenshot */
    color: white;
    border: none;
    border-radius: 14px;
    width: 38px;
    height: 38px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    flex-shrink: 0;
}

.feedback-banner .fb-form button:hover {
    background: #45a049;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .feedback-banner {
        left: 10px;
        right: 10px;
        bottom: 20px;
        width: auto;
    }
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item {
    margin-bottom: 0;
}

.category-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 15px;
    background: #f8f9fa;
    border: 1px solid transparent;
    margin-bottom: 8px;
}

.category-link:hover {
    background: #f1f3f5;
    border-color: #dee2e6;
}

.category-link.active {
    background: white;
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.promo-link {
    background: #4caf50;
    color: white !important;
    border: none;
}

.promo-link:hover {
    background: #43a047;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.category-link.promo-link.active {
    background: #388e3c !important;
    color: white !important;
    border-color: transparent;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Search Area (in main content now) */
.search-area {
    margin-bottom: 12px; /* Reduced from 24px */
    display: flex;
    gap: 12px;
}

.content-area {
    position: relative;
    z-index: 1;
}

.products-grid {
    position: relative;
    z-index: 1;
}

.search-input {
    flex: 1;
    padding: 12px 40px 12px 16px;
    /* Add right padding for the clear button */
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 16px;
    outline: none;
    transition: 0.3s;
    width: 100%;
}

.search-input:focus {
    border-color: var(--accent);
    /* Make the blinking cursor super visible (blinking line) */
    caret-color: #ff3b30;
    /* Gentle pulsing effect on focus to indicate you are typing */
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
    animation: pulseSearch 2s infinite;
}

@keyframes pulseSearch {
    0% {
        box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(0, 113, 227, 0.25);
    }

    100% {
        box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    }
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
    z-index: 2;
}

.search-clear:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.upload-btn {
    padding: 0 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: 0.2s;
}

.upload-btn:hover {
    background: #f9f9f9;
    border-color: #bbb;
}

/* Category Header */
.category-header {
    margin-bottom: 16px;
    padding: 8px 0; /* Reduced from 20px */
    text-align: center;
    border-bottom: 2px solid var(--accent);
}

.category-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.category-header p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 8px auto 0;
    max-width: 800px;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .category-header {
        padding: 16px 12px;
        margin-bottom: 16px;
    }

    .category-header h1 {
        font-size: 20px;
        line-height: 1.3;
    }

    .category-header p {
        font-size: 14px;
    }
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    transition: 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.p-icon-area {
    height: 120px;
    background: #f9f9fab0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 8px;
}

.p-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.p-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e5f4ea;
    color: #1e7e34;
    font-weight: 700;
    white-space: nowrap;
}

.p-badge.out {
    background: #fce8e6;
    color: #c5221f;
}

.p-badge.promo {
    background: #7f8c8d;
    color: white;
}

.p-badge.top {
    background: #ff9500;
    color: white;
}

/* New compacted bottom row */
.p-bottom-row {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.p-status-badge {
    font-size: 13px;
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
}

.p-status-badge.out {
    color: var(--danger);
}

.card-promo {
    border-color: rgba(127, 140, 141, 0.2);
}

.card-top {
    border-color: rgba(255, 149, 0, 0.2);
}

.p-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
    color: #000;
    text-decoration: none;
}

.p-title:visited {
    color: var(--accent);
}

.p-code {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-family: monospace;
    word-break: break-all;
}

.p-price {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.btn-buy {
    background: var(--accent);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
    height: 32px;
    display: flex;
    align-items: center;
}

.btn-buy:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

/* Touch-friendly buttons on mobile */
@media (max-width: 640px) {

    .btn-buy,
    .btn-add-cart,
    .cart-btn,
    .mobile-menu-toggle {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .category-link,
    .product-card {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* Cart Modal */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

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

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    background: white;
    z-index: 1101;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 20px;
}

.close-cart {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.cart-item {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item img,
.cart-item-placeholder {
    width: 60px;
    height: 60px;
    background: #f5f5f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.ci-details {
    flex: 1;
}

.ci-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ci-price {
    font-size: 13px;
    color: var(--text-secondary);
}

.ci-remove {
    color: #ff3b30;
    font-size: 12px;
    margin-top: 8px;
    cursor: pointer;
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    background: #f9f9f9;
    flex-shrink: 0;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 16px;
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.checkout-btn:hover {
    background: var(--accent-dark);
}

/* Continue Shopping Button */
.continue-shopping-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.continue-shopping-btn:hover {
    background: rgba(76, 175, 80, 0.08);
    border-color: var(--accent-dark);
    color: var(--accent-dark);
}

.continue-shopping-btn:hover svg {
    transform: translateX(-3px);
}

.continue-shopping-btn svg {
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* Checkout Form Styles */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.checkout-success {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.success-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.success-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.site-footer {
    border: none;
    border-radius: 40px 40px 0 0;
    padding: 40px 60px 24px;
    background: white;
    margin-top: 40px;
    width: 100%;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.04);
}

.footer-inner {
    max-width: 1200px;
    /* Reduced to bring content in from the sides */
    margin: 0 auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 10px;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 32px;
    height: 3px;
    background: var(--accent);
    border-radius: 3px;
}

.footer-col h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 14px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.footer-col li a {
    transition: color 0.2s, padding-left 0.2s;
}

.footer-col li a:hover {
    color: var(--accent) !important;
    padding-left: 4px;
}

.footer-col a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-bottom {
    text-align: center;
    padding: 24px 0 16px;
    border-top: 1px solid var(--border);
    margin-top: 32px;
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
    max-width: 1000px;
    margin: 0 auto;
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .site-header {
        padding: 0 20px;
    }

    .header-left {
        gap: 20px;
        padding-left: 15px;
        /* Reset giant desktop padding */
    }

    .header-contacts {
        gap: 12px;
        padding-left: 0;
        flex-wrap: wrap;
    }

    .header-info-text {
        font-size: 12px;
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 16px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.mobile-menu-toggle:hover {
    background: #f9f9f9;
    border-color: var(--accent);
}

.mobile-menu-toggle svg {
    flex-shrink: 0;
}

@media (max-width: 800px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .main-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 0 40px;
    }

    .sidebar {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
        max-height: 0;
        overflow: hidden;
        padding-right: 0;
        margin-bottom: 0;
        background: white;
        padding: 0 20px;
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        transition: max-height 0.3s ease-out, padding 0.3s ease-out, margin 0.3s ease-out;
    }

    .sidebar.mobile-open {
        max-height: 1000px;
        padding: 20px;
        margin-bottom: 20px;
        overflow-y: auto;
    }

    .sidebar-title {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .category-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .sidebar.mobile-open .category-list {
        display: grid;
    }

    .category-item {
        margin-bottom: 0;
    }

    .category-link {
        padding: 10px 14px;
        font-size: 15px;
        text-align: center;
    }

    .cart-sidebar {
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .product-card {
        padding: 10px;
    }

    .p-icon-area {
        height: 100px;
        font-size: 40px;
        margin-bottom: 12px;
    }

    .p-title {
        font-size: 15px;
        height: 38px;
    }

    .p-price {
        font-size: 16px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 640px) {
    .top-bar-fixed {
        font-size: 11px;
        padding: 0 10px;
        text-align: center;
        height: auto;
        min-height: 36px;
        line-height: 1.4;
    }

    .site-header {
        padding: 10px 15px;
        height: auto;
        min-height: var(--header-height);
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo cart"
            "contacts contacts";
        gap: 10px;
    }

    .header-left {
        grid-area: logo;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: auto;
    }

    .logo-area {
        gap: 2px;
    }

    .logo-icon-wrapper {
        height: 36px !important;
        width: auto !important;
        display: flex;
        align-items: center;
    }

    .logo-text {
        font-size: 18px !important;
    }

    .header-contacts {
        grid-area: contacts;
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        border-top: 1px solid var(--border);
        padding-top: 10px;
        width: 100%;
        text-align: left;
    }

    .header-info-text {
        font-size: 12px;
        width: 100%;
        margin-right: 0;
        margin-bottom: 2px;
        color: var(--text-secondary);
        line-height: 1.2;
    }

    .header-contact {
        display: flex !important;
        align-items: center;
        font-size: 16px;
        font-weight: 800;
        color: var(--text-primary);
        margin-right: 4px;
        text-decoration: none;
    }

    .tg-link,
    .viber-link {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        padding: 6px;
        background: rgba(0, 0, 0, 0.03);
        border-radius: 50%;
        margin: 0;
    }

    .logo-wrench {
        display: block !important;
    }

    .tg-icon,
    .viber-icon {
        width: 16px;
        height: 16px;
    }

    .header-actions {
        grid-area: cart;
        width: auto;
        justify-content: flex-end;
        align-items: center;
        margin-top: 0;
    }

    .app-container {
        padding: 0 15px;
    }

    .search-area {
        margin-bottom: 20px;
    }

    .search-input {
        font-size: 14px;
        padding: 10px 14px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .product-card {
        padding: 8px;
    }

    .p-icon-area {
        height: 80px;
        font-size: 32px;
        margin-bottom: 6px;
    }

    .p-title {
        font-size: 13px;
        height: 32px;
        margin-bottom: 2px;
        line-height: 1.25;
    }

    .p-code {
        font-size: 10px;
        margin-bottom: 6px;
    }

    .p-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .p-price {
        font-size: 14px;
        width: 100%;
    }

    .btn-buy {
        width: 100%;
        padding: 7px;
        font-size: 12px;
        text-align: center;
        height: 28px;
    }

    .p-badges {
        top: 6px;
        right: 6px;
    }

    .p-badge {
        font-size: 9px;
        padding: 1px 5px;
    }

    .site-footer {
        padding: 30px 16px 24px;
        /* Reset giant desktop padding */
        margin-bottom: 15px;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }

    .cart-header {
        padding: 20px;
    }

    .cart-items {
        padding: 20px;
    }

    .cart-footer {
        padding: 20px;
    }

    .cart-item {
        flex-direction: column;
        gap: 12px;
    }

    .cart-item img,
    .cart-item-placeholder {
        width: 80px;
        height: 80px;
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .top-bar-fixed {
        font-size: 10px;
        padding: 8px 8px;
        content: "Юпартс — Запчастини МАЗ, КАМАЗ, КРАЗ, ГАЗ, MAN, DAF, SCANIA та інша спецтехніка в наявності та під замовлення в Україні";
    }

    /* Залишаємо 2 колонки — 1 колонка займає надто багато місця */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 7px;
    }

    .product-card {
        padding: 7px;
    }

    .p-icon-area {
        height: 70px;
        font-size: 28px;
        margin-bottom: 5px;
    }

    .p-title {
        font-size: 12px;
        height: 30px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .p-code {
        font-size: 9px;
        margin-bottom: 5px;
    }

    .p-price {
        font-size: 13px;
    }

    .btn-buy {
        padding: 6px;
        font-size: 11px;
        height: 26px;
    }

    .category-list {
        grid-template-columns: 1fr;
    }

    .category-link {
        text-align: left;
    }

    .sidebar.mobile-open {
        max-height: 800px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Brand Accordion */
.brand-item {
    margin-bottom: 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid transparent;
    position: relative;
    z-index: 60;
}

.brand-item.active {
    background: #fff;
    border-color: var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.brand-header {
    padding: 18px 20px;
    /* Increased from 12px 16px to stretch vertically */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    user-select: none;
    border-bottom: 1px solid #f8f9fa;
}

.brand-header:hover {
    background: #f8f9fa;
    color: var(--accent);
}

.brand-name {
    font-size: 15px;
    /* Slightly larger text */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-arrow {
    font-size: 10px;
    color: #adb5bd;
    transition: transform 0.2s, color 0.2s;
}

.brand-item:hover .brand-arrow {
    transform: rotate(90deg);
    color: var(--accent);
}

.brand-categories {
    padding: 16px;
    position: absolute;
    left: 100%;
    min-width: 480px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    top: 0;
    margin-left: 5px;
}

.brand-item:hover .brand-categories {
    display: block;
}

.brand-categories .category-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.brand-item:nth-child(1) .brand-categories {
    top: -10px;
}

.brand-item:nth-child(2) .brand-categories {
    top: -60px;
}

.brand-item:nth-child(3) .brand-categories {
    top: -140px;
}

.brand-item:nth-child(4) .brand-categories {
    top: auto;
    bottom: -30px;
}

.brand-item:nth-child(5) .brand-categories {
    top: auto;
    bottom: -10px;
}

.brand-item::after {
    content: '';
    position: absolute;
    right: -10px;
    width: 10px;
    height: 100%;
    background: transparent;
}

/* Adjust category links in brands */
.brand-categories .category-link {
    display: block;
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1.4;
    background: transparent;
    border: none;
}

.brand-categories .category-link:hover {
    background: #f1f3f5;
    color: var(--accent);
    padding-left: 16px;
}

.brand-categories .category-link.active {
    background: var(--accent) !important;
    color: white !important;
}



/* Custom Scrollbar for Brand Categories */
.brand-categories::-webkit-scrollbar {
    width: 6px;
}

.brand-categories::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 10px;
}

.brand-categories::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 10px;
}

.brand-categories::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.breadcrumb-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--text-secondary);
    margin: 0 2px;
    font-size: 16px;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* SEO Text Block */
.seo-text-block {
    margin-top: 40px;
    padding: 24px 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.seo-text-block p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
}

@media (max-width: 768px) {
    .breadcrumbs {
        font-size: 12px;
        padding: 8px 0;
    }

    .seo-text-block {
        padding: 16px 18px;
        margin-top: 24px;
    }

    .seo-text-block p {
        font-size: 13px;
    }
}

/* ===== MOBILE FIXES ===== */
@media (max-width: 800px) {

    /* Brand categories dropdown — на мобільному не вилітає за екран */
    .brand-categories {
        position: static !important;
        left: auto !important;
        min-width: unset !important;
        width: 100%;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 8px 0 8px 12px !important;
        margin-left: 0 !important;
        background: #f8f9fa !important;
    }

    .brand-categories .category-list {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }

    /* Кнопка меню категорій */
    .mobile-menu-toggle {
        padding: 10px 16px;
        font-size: 14px;
        gap: 8px;
    }

    /* Сітка товарів — 2 колонки на мобільному */
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Картка товару — компактніше */
    .p-bottom-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .btn-buy {
        width: 100%;
        padding: 8px;
        font-size: 13px;
    }

    /* Заголовок — не виходить за екран */
    .category-header h1 {
        font-size: 18px;
        line-height: 1.3;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .category-header p {
        font-size: 13px;
    }

    /* Контент не виходить за межі екрану */
    .content-area {
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    /* На маленьких екранах — ТІЛЬКИ 1 колонка, щоб нічого не обрізалося */
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .p-title {
        font-size: 15px !important;
        height: auto !important;
        -webkit-line-clamp: 4 !important;
        line-clamp: 4 !important;
        word-break: break-all !important;
    }

    .p-price {
        font-size: 17px !important;
    }

    .p-icon-area {
        height: 180px !important;
    }

    /* Хедер — максимальна компактність для iPhone */
    .header-info-text {
        font-size: 11px !important;
        line-height: 1.1 !important;
    }

    .header-left {
        padding-left: 0 !important;
    }

    .app-container {
        padding: 0 10px !important;
    }

    .cart-btn {
        margin-right: 0 !important;
    }
}
