/* Global reset for box-sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Remove default browser margins and paddings for html and body */
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Ensures html and body take full viewport height */
}

@import url('https://rsms.me/inter/inter.css');

:root {
    --tblr-font-sans-serif: 'Inter Var', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Ploi-inspired colors */
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    
    /* Nova-inspired dark sidebar */
    --sidebar-bg: #1f2937;
    --sidebar-hover: #374151;
    --sidebar-active: #4f46e5;
    --sidebar-text: #9ca3af;
    --sidebar-text-active: #ffffff;
    
    /* Modern neutrals */
    --bg-page: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
}

body {
    font-feature-settings: "cv03", "cv04", "cv11";
    background-color: var(--bg-page);
    font-size: 14px;
}

/* Nova-style Sidebar */
.navbar-vertical {
    background: var(--sidebar-bg);
    box-shadow: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    width: 260px;
}

.navbar-vertical .navbar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.5rem;
}

.navbar-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
}

.navbar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.navbar-nav {
    padding: 0.5rem;
}

.navbar-vertical .nav-link {
    color: var(--sidebar-text);
    padding: 0.625rem 1rem;
    margin: 0.125rem 0;
    border-radius: 8px;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.navbar-vertical .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    transform: translateX(2px);
}

.navbar-vertical .nav-link.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.navbar-vertical .nav-link-icon {
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-vertical .dropdown-menu {
    background: var(--sidebar-hover);
    border: none;
    margin-left: 1rem;
    padding: 0.25rem;
    box-shadow: none;
}

.navbar-vertical .dropdown-item {
    color: var(--sidebar-text);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

.navbar-vertical .dropdown-item:hover {
    background: var(--sidebar-bg);
    color: var(--sidebar-text-active);
}

/* Ploi-style Top Header */
.navbar-expand-md {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    height: 64px;
    padding: 0;
}

.navbar-expand-md .container-xl {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Search bar (Ploi-style) */
.search-bar {
    position: relative;
    flex: 0 0 400px;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-page);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* User Dropdown (Nova-style) */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

.user-dropdown:hover {
    background: var(--bg-page);
}

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Page Header (Ploi-style) */
.page-header {
    background: transparent;
    border: none;
    padding: 2rem 0 1.5rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

/* Breadcrumbs (Nova-style) */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

/* Cards (Ploi-style) */
.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    background: var(--bg-card);
    transition: all 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    padding: 1.25rem 1.5rem;
    font-size: 0.9375rem;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons (Ploi-style) */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

/* Dropdown menus */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: 6px;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.15s;
}

.dropdown-item:hover {
    background: var(--bg-page);
    color: var(--primary-color);
}

.dropdown-item i {
    width: 20px;
    opacity: 0.7;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--border-color);
}

/* Page wrapper */
.page-wrapper {
    background: var(--bg-page);
    min-height: calc(100vh - 64px);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
    background: var(--bg-card);
}

.footer ul {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 991px) {
    .navbar-vertical {
        width: 100%;
    }
    
    .search-bar {
        flex: 1;
    }
}

/* Smooth transitions */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page actions */
.page-actions {
    display: flex;
    gap: 0.75rem;
}

/* Badge (Nova-style) */
.badge {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
}

/* Nav section title */
.nav-section-title {
    padding: 1.25rem 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 10%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
    }
}

.login-box {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 50px 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin-bottom: 20px;
    color: white;
}

.login-header h1 {
    font-size: 28px;
    color: #2d3748;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.login-header p {
    color: #718096;
    margin: 0;
    font-size: 14px;
}

.login-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 14px;
}

.form-group label svg {
    color: #667eea;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.login-footer p {
    color: #718096;
    font-size: 14px;
    margin: 0;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background-color: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.alert-success {
    background-color: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

/* Адаптивность */
@media (max-width: 480px) {
    .login-box {
        padding: 40px 30px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .login-icon {
        width: 70px;
        height: 70px;
    }
}





/* Orders Grid */
.row-cards {
    margin: 0 -0.5rem;
}

.row-cards > [class*='col-'] {
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

/* Order Card */
.order-card {
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.order-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
}

.card-status-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.order-card .card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Order Meta */
.order-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.order-meta .icon {
    flex-shrink: 0;
}

/* Order Description */
.order-description {
    min-height: 40px;
}

/* Order Price */
.order-price .h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Progress Bar */
.progress {
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Status Colors */
.bg-blue { background-color: #3b82f6 !important; }
.bg-blue-lt { background-color: #dbeafe !important; color: #1e40af !important; }

.bg-green { background-color: #10b981 !important; }
.bg-green-lt { background-color: #d1fae5 !important; color: #065f46 !important; }

.bg-yellow { background-color: #f59e0b !important; }
.bg-yellow-lt { background-color: #fef3c7 !important; color: #92400e !important; }

.bg-red { background-color: #ef4444 !important; }
.bg-red-lt { background-color: #fee2e2 !important; color: #991b1b !important; }

.bg-gray { background-color: #6b7280 !important; }
.bg-gray-lt { background-color: #f3f4f6 !important; color: #374151 !important; }

/* Empty State */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.empty-icon .icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
    max-width: 400px;
}

/* Filter Buttons */
.btn-group .btn-check:checked + .btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .row-cards > [class*='col-'] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .page-header .col-auto {
        margin-top: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1199px) {
    .row-cards > .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Badge improvements */
.badge {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Button improvements */
.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--bg-page);
    border-color: var(--border-color);
    color: var(--text-primary);
}


/* ============================================
   КАТАЛОГ ТОВАРОВ - МНОГОУРОВНЕВАЯ НАВИГАЦИЯ
   ============================================ */

.catalog-section {
    margin-bottom: 2rem;
}

.catalog-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.catalog-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
}

.catalog-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.catalog-header .icon {
    color: var(--primary-color);
}

.catalog-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.catalog-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Уровень 1 - Основные категории (вертикально) */
.catalog-level-1 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
}

.category-item-1 {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.category-item-1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-item-1:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.category-item-1:hover::before {
    transform: scaleY(1);
}

.category-item-1.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.category-item-1.active::before {
    transform: scaleY(1);
}

.category-content {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
}

.category-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.category-info {
    flex: 1;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.category-arrow {
    color: var(--text-secondary);
    transition: all 0.3s ease;
    font-size: 1.25rem;
}

.category-item-1:hover .category-arrow,
.category-item-1.active .category-arrow {
    color: var(--primary-color);
    transform: translateX(4px);
}

/* Уровень 2 и 3 - Подкатегории (горизонтально) */
.catalog-sublevel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    background: var(--bg-page);
    border-top: 1px solid var(--border-color);
}

.catalog-sublevel.active {
    max-height: 500px;
    padding: 1.25rem 1rem;
}

.sublevel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.sublevel-header .ti-chevron-right:first-child {
    color: var(--primary-color);
    font-size: 1rem;
}

.sublevel-header .icon {
    color: var(--primary-color);
}

.sublevel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breadcrumb-path {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.breadcrumb-path .ti-chevron-right {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.sublevel-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border-color), transparent);
    margin: 0 0.75rem;
}

.breadcrumb-path .icon {
    font-size: 0.75rem;
    margin: 0 0.25rem;
}

/* Горизонтальная прокрутка для подкатегорий */
.category-scroll-container {
    width: 100%;
}

.category-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.category-scroll-container::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 3px;
}

.category-scroll-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.category-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

.catalog-level-2,
.catalog-level-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    padding-bottom: 0.5rem;
}

@media (min-width: 1400px) {
    .catalog-level-2,
    .catalog-level-3 {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 992px) and (max-width: 1399px) {
    .catalog-level-2,
    .catalog-level-3 {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .catalog-level-2,
    .catalog-level-3 {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

/* Для мобильных */
@media (max-width: 767px) {
    .catalog-level-2,
    .catalog-level-3 {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

.category-item-2,
.category-item-3 {
    flex: none; /* Убираем flex, так как теперь используем grid */
    width: 100%; /* Занимаем всю ширину ячейки грида */
    min-width: unset; /* Убираем минимальную ширину */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item-2:hover,
.category-item-3:hover {
    border-color: var(--primary-color);
    background: var(--bg-card);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}

.category-item-2.active,
.category-item-3.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.category-item-2 .category-name,
.category-item-3 .category-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.category-item-2 .category-count,
.category-item-3 .category-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.category-item-3 {
    min-width: 180px;
    background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
}

/* Кнопка "Показать все товары" */
.view-all-btn {
    margin-top: 1rem;
    text-align: center;
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-view-all:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-view-all .icon {
    transition: transform 0.3s ease;
}

.btn-view-all:hover .icon {
    transform: translateX(4px);
}

/* Анимация появления */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.catalog-sublevel.active {
    animation: slideDown 0.3s ease;
}

/* Пустое состояние */
.catalog-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.catalog-empty .icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .catalog-level-1 {
        grid-template-columns: 1fr;
    }
    
    .category-item-2,
    .category-item-3 {
        min-width: 160px;
    }
    
    .catalog-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }
}

/* Индикатор загрузки */
.catalog-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


.collapsible-section {
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.collapsible-section.collapsed {
    margin-bottom: 1rem;
}

.collapsible-section .page-header {
    transition: all 0.3s ease;
}

.collapsible-section.collapsed .page-header {
    margin-bottom: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem 1.5rem;
}

.section-content {
    max-height: 10000px;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* Кнопка сворачивания */
.section-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.section-toggle:hover {
    background: var(--bg-page);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.15);
}

.section-toggle i {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}

.section-toggle.collapsed i {
    transform: rotate(180deg);
}

/* Индикатор свернутого состояния */
.collapsible-section.collapsed .page-title::after {
    content: '(свернуто)';
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.75rem;
    opacity: 0.7;
}

/* Анимация при сворачивании */
@keyframes collapseSection {
    from {
        max-height: 10000px;
        opacity: 1;
    }
    to {
        max-height: 0;
        opacity: 0;
    }
}

@keyframes expandSection {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 10000px;
        opacity: 1;
    }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .section-toggle {
        width: 36px;
        height: 36px;
    }
    
    .collapsible-section.collapsed .page-title::after {
        display: block;
        margin-left: 0;
        margin-top: 0.25rem;
    }
}