/* ========================================
   WORM-GEARS UNIFIED MODERN STYLES 2025
   Единая система дизайна для всех страниц
   Поддержка светлой и тёмной темы
   ======================================== */

/* Локальная загрузка шрифта Orbitron для логотипа */
@font-face {
    font-family: 'Orbitron';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('../fonts/Orbitron/orbitron.woff2') format('woff2');
}

/* Локальная загрузка шрифта Inter */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/Inter/Inter-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/Inter/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Inter/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Inter/Inter-Bold.woff2') format('woff2');
}

/* CSS Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Root Variables - Design System */
:root {
    /* Typography from Brandbook */
    --font-family-headings: 'Orbitron', monospace;
    --font-family-body: 'Inter', sans-serif;
    
    /* Font Sizes - rem scale (mostly unchanged, good scale) */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    --text-5xl: 3rem;      /* 48px */
    --text-6xl: 3.75rem;   /* 60px */
    
    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Font Weights */
    --font-thin: 100;
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    --font-black: 900;
    
    /* Brandbook v2.0 Color Palette */
    --brand-gradient-start: #1e3c72;
    --brand-gradient-end: #2a5298;
    --brand-secondary-blue: #2a5298;
    --brand-accent-light: #4f7cff;
    --brand-tech-white: #ffffff;
    --brand-industrial-gray: #64748b;
    --brand-precision-dark: #1a1a1a;
    --brand-warning-orange: #f59e0b;
    --brand-success-green: #10b981;
    --brand-error-red: #dc2626; /* From old styles, but good for errors */

    /* Grays for text and backgrounds */
    --gray-50: #f8fafc;  /* New light gray */
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: var(--brand-industrial-gray); /* #64748b */
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: var(--brand-precision-dark); /* #1a1a1a */
    
    /* Spacing Scale - rem based (unchanged) */
    --space-px: 0.0625rem;  /* 1px */
    --space-0: 0;
    --space-1: 0.25rem;     /* 4px */
    --space-2: 0.5rem;      /* 8px */
    --space-3: 0.75rem;     /* 12px */
    --space-4: 1rem;        /* 16px */
    --space-5: 1.25rem;     /* 20px */
    --space-6: 1.5rem;      /* 24px */
    --space-8: 2rem;        /* 32px */
    --space-10: 2.5rem;     /* 40px */
    --space-12: 3rem;       /* 48px */
    --space-16: 4rem;       /* 64px */
    --space-20: 5rem;       /* 80px */
    --space-24: 6rem;       /* 96px */
    --space-32: 8rem;       /* 128px */
    
    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 0.125rem;
    --radius-base: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.625rem;  /* 10px, as per brandbook buttons */
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows from Brandbook */
    --shadow-btn-primary: 0 4px 15px rgba(30, 60, 114, 0.3);
    --shadow-btn-primary-hover: 0 8px 25px rgba(30, 60, 114, 0.4);
    --shadow-card: 0 10px 40px rgba(0,0,0,0.1);

    /* Generic Shadows (kept for other elements, can be tweaked) */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* Dark Theme Shadows */
    --shadow-dark-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-dark-base: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-dark-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-dark-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;

    /* Configurator inline overrides – перенесено из configurator-inline.css */
    --color-surface-alt: var(--gray-100, #f8fafc);
    /* Слабая заливка для выбранной опции */
    --color-primary-fade: rgba(42, 82, 152, 0.06);
}

/* СВЕТЛАЯ ТЕМА (по умолчанию) */
:root,
[data-theme="light"] {
    /* Semantic Colors - Light Theme based on Brandbook v2.0 */
    --color-primary-gradient: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
    --color-primary: var(--brand-gradient-end); /* #2a5298 */
    --color-secondary: var(--brand-accent-light); /* #4f7cff */
    --color-success: var(--brand-success-green);
    --color-warning: var(--brand-warning-orange);
    --color-error: var(--brand-error-red);
    --color-text: var(--brand-precision-dark);
    --color-text-muted: var(--brand-industrial-gray);
    --color-background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-200) 100%);
    --color-surface: var(--brand-tech-white);
    --color-surface-secondary: var(--gray-50);
    --color-border: var(--gray-200);
    --color-border-hover: var(--gray-300);
    --color-input-bg: var(--brand-tech-white);
    --color-header-bg: transparent; /* Header will use background gradient */
    --color-header-text: var(--brand-tech-white);
    --color-footer-bg: var(--gray-900);
    --color-footer-text: var(--gray-100);
    
    /* Component specific colors */
    --color-card-bg: rgba(255, 255, 255, 0.9);
    --color-card-border: rgba(30, 60, 114, 0.1);
    --color-card-hover: var(--brand-tech-white);
    
    /* Shadows */
    --shadow-current: var(--shadow-sm);
    --shadow-current-base: var(--shadow-base);
    --shadow-current-md: var(--shadow-md);
    --shadow-current-lg: var(--shadow-lg);
}

/* ТЁМНАЯ ТЕМА */
[data-theme="dark"] {
    /* Semantic Colors - Dark Theme based on Brandbook v2.0 */
    --color-primary-gradient: linear-gradient(135deg, var(--brand-gradient-start), var(--brand-gradient-end));
    --color-primary: var(--brand-accent-light); /* Lighter blue for dark mode */
    --color-secondary: var(--brand-industrial-gray);
    --color-success: var(--brand-success-green);
    --color-warning: var(--brand-warning-orange);
    --color-error: var(--brand-error-red);
    --color-text: var(--gray-100);
    --color-text-muted: var(--gray-400);
    --color-background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    --color-surface: var(--gray-800);
    --color-surface-secondary: var(--gray-700);
    --color-border: var(--gray-700);
    --color-border-hover: var(--gray-600);
    --color-input-bg: var(--gray-800);
    --color-header-bg: transparent;
    --color-header-text: var(--gray-100);
    --color-footer-bg: var(--gray-900);
    --color-footer-text: var(--gray-100);
    
    /* Component specific colors */
    --color-card-bg: rgba(30, 41, 59, 0.8); /* a bit of transparency */
    --color-card-border: var(--gray-700);
    --color-card-hover: var(--gray-700);
    
    /* Shadows */
    --shadow-current: var(--shadow-dark-sm);
    --shadow-current-base: var(--shadow-dark-base);
    --shadow-current-md: var(--shadow-dark-md);
    --shadow-current-lg: var(--shadow-dark-lg);
}

/* Контейнер для кнопок в header */
.header-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* --- THEME TOGGLE START --- */
/* Обновленные и упрощенные стили для переключателя темы */

.theme-toggle-header {
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    padding: 0;
    display: flex;
    align-items: center;
    transition: background-color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    backdrop-filter: blur(5px);
}

.theme-toggle-header:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transition: left var(--transition-base), transform var(--transition-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slider-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Иконка луны (темная тема) */
.slider-inner::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--primary-800);
    border-radius: 50%;
    box-shadow: 
        -4px -4px 0 -2px var(--primary-700),
        4px -4px 0 -2px var(--primary-700),
        -4px 4px 0 -2px var(--primary-700),
        4px 4px 0 -2px var(--primary-700);
    transition: all var(--transition-base);
    transform: scale(1);
}
.slider-inner::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border: 2px solid var(--primary-800);
    border-radius: 50%;
    transition: all var(--transition-base);
    opacity: 1;
}

/* Состояние светлой темы - солнце */
.theme-toggle-header.light .toggle-slider {
    left: 33px; /* 60px (ширина) - 22px (слайдер) - 3px (отступ) - 2px (бордер)*/
}

.theme-toggle-header.light .slider-inner::before {
    transform: scale(0);
}

.theme-toggle-header.light .slider-inner::after {
    opacity: 0;
}

/* Иконка солнца (светлая тема) - появляется из центра */
.theme-toggle-header.light .slider-inner {
    background-color: transparent;
}

.theme-toggle-header.light .slider-inner::before {
    content: '';
    position: absolute;
    width: 8px; /* центральная часть солнца */
    height: 8px;
    background-color: var(--warning-500);
    border-radius: 50%;
    box-shadow: 
        0 -10px 0 -2px var(--warning-500),
        7px -7px 0 -2px var(--warning-500),
        10px 0 0 -2px var(--warning-500),
        7px 7px 0 -2px var(--warning-500),
        0 10px 0 -2px var(--warning-500),
        -7px 7px 0 -2px var(--warning-500),
        -10px 0 0 -2px var(--warning-500),
        -7px -7px 0 -2px var(--warning-500);
    transform: scale(1); /* Появляется */
}

/* Стили для темной темы самой кнопки */
[data-theme="dark"] .theme-toggle-header {
    background: rgba(42, 82, 152, 0.1);
    border-color: rgba(42, 82, 152, 0.3);
}

[data-theme="dark"] .theme-toggle-header:hover {
    background: rgba(42, 82, 152, 0.15);
    border-color: rgba(42, 82, 152, 0.5);
    box-shadow: 0 0 15px rgba(42, 82, 152, 0.3);
}

/* --- THEME TOGGLE END --- */


/* Предотвращение мерцания при загрузке */
.theme-loading *:not(.toggle-slider) {
    transition: none !important;
}

/* Улучшенные переходы для основных элементов */
body,
.header,
.modern-header,
.footer,
.modern-footer,
.card,
.product-card {
    transition: background-color var(--transition-base), 
                color var(--transition-base),
                border-color var(--transition-base),
                box-shadow var(--transition-base);
}

/* Base Styles */
html {
    scroll-behavior: smooth;
    font-size: 100%; /* 16px base */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-body);
    color: var(--color-text);
    background: var(--color-background);
    line-height: var(--leading-relaxed);
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-headings);
    color: var(--brand-gradient-start);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    line-height: var(--leading-tight);
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); font-weight: 900; letter-spacing: 4px; text-shadow: 0 0 20px rgba(30, 60, 114, 0.3); }
h2 { font-size: var(--text-3xl); font-weight: 700; letter-spacing: 3px; }
h3 { font-family: var(--font-family-body); font-size: var(--text-2xl); font-weight: 600; text-transform: none; color: var(--gray-700); }
h4 { font-size: var(--text-xl); letter-spacing: 1px; }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--gray-100);
}
[data-theme="dark"] h3 {
    color: var(--gray-300);
}

p {
    margin-bottom: var(--space-4);
    color: var(--color-text-muted);
}

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

a:hover {
    color: var(--brand-accent-light);
}

[data-theme="dark"] a:hover {
    color: var(--brand-tech-white);
}

a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ========================================
   UTILITY CLASSES SYSTEM
   ======================================== */

/* === Layout Containers === */
.container {
    width: 100%;
    max-width: 75rem; /* 1200px */
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.container-sm { max-width: 40rem; }   /* 640px */
.container-md { max-width: 48rem; }   /* 768px */
.container-lg { max-width: 64rem; }   /* 1024px */
.container-xl { max-width: 80rem; }   /* 1280px */
.container-2xl { max-width: 96rem; }  /* 1536px */

/* === Grid System === */
.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-full { grid-column: 1 / -1; }

/* === Flexbox Utilities === */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

/* === Gap Utilities === */
.gap-0 { gap: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Button Components */
.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-success, .btn-modern {
    display: inline-block;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: var(--font-semibold);
    font-family: var(--font-family-body);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.btn::before, .btn-primary::before, .btn-secondary::before, .btn-outline::before, .btn-success::before, .btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.btn:hover::before, .btn-primary:hover::before, .btn-secondary:hover::before, .btn-outline:hover::before, .btn-success:hover::before, .btn-modern:hover::before {
    left: 100%;
}

.btn:focus, .btn-primary:focus, .btn-secondary:focus, .btn-outline:focus, .btn-success:focus, .btn-modern:focus {
    outline: 3px solid var(--brand-accent-light);
    outline-offset: 2px;
}

.btn:disabled, .btn-primary:disabled, .btn-secondary:disabled, .btn-outline:disabled, .btn-success:disabled, .btn-modern:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-image: none;
    background-color: var(--gray-300);
}

.btn-primary {
    background: var(--color-primary-gradient);
    color: var(--brand-tech-white);
    box-shadow: var(--shadow-btn-primary);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--brand-accent-light), var(--brand-secondary-blue));
    color: var(--brand-tech-white);
}

.btn-outline {
    background: transparent;
    color: var(--brand-gradient-start);
    border-color: var(--brand-gradient-start);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--brand-tech-white);
    border-color: var(--color-success);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
}

.btn-modern {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.btn-modern:hover::before {
    left: 100%;
}

.btn-modern:focus {
    outline: 3px solid var(--brand-accent-light);
    outline-offset: 2px;
}

.btn-modern:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-image: none;
    background-color: var(--gray-300);
}

.btn-primary.btn-modern {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.25);
}

.btn-primary.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(30, 60, 114, 0.35);
}

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

.btn-secondary.btn-modern {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.btn-secondary.btn-modern:hover {
    background: rgba(100, 116, 139, 0.15);
    transform: translateY(-1px);
    color: #1e3c72;
}

.btn-outline.btn-modern {
    color: var(--brand-accent-light);
    border-color: var(--brand-accent-light);
}

.btn-outline.btn-modern:hover:not(:disabled) {
    background: var(--brand-accent-light);
    color: var(--brand-precision-dark);
}

.btn-success.btn-modern {
    background-color: var(--success-600);
    border-color: var(--success-600);
    color: white;
    text-decoration: none;
}

.btn-success.btn-modern:hover:not(:disabled) {
    background-color: var(--success-700);
    border-color: var(--success-700);
    color: white;
    text-decoration: none;
}

.btn-modern.loading .loading-animation {
    display: inline-block;
}

.btn-modern.loading .btn-text {
    display: none;
}

/* ========================================
   BASE COMPONENT CLASSES
   ======================================== */

/* === Base Input/Form Elements === */
.input-base,
.form-input,
.form-select,
.form-textarea,
.filter-select,
.range-input {
    display: block;
    width: 100%;
    padding: var(--space-3);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.input-base:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.filter-select:focus,
.range-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
    background-color: var(--color-surface);
}

/* === Base Info/Alert Components === */
.info-base,
.alert,
.service-factor-info,
.filter-info {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid;
    margin: var(--space-4) 0;
    position: relative;
}

.info-base h4,
.alert h4,
.service-factor-info h4,
.filter-info h4 {
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.info-base p,
.alert p,
.service-factor-info p,
.filter-info p {
    margin-bottom: 0;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* === Base Grid Components === */
.grid-base,
.shaft-options-grid,
.flange-options-grid,
.mount-position-grid,
.motor-position-grid,
.flange-variant-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.grid-base > div,
.shaft-options-grid > div,
.flange-options-grid > div,
.mount-position-grid > div,
.motor-position-grid > div,
.flange-variant-grid > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.grid-base img,
.shaft-options-grid img,
.flange-options-grid img,
.mount-position-grid img,
.motor-position-grid img,
.flange-variant-grid img {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
    transition: transform var(--transition-fast);
}

/* === Base Select/Button Components === */
.select-base,
.select-drawing,
.select-reset,
.select-order,
.btn-select {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: var(--font-medium);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid;
}

.select-base:hover,
.select-drawing:hover,
.select-reset:hover,
.select-order:hover,
.btn-select:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* === Base Table Components === */
.table-base,
.table,
.specs-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-base th,
.table-base td,
.table th,
.table td,
.specs-table th,
.specs-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table-base th,
.table th,
.specs-table th {
    background-color: var(--gray-50);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    font-size: var(--text-sm);
}

/* NEW: предотвращаем расширение страницы при большом min-content таблицы */
.catalog-layout > .table-container {
    min-width: 0; /* grid-элемент может сжиматься */
}

.table-container {
    overflow-x: auto; /* горизонтальный скролл при необходимости */
}

/* === Base Container Components === */
.container-base,
.filter-container,
.drawing-container,
.product-code-container {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    position: relative;
}

/* ========================================
   COMPONENT SPECIFIC STYLES
   ======================================== */

/* Form Components */
.form-group {
    margin-bottom: var(--space-6);
}

.form-label,
.filter-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.form-textarea {
    resize: vertical;
    min-height: 6rem;
}

/* Header Component */
.header,
.modern-header {
    padding: var(--space-4) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--color-primary-gradient);
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

/* Worm-Gears Logo - Адаптированный дизайн для header */
.logo {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    position: relative;
    transition: all var(--transition-base);
}

.logo:hover {
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.logo-worm-gears {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base);
}

.logo:hover .logo-worm-gears {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gear-animation {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-full);
    position: relative;
    animation: rotate 10s linear infinite;
    flex-shrink: 0;
}

.gear-animation::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-full);
    border-style: dashed;
}

.gear-animation::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-full);
    transform: translate(-50%, -50%);
}

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

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-text .main-title {
    font-family: 'Orbitron', 'Inter', monospace;
    font-size: var(--text-lg);
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 
            0 0 10px rgba(255, 255, 255, 0.5),
            0 0 20px rgba(255, 255, 255, 0.3);
    }
    to {
        text-shadow: 
            0 0 15px rgba(255, 255, 255, 0.8),
            0 0 25px rgba(255, 255, 255, 0.5);
    }
}

.logo-subtitle {
    font-size: var(--text-xs);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

.worm-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(255, 255, 255, 0.3) 10%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0.3) 90%,
        transparent 100%);
    animation: slide 16s ease-in-out infinite;
}

@keyframes slide {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* Navigation */
.nav,
.main-nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.nav-link {
    color: white;
    font-weight: var(--font-medium);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-link:hover,
.nav-link:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-200);
    text-decoration: none;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--primary-200);
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
    flex-direction: column;
    width: 2rem;
    height: 2rem;
    justify-content: center;
    align-items: center;
    gap: var(--space-1);
}

.mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle span {
    display: block;
    width: 1.25rem;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Hero Section */
.hero,
.hero-section {
    background: linear-gradient(135deg, var(--gray-50), var(--color-surface));
    padding: var(--space-20) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero.primary,
.hero-section.primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
}

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

.hero-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-6);
    line-height: var(--leading-tight);
}

.hero-subtitle {
    font-size: var(--text-lg);
    font-weight: var(--font-light);
    color: var(--gray-600); /* Old color, we will improve this */
    max-width: 65ch;
    margin: var(--space-4) auto;
}

[data-theme="light"] .hero-subtitle {
    color: var(--gray-700); /* Darker text for better contrast on light theme */
}

[data-theme="dark"] .hero-subtitle {
    color: var(--gray-300); /* Lighter text for dark theme */
}

.hero.primary .hero-subtitle,
.hero-section.primary .hero-subtitle {
    color: var(--color-text-muted);
}

.hero-cta {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

/* Card Component */
.card, .product-card, .Pocket-box {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-current);
    transition: all var(--transition-base);
}

.card:hover, .product-card:hover, .Pocket-box:hover {
    background-color: var(--color-card-hover);
    box-shadow: var(--shadow-current-lg);
    transform: translateY(-2px);
    border-color: var(--color-border-hover);
}

.card-header, .Pocket-box h3 {
    margin-bottom: var(--space-4);
}

.card-title, .product-title, .Pocket-box h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.card-description, .product-description, .Pocket-box p {
    color: var(--color-text-muted);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

/* Breadcrumbs */
.breadcrumbs {
    background-color: var(--color-surface);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.breadcrumbs-list {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.breadcrumbs-link {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumbs-link:hover {
    text-decoration: underline;
}

.breadcrumbs-separator,
.separator {
    color: var(--color-text-muted);
}

.breadcrumbs-current,
.current {
    color: var(--color-text);
    font-weight: var(--font-medium);
}

/* Main Content */
.main-content {
    padding: var(--space-10) 0;
    background-color: var(--color-surface);
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: var(--space-10);
}

.page-title {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-4);
}

.page-description {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    max-width: 70ch;
    margin-left: auto;
    margin-right: auto;
}

[data-theme="light"] .page-description {
    color: var(--gray-700);
}

[data-theme="dark"] .page-description {
    color: var(--gray-300);
}

/* Catalog Layout */
.catalog-layout {
    display: grid;
    /* 300px sidebar, вторая колонка может сжиматься */
    grid-template-columns: 18.75rem minmax(0, 1fr);
    gap: var(--space-10);
    align-items: start;
}

.catalog-sidebar {
    background-color: var(--color-surface-secondary);
    border-radius: var(--radius-xl);
    padding: 0;
    position: sticky;
    top: calc(var(--space-20) + var(--space-4)); /* Header height + margin */
}

.filter-panel {
    padding: var(--space-6);
}

.filter-panel h3 {
    color: var(--color-primary);
    margin-bottom: var(--space-6);
    font-size: var(--text-xl);
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.filter-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

/* Catalog Info Block - Адаптивный блок с изображением продукта */
.catalog-info {
    display: flex;
    align-items: flex-start;
    gap: var(--space-6);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base);
}

.catalog-info:hover {
    box-shadow: var(--shadow-md);
}

.product-image {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    min-width: 200px;
    min-height: 160px;
    max-width: 50%;
}

.product-image img {
    max-width: 350px;
    max-height: 350px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-base);
    transition: transform var(--transition-base);
}

.product-image:hover img {
    transform: scale(1.05);
}

.product-description {
    flex: 1;
    min-width: 0;
}

.product-description h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-3);
    line-height: var(--leading-tight);
}

.product-description p {
    font-size: var(--text-base);
    color: var(--color-text-muted);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

.service-factor-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.service-factor-info .highlight {
    background: var(--primary-100);
    color: var(--primary-800);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-base);
    font-weight: var(--font-medium);
}

.service-factor-info .info-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.service-factor-info .info-link:hover {
    background: var(--primary-700);
    transform: scale(1.1);
}

[data-theme="dark"] .service-factor-info .highlight {
    background: var(--primary-900);
    color: var(--primary-200);
}

/* Pagination Styles */
.pagination-top,
.pagination-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.pagination-bottom {
    margin-bottom: 0;
    margin-top: var(--space-4);
    justify-content: center;
}

.pagination-info {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.pagination-controls,
.current-page {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text);
}

/* Table Component Specific */
.table-container,
.results-table-container {
    overflow: hidden;
    box-shadow: var(--shadow-current);
}

.results-table {
    width: 100rem;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.results-table th {
    background-color: var(--color-surface-secondary);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

.table tbody tr:hover,
.results-table tbody tr:hover {
    background-color: var(--color-surface-secondary);
}

/* Footer */
.footer,
.modern-footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: var(--space-16) 0 var(--space-8);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.footer-section h4 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
    color: white;
}

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

.footer-section ul li {
    margin-bottom: var(--space-2);
}

.footer-section ul li a {
    color: var(--gray-300);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-section ul li a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid var(--gray-700);
    padding-top: var(--space-8);
    text-align: center;
    color: var(--gray-400);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: var(--space-6);
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
}

.product-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-50);
    border-radius: var(--radius-lg);
    color: var(--color-primary);
}

.product-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-primary);
    font-weight: var(--font-medium);
    text-decoration: none;
    margin-top: var(--space-4);
}

.product-link:hover {
    text-decoration: underline;
}

/* Process Steps */
.process-section {
    background-color: var(--color-surface-secondary);
    padding: var(--space-20) 0;
}

.process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: var(--space-8);
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
}

.process-step {
    text-align: center;
}

.step-number {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    margin: 0 auto var(--space-4);
}

.step-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.step-description {
    color: var(--color-text-muted);
    line-height: var(--leading-relaxed);
}

/* Section Titles */
.section-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    text-align: center;
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    text-align: center;
    margin-top: calc(-1 * var(--space-3));
    margin-bottom: var(--space-8);
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

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

.text-center { text-align: center; }
/* === Typography Utilities === */
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* === Background Utilities === */
.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-surface { background-color: var(--color-surface); }
.bg-success { background-color: var(--color-success); }
.bg-error { background-color: var(--color-error); }
.bg-warning { background-color: var(--color-warning); }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-gray-200 { background-color: var(--gray-200); }
.bg-transparent { background-color: transparent; }

/* === Border Radius Utilities === */
.rounded { border-radius: var(--radius-base); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }
.rounded-none { border-radius: 0; }

/* === Shadow Utilities === */
.shadow { box-shadow: var(--shadow-base); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-none { box-shadow: none; }

/* === Display Utilities === */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* === Position Utilities === */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.top-0 { top: 0; }
.top-4 { top: var(--space-4); }
.right-0 { right: 0; }
.right-4 { right: var(--space-4); }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* === Z-Index Utilities === */
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* === Width/Height Utilities === */
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.min-h-screen { min-height: 100vh; }

/* === Overflow Utilities === */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }

/* === Spacing Utilities === */
.space-y-3 > * + * { margin-top: var(--space-3); }
.space-y-6 > * + * { margin-top: var(--space-6); }

/* === Margin Utilities === */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }
.m-auto { margin: auto; }

.mx-0 { margin-left: 0; margin-right: 0; }
.mx-1 { margin-left: var(--space-1); margin-right: var(--space-1); }
.mx-2 { margin-left: var(--space-2); margin-right: var(--space-2); }
.mx-3 { margin-left: var(--space-3); margin-right: var(--space-3); }
.mx-4 { margin-left: var(--space-4); margin-right: var(--space-4); }
.mx-auto { margin-left: auto; margin-right: auto; }

.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: var(--space-1); margin-bottom: var(--space-1); }
.my-2 { margin-top: var(--space-2); margin-bottom: var(--space-2); }
.my-3 { margin-top: var(--space-3); margin-bottom: var(--space-3); }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-6 { margin-top: var(--space-6); margin-bottom: var(--space-6); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.ml-4 { margin-left: var(--space-4); }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.mr-4 { margin-right: var(--space-4); }
.mr-auto { margin-right: auto; }

/* === Padding Utilities === */
.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: var(--space-1); padding-right: var(--space-1); }
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* Responsive Design - Desktop First */
@media (max-width: 1024px) {
    .catalog-layout {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    
    .catalog-sidebar {
        position: static;
    }
    
    .hero-title {
        font-size: var(--text-4xl);
    }
    
    .container {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    }

    /* Catalog Info - Планшеты */
    .catalog-info {
        gap: var(--space-4);
        padding: var(--space-4);
    }

    .product-image {
        min-width: 160px;
        min-height: 120px;
        padding: var(--space-3);
        max-width: 50%; /* Сохраняем ограничение 70% на планшетах */
    }

    .product-description h3 {
        font-size: var(--text-lg);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .logo-worm-gears {
        width: 220px;
    }

    .gear-animation {
        width: 30px;
        height: 30px;
    }

    .gear-animation::after {
        width: 18px;
        height: 18px;
    }

    .logo-text .main-title {
        font-size: 1.5rem;
    }

    .logo-subtitle {
        font-size: 0.5rem;
    }

    /* Удаляем старые, конфликтующие стили для переключателя темы */
    /* .theme-toggle-header { ... } */
    /* .toggle-slider { ... } */
    /* .theme-toggle-header .toggle-slider { ... } */
    /* .theme-toggle-header.light .toggle-slider { ... } */
    /* .slider-inner { ... } */

    .nav,
    .modern-nav {
        order: 3;
        display: flex;
        flex-direction: column;
        gap: var(--space-2);
        width: 100%;
        background-color: rgba(0, 0, 0, 0.1);
        padding: var(--space-4);
        border-radius: var(--radius-md);
        margin-top: var(--space-4);
    }
    
    .nav.active,
    .main-nav.active {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-self: flex-end;
    }
    
    .hero,
    .hero-section {
        padding: var(--space-16) 0;
    }
    
    .hero-title {
        font-size: var(--text-3xl);
    }
    
    .hero-subtitle {
        font-size: var(--text-lg);
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
    }
    
    .page-title {
        font-size: var(--text-3xl);
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .process-steps {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    /* Catalog Info - Мобильные устройства */
    .catalog-info {
        flex-direction: column;
        gap: var(--space-4);
        padding: var(--space-4);
    }

    .product-image {
        min-width: auto;
        min-height: 120px;
        width: 100%;
        max-width: min(200px, 70%); /* Ограничиваем до 70% или 200px, что меньше */
        margin: 0 auto;
    }

    .product-description {
        text-align: center;
    }

    .product-description h3 {
        font-size: var(--text-lg);
        margin-bottom: var(--space-2);
    }

    .product-description p {
        font-size: var(--text-sm);
        margin-bottom: var(--space-3);
    }

    .service-factor-info {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Pagination - Мобильные устройства */
    .pagination-top {
        flex-direction: column;
        gap: var(--space-2);
        text-align: center;
    }

    .pagination-info,
    .pagination-controls,
    .current-page {
        font-size: var(--text-xs);
    }
}

@media (max-width: 480px) {
    .logo-worm-gears {
        width: 180px;
    }

    .gear-animation {
        width: 25px;
        height: 25px;
        top: -3px;
    }

    .gear-animation::before {
        width: 28px;
        height: 28px;
        border-width: 3px;
    }

    .gear-animation::after {
        width: 15px;
        height: 15px;
    }

    .logo-text .main-title {
        font-size: 1.25rem;
    }
    .logo-subtitle {
        font-size: 0.4rem;
    }

    .worm-line {
        height: 30px;
    }

    /* Удаляем старые, конфликтующие стили для переключателя темы */
    /* .theme-toggle-header { ... } */
    /* .toggle-slider { ... } */
    /* .theme-toggle-header .toggle-slider { ... } */
    /* .theme-toggle-header.light .toggle-slider { ... } */
    /* .slider-inner { ... } */

    .hero-title {
        font-size: var(--text-3xl);
    }
    
    .page-title {
        font-size: var(--text-2xl);
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero-cta .btn {
        width: auto;
        min-width: 10rem;
    }
    
    .container {
        padding-left: var(--space-2);
        padding-right: var(--space-2);
    }
    
    .section-title {
        font-size: var(--text-2xl);
    }
    
    .step-number {
        width: 3rem;
        height: 3rem;
        font-size: var(--text-lg);
    }

    /* Catalog Info - Маленькие экраны */
    .catalog-info {
        padding: var(--space-3);
        gap: var(--space-3);
        margin-bottom: var(--space-4);
    }

    .product-image {
        min-height: 100px;
        max-width: min(150px, 70%); /* Ограничиваем до 70% или 150px, что меньше */
        padding: var(--space-2);
    }

    .product-description h3 {
        font-size: var(--text-base);
        margin-bottom: var(--space-2);
    }

    .product-description p {
        font-size: var(--text-xs);
        line-height: var(--leading-normal);
    }

    .service-factor-info {
        font-size: var(--text-xs);
        gap: var(--space-1);
    }

    .service-factor-info .highlight {
        padding: var(--space-1);
        font-size: var(--text-xs);
    }

    .service-factor-info .info-link {
        width: 1rem;
        height: 1rem;
        font-size: 0.625rem; /* 10px */
    }
}

/* Print Styles */
@media print {
    .header,
    .modern-header,
    .footer,
    .modern-footer,
    .mobile-menu-toggle,
    .btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card,
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .logo-icon::before,
    .loading::after,
    .theme-loading *:not(.toggle-slider) {
        transition: none !important;
        animation: none !important;
    }
    
    .logo-text .main-title {
        animation: none;
    }
    
    .theme-toggle-header .toggle-slider,
    .slider-inner {
        transition: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #000000;
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
        --shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        border-width: 2px;
    }
}

/* Автоматическое определение темы на основе системных настроек */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        /* Semantic Colors - Dark Theme */
        --color-primary: var(--primary-400);
        --color-secondary: var(--gray-400);
        --color-success: var(--success-500);
        --color-warning: var(--warning-500);
        --color-error: var(--error-500);
        --color-text: var(--gray-100);
        --color-text-muted: var(--gray-400);
        --color-background: var(--gray-900);
        --color-surface: var(--gray-800);
        --color-surface-secondary: var(--gray-700);
        --color-border: var(--gray-700);
        --color-border-hover: var(--gray-600);
        --color-input-bg: var(--gray-800);
        --color-header-bg: var(--gray-900);
        --color-header-text: var(--gray-100);
        --color-footer-bg: var(--gray-900);
        --color-footer-text: var(--gray-100);
        
        /* Component specific colors */
        --color-card-bg: var(--gray-800);
        --color-card-border: var(--gray-700);
        --color-card-hover: var(--gray-700);
        
        /* Shadows */
        --shadow-current: var(--shadow-dark-sm);
        --shadow-current-base: var(--shadow-dark-base);
        --shadow-current-md: var(--shadow-dark-md);
        --shadow-current-lg: var(--shadow-dark-lg);
    }
}

/* Alert Component Specific */
.alert {
    font-weight: var(--font-medium);
}

.alert-success {
    background-color: var(--success-50);
    border-color: var(--success-500);
    color: var(--success-600);
}

.alert-error {
    background-color: var(--error-50);
    border-color: var(--error-500);
    color: var(--error-600);
}

.alert-warning {
    background-color: var(--warning-50);
    border-color: var(--warning-500);
    color: var(--warning-600);
}

/* Border Utilities */
.border-error {
    border-color: var(--error-500) !important;
}

.border-success {
    border-color: var(--success-500) !important;
}

/* Space Utilities */
.space-y-3 > * + * {
    margin-top: var(--space-3);
}

.space-y-6 > * + * {
    margin-top: var(--space-6);
}

/* Additional Utility Classes (removed duplicates) */

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: var(--radius-full);
    animation: spin 4s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Removed duplicate utility classes - now centralized above */

/* Address styling */
address {
    font-style: normal;
}

address a {
    color: inherit;
    text-decoration: none;
}

address a:hover {
    text-decoration: underline;
}

/* Configurator Page Styles */
.configurator-page {
    background-color: var(--color-background);
}

.configurator-visualization {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
    box-shadow: var(--shadow-sm);
    text-align: center;
    min-height: 20rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.configurator-visualization::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-50), var(--gray-50));
    opacity: 0.5;
    z-index: -1;
}

.configurator-nomenclature {
    margin-bottom: var(--space-8);
}

.configurator-nomenclature .card {
    text-align: center;
    padding: var(--space-8);
}

.configurator-actions {
    margin-bottom: var(--space-10);
}

.configurator-steps {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

/* Configurator Tabs */
.configurator-tabs-container {
    margin-bottom: var(--space-8);
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.configurator-tabs {
    display: flex;
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.configurator-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex: 1;
    min-width: 8rem;
    background-color: transparent;
    border: none;
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 3px solid transparent;
    text-align: center;
    white-space: nowrap;
}

.tab-item:hover {
    background-color: var(--gray-100);
    color: var(--color-text);
}

.tab-item.active {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    padding: var(--space-6);
    min-height: 20rem;
}

/* Product Visualization - Updated */
.product-visualization {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 20rem;
    background: linear-gradient(135deg, var(--gray-50), var(--color-surface));
    border-radius: var(--radius-lg);
    margin: var(--space-4) 0;
    position: relative;
    overflow: hidden;
    padding: var(--space-6);
}

.visualization-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 15rem;
    position: relative;
}

.reductor-assembly {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    max-width: 100%;
}

.reductor-part {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    transition: all var(--transition-base);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    margin: var(--space-2);
}

.reductor-part:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-300);
    z-index: 10;
}

.part-base,
.part-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.part-base {
    z-index: 1;
}

.part-overlay {
    z-index: 2;
}

.reductor-part img {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Responsive adjustments for layered visualization */
@media (max-width: 1024px) {
    .reductor-assembly {
        gap: var(--space-3);
    }
    
    .reductor-part {
        width: 180px;
        height: 180px;
    }
    
    .reductor-part img {
        max-width: 160px;
        max-height: 160px;
    }
}

@media (max-width: 768px) {
    .product-visualization {
        min-height: 15rem;
        padding: var(--space-4);
    }
    
    .visualization-container {
        min-height: 12rem;
    }
    
    .reductor-assembly {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .reductor-part {
        width: 160px;
        height: 160px;
    }
    
    .reductor-part img {
        max-width: 140px;
        max-height: 140px;
    }
}

@media (max-width: 480px) {
    .configurator-visualization {
        padding: var(--space-3);
        min-height: 12rem;
    }
    
    .product-visualization {
        min-height: 12rem;
        padding: var(--space-3);
    }
    
    .visualization-container {
        min-height: 10rem;
    }
    
    .reductor-part {
        width: 140px;
        height: 140px;
    }
    
    .reductor-part img {
        max-width: 120px;
        max-height: 120px;
    }
}

/* Product Code Components - Updated */
.product-code-container {
    background: linear-gradient(135deg, var(--primary-50), var(--gray-50));
    border: 2px solid var(--primary-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin: var(--space-6) 0;
    text-align: center;
}

.product-code-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-primary);
    margin-bottom: var(--space-3);
}

.product-code {
    font-family: var(--font-family-mono);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-muted);
    background-color: var(--color-surface);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: inline-block;
    letter-spacing: 0.05em;
    margin: var(--space-2) 0;
    word-break: break-all;
}

.separator {
    color: var(--color-text-muted);
    margin: 0 2px;
}

.product-code-copy {
    margin-top: var(--space-4);
}

.copy-btn {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color:var(--color-primary);
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.copy-btn:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.copy-icon {
    font-size: var(--text-base);
}

/* Action Buttons - Updated */
.action-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-8) 0;
    flex-wrap: wrap;
}

.select-drawing,
.select-reset,
.select-order {
    background-color: var(--color-primary);
    color:var(--color-primary);
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 10rem;
    justify-content: center;
}

.select-drawing {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
}

.select-reset {
    background: linear-gradient(135deg, var(--gray-500), var(--gray-600));
}

.select-order {
    background: linear-gradient(135deg, var(--success-500), var(--success-600));
}

.select-drawing:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.select-reset:hover {
    background: linear-gradient(135deg, var(--gray-600), var(--gray-700));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.select-order:hover {
    background: linear-gradient(135deg, var(--success-600), var(--success-700));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Configurator Tabs - Updated */
.configurator-tabs-container {
    margin-bottom: var(--space-8);
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.configurator-tabs {
    display: flex;
    background-color: var(--gray-50);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.configurator-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex: 1;
    min-width: 12rem;
    background-color: transparent;
    border: none;
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 3px solid transparent;
    text-align: center;
    white-space: nowrap;
    position: relative;
}

.tab-item:hover {
    background-color: var(--gray-100);
    color: var(--color-text);
}

.tab-item.active {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: var(--font-semibold);
}

.tab-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    padding: 0;
}

.tab-title {
    display: block;
    line-height: var(--leading-tight);
}

/* Responsive Design for Configurator - Updated */
@media (max-width: 1024px) {
    .configurator-tabs {
        flex-wrap: wrap;
    }
    
    .tab-item {
        flex: 1 1 auto;
        min-width: 10rem;
    }
}

/* Legacy Classes Support */
.Pocket-box {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.Pocket-box h3 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-4);
    text-align: center;
}

.Pocket-box table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.Pocket-box td {
    text-align: center;
    padding: var(--space-3);
    vertical-align: top;
    border: none;
}

.Pocket-box a {
    display: block;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    color: var(--color-text);
    border: 2px solid transparent;
}

.Pocket-box a:hover {
    background-color: var(--primary-50);
    border-color: var(--primary-200);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.Pocket-box img {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto var(--space-2);
    border-radius: var(--radius-md);
}

.text14 {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.select_mount_text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--space-2);
    line-height: var(--leading-tight);
}

/* Selection States */
.selectborder {
    border: 2px solid var(--color-primary) !important;
    background-color: var(--primary-50) !important;
}

.greenborder {
    border: 2px solid var(--success-500) !important;
    background-color: var(--success-50) !important;
}

.selectborder:hover,
.greenborder:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Product Code Display */
.product-code-container {
    background: linear-gradient(135deg, var(--primary-50), var(--gray-50));
    border: 2px solid var(--primary-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin: var(--space-6) 0;
    text-align: center;
}

.product-code {
    font-family: var(--font-family-mono);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text);
    background-color: var(--color-surface);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: inline-block;
    letter-spacing: 0.05em;
    margin: var(--space-2) 0;
}

.code-component {
    display: inline-block;
    margin: 0 2px;
    padding: 2px 4px;
    background-color:var(--color-card-bg);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    border: 1px solid var(--gray-200);
   
}

/* Action Buttons Container */
.action-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-8) 0;
    flex-wrap: wrap;
}

.select-reset {
    background-color: var(--gray-500);
    color: white;
    border: none;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.select-reset:hover {
    background-color: var(--gray-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Responsive adjustments for legacy classes */
@media (max-width: 768px) {
    .Pocket-box {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
    }
    
    .Pocket-box img {
        max-width: 110px;
        max-height: 110px;
    }
    
    .select_mount_text {
        font-size: 11px;
        padding: var(--space-1);
    }
    
    .action-buttons-container {
        flex-direction: column;
        align-items: center;
    }
    
    .select-reset {
        width: 100%;
        max-width: 20rem;
        justify-content: center;
    }
    
    .product-code {
        font-size: var(--text-lg);
        padding: var(--space-2) var(--space-4);
        word-break: break-all;
    }
    
    .product-code-container {
        padding: var(--space-4);
    }
}

@media (max-width: 480px) {
    .Pocket-box img {
        max-width: 90px;
        max-height: 90px;
    }
    
    .select_mount_text {
        font-size: 10px;
    }
    
    .product-code {
        font-size: var(--text-base);
        padding: var(--space-2) var(--space-3);
    }
    
    .Pocket-box h3 {
        font-size: var(--text-base);
    }
}

/* Grid Component Specific */
.shaft-options-grid,
.flange-options-grid,
.mount-position-grid,
.motor-position-grid,
.flange-variant-grid {
    margin: var(--space-4) 0;
    justify-items: center;
}

.shaft-options-grid > div,
.flange-options-grid > div,
.mount-position-grid > div,
.motor-position-grid > div,
.flange-variant-grid > div {
    width: 100%;
    max-width: 150px;
}

.shaft-options-grid a,
.flange-options-grid a,
.mount-position-grid a,
.motor-position-grid a,
.flange-variant-grid a {
    display: block;
    padding: var(--space-3);
    text-decoration: none;
    color: var(--color-text);
    border: 2px solid var(--color-border);
    background-color: var(--color-surface);
    width: 100%;
    margin-bottom: var(--space-2);
}

.shaft-options-grid a:hover,
.flange-options-grid a:hover,
.mount-position-grid a:hover,
.motor-position-grid a:hover,
.flange-variant-grid a:hover {
    background-color: var(--primary-50);
    border-color: var(--primary-200);
}

.shaft-options-grid img,
.flange-options-grid img,
.mount-position-grid img,
.motor-position-grid img,
.flange-variant-grid img {
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

/* Text styling for option descriptions */
.text10 {
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
}

.text-drawing {
    color: var(--color-primary);
    font-weight: var(--font-medium);
}

.text-drawing:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

/* Responsive design for configuration grids */
@media (max-width: 1024px) {
    .shaft-options-grid,
    .flange-options-grid,
    .mount-position-grid,
    .motor-position-grid,
    .flange-variant-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: var(--space-3);
    }
    
    .shaft-options-grid img,
    .flange-options-grid img,
    .mount-position-grid img,
    .motor-position-grid img,
    .flange-variant-grid img {
        max-width: 80px;
        max-height: 80px;
    }
}

@media (max-width: 768px) {
    .shaft-options-grid,
    .flange-options-grid,
    .mount-position-grid,
    .motor-position-grid,
    .flange-variant-grid {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
        gap: var(--space-2);
    }
    
    .shaft-options-grid > div,
    .flange-options-grid > div,
    .mount-position-grid > div,
    .motor-position-grid > div,
    .flange-variant-grid > div {
        max-width: 120px;
    }
    
    .shaft-options-grid img,
    .flange-options-grid img,
    .mount-position-grid img,
    .motor-position-grid img,
    .flange-variant-grid img {
        max-width: 70px;
        max-height: 70px;
    }
    
    .select_mount_text {
        font-size: 10px;
        line-height: var(--leading-tight);
    }
}

@media (max-width: 480px) {
    .shaft-options-grid,
    .flange-options-grid,
    .mount-position-grid,
    .motor-position-grid,
    .flange-variant-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }
    
    .shaft-options-grid > div,
    .flange-options-grid > div,
    .mount-position-grid > div,
    .motor-position-grid > div,
    .flange-variant-grid > div {
        max-width: 100px;
    }
    
    .shaft-options-grid img,
    .flange-options-grid img,
    .mount-position-grid img,
    .motor-position-grid img,
    .flange-variant-grid img {
        max-width: 60px;
        max-height: 60px;
    }
}

/* Специфичные стили для конфигуратора - избегаем конфликтов с каталогом */
.configurator-page .btn-select {
    background: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-medium);
    transition: var(--transition-base);
    cursor: pointer;
}

.configurator-page .btn-select:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.configurator-page .btn-select:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Отключаем стили каталога на странице конфигуратора */
.configurator-page .filter-form {
    display: none !important;
}

.configurator-page .results-table {
    display: none !important;
}

.configurator-page .catalog-layout {
    display: none !important;
}

/* Улучшенные стили для элементов конфигуратора */
.configurator-page .selectborder,
.configurator-page .greenborder {
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.configurator-page .selectborder::before,
.configurator-page .greenborder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.configurator-page .selectborder:hover::before,
.configurator-page .greenborder:hover::before {
    left: 100%;
}

/* Защита от конфликтов JavaScript */
.configurator-page .filter-active,
.configurator-page .filter-inactive {
    all: unset;
}

.configurator-page .filter-clicked {
    all: unset;
}

.btn-disabled {
    background: var(--gray-200);
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-medium);
    cursor: not-allowed;
    opacity: 0.6;
}

[data-theme="dark"] .btn-disabled {
    background: var(--gray-700);
    color: var(--gray-400);
    border-color: var(--gray-700);
}

/* Smart Filters Styles */
.smart-filter-select {
    transition: all 0.3s ease;
}

.smart-filter-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

/* Недоступные опции в выпадающих списках */
.smart-filter-select .option-unavailable,
.smart-filter-select option:disabled {
    color: var(--gray-400) !important;
    background-color: var(--gray-50) !important;
    font-style: italic;
}

[data-theme="dark"] .smart-filter-select .option-unavailable,
[data-theme="dark"] .smart-filter-select option:disabled {
    color: var(--gray-600) !important;
    background-color: var(--gray-800) !important;
}

/* Индикатор обновления фильтров */
.filter-updating {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.filter-updating::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translateY(-50%);
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Стили для полей с информацией о количестве */
.filter-group input[type="number"][title]:hover {
    position: relative;
}

.filter-group input[type="number"][title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--color-text);
    color: var(--color-surface);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

/* Анимация для обновления опций */
.smart-filter-select.updating {
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 2v6h-6M3 12a9 9 0 0 1 15-6.7l-3 3M3 22v-6h6M21 12a9 9 0 0 1-15 6.7l3-3"/></svg>');
    background-size: 16px 16px;
    background-position: calc(100% - 8px) center;
    background-repeat: no-repeat;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Стили для счетчика результатов в опциях */
.smart-filter-select option {
    padding: 4px 8px;
}

.smart-filter-select option[data-count="0"] {
    color: var(--gray-400);
    font-style: italic;
}

[data-theme="dark"] .smart-filter-select option[data-count="0"] {
    color: var(--gray-600);
    background-color: var(--gray-800);
}

/* Улучшенные стили для range inputs */
.range-inputs input[type="number"] {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.range-inputs input[type="number"]:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

.range-inputs input[type="number"][title] {
    position: relative;
}

/* Индикатор валидности диапазона */
.range-inputs input[type="number"].range-invalid {
    border-color: var(--red-500);
    background-color: rgba(var(--red-500-rgb), 0.05);
}

.range-inputs input[type="number"].range-valid {
    border-color: var(--green-500);
    background-color: rgba(var(--green-500-rgb), 0.05);
}

/* ========================================
   DRAWING PAGES STYLES (migrated from drawing.css)
   ======================================== */
.drawing-container {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin: var(--space-4) 0;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.drawing-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.drawing-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-4);
}

.drawing-description {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.specs-table th,
.specs-table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.specs-table th {
    background-color: var(--gray-50);
    font-weight: var(--font-semibold);
    color: var(--color-text);
}

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

@media (max-width: 768px) {
    .drawing-container {
        padding: var(--space-4);
        margin: var(--space-3) 0;
    }
    .drawing-title {
        font-size: var(--text-lg);
    }
    .specs-table {
        font-size: var(--text-sm);
    }
    .specs-table th,
    .specs-table td {
        padding: var(--space-2);
    }
}

/* ========================================
   FILTER COMPONENT STYLES (migrated from modern-filter.css)
   ======================================== */
.filter-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(30, 60, 114, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.filter-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(30, 60, 114, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 60, 114, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0.6;
}

.filter-header {
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    z-index: 2;
}

.filter-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    color: #1e3c72;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 0 0 15px rgba(30, 60, 114, 0.2);
}

.filter-subtitle {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

.filter-section {
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.filter-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

/* Filter Component Specific */
.filter-select {
    padding: 14px 16px;
    border: 2px solid rgba(30, 60, 114, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #374151;
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.filter-select:focus {
    border-color: #1e3c72;
    box-shadow: 0 0 0 4px rgba(30, 60, 114, 0.1);
    background: white;
}

.filter-select:hover {
    border-color: #2a5298;
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.1);
}

.range-section {
    margin-bottom: 24px;
}

.range-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

/* Range Input Specific */
.range-input {
    padding: 14px 16px;
    border: 2px solid rgba(30, 60, 114, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #374151;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.range-input:focus {
    border-color: #1e3c72;
    box-shadow: 0 0 0 4px rgba(30, 60, 114, 0.1);
    background: white;
}

.range-input:hover {
    border-color: #2a5298;
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.1);
}

.range-separator {
    color: #64748b;
    font-weight: 600;
    text-align: center;
}

.filter-buttons {
    display: grid;
    gap: 12px;
    margin-top: 32px;
    position: relative;
    z-index: 2;
}

/* Modern Button Specific */
.btn.btn-modern {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn.btn-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.btn.btn-modern:hover::before {
    left: 100%;
}

.btn-primary.btn-modern {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.25);
}

.btn-primary.btn-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(30, 60, 114, 0.35);
}

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

.btn-secondary.btn-modern {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.btn-secondary.btn-modern:hover {
    background: rgba(100, 116, 139, 0.15);
    transform: translateY(-1px);
    color: #1e3c72;
}

.gear-decoration {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(30, 60, 114, 0.2);
    border-radius: 50%;
    animation: rotate 20s linear infinite;
    z-index: 1;
}

.gear-decoration::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(30, 60, 114, 0.15);
    border-radius: 50%;
    border-style: dashed;
}

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

.tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(30, 60, 114, 0.1), rgba(42, 82, 152, 0.05));
    border: 1px solid rgba(30, 60, 114, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: #1e3c72;
    font-weight: 500;
    margin-top: 8px;
}

.filter-info {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(16, 185, 129, 0.02));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-top: 24px;
    position: relative;
    z-index: 2;
}

.filter-info h4 {
    color: #059669;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-info p {
    color: #374151;
    font-size: 0.85rem;
    line-height: 1.5;
}

@media (max-width: 992px) {
    .range-inputs {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .range-separator {
        display: none;
    }
}

.loading-animation {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn.btn-modern.loading .loading-animation {
    display: inline-block;
}

.btn.btn-modern.loading .btn-text {
    display: none;
}

/* ===== Legacy bridge block merged (2025-07-03) ===== */
.results-table{width:100%;border-collapse:collapse;font-size:.875rem}.results-table th{background:#f1f5f9;font-weight:500;text-align:left;padding:8px;border-bottom:1px solid #e2e8f0}.results-table td{padding:8px;border-bottom:1px solid #e2e8f0}.results-table tr:nth-child(even){background:#f8fafc}.pagination-top,.pagination-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:12px;margin-bottom:4px;font-size:.875rem}.pagination-info{color:#475569}.pagination-controls{display:flex;gap:6px}.pagination-controls .current-page{color:#1e3a8a;font-weight:500}.btn.btn-select{background:#1e40af;color:#fff;padding:4px 10px;border-radius:4px;text-decoration:none;font-size:.75rem}.btn.btn-disabled{background:#cbd5e1;color:#64748b;padding:4px 10px;border-radius:4px;font-size:.75rem}.pager,.pagination{display:flex;gap:6px;margin-top:12px}.pager a,.pagination a{border:1px solid #94a3b8;padding:4px 8px;border-radius:4px;color:#1e3a8a;text-decoration:none}.pager a.active,.pagination a.active{background:#1e3a8a;color:#fff}
  
/* ===== SmartFilters visual tweaks (disabled options) ===== */
.filter-select option:disabled,
.filter-select .option-unavailable {
  color: var(--gray-400);
  font-style: italic;
}

.pager,
.pagination {
    flex-wrap: wrap;      /* перенос ссылок на новую строку */
    max-width: 100%;      /* не шире контейнера */
    overflow-x: auto;     /* локальный скролл, если ссылок слишком много */
 }

/* === Configurator UI (2025 migration) === */
.steps-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.step-nav-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-colors);
}
.step-nav-btn:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-primary);
}
.step-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}
.option-card {
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-colors), transform 0.2s ease;
}
.option-card img {
    max-width: 100%;
    height: auto;
}
.option-card.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-fade, rgba(0,123,255,0.1));
}
.option-card:hover {
    transform: scale(0.98);
}
.option-label {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
}
.visualization-placeholder {
    text-align: center;
    color: var(--color-text-muted);
}
.visualization-placeholder .icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}
  
/* Configurator view legacy styles – migrated from inline <style> (2025-07-09) */
.configurator-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  margin: 2rem 0;
}
.config-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 2rem;
}
.config-visualization {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 2rem;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.config-step {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.config-step:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.step-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.step-number {
  background: var(--color-primary);
  color: white;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}
.config-options {
  display: grid;
  gap: 0.75rem;
}
.config-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: var(--transition-colors);
}
.config-option:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-primary);
}
.config-option.selected {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.config-option input[type="radio"] { margin: 0; }
.option-details { flex: 1; }
.option-name { font-weight: 500; margin-bottom: 0.25rem; }
.option-description { font-size: 0.875rem; opacity: 0.8; }
.config-summary {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-top: 2rem;
}
.summary-title { font-size: 1.125rem; font-weight: 600; color: var(--color-text); margin-bottom: 1rem; }
.summary-item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); }
.summary-item:last-child { border-bottom: none; }
.summary-label { font-weight: 500; }
.summary-value { color: var(--color-text-muted); }
.config-actions { display: flex; gap: 1rem; margin-top: 2rem; }
.visualization-placeholder { text-align: center; color: var(--color-text-muted); }
.visualization-placeholder .icon { font-size: 4rem; margin-bottom: 1rem; opacity: 0.5; }
@media (max-width: 1024px) {
  .configurator-container { grid-template-columns: 1fr; gap: 1rem; }
  .config-panel { position: static; }
}
.config-panel,
.config-visualization,
.config-option { transition: var(--transition-colors), transform 0.2s ease; }
.config-option:active { transform: scale(0.98); }
  
/* --- Configurator Steps Tabs ----------------------------------------- */
.steps-nav {
  display: flex;
  gap: var(--space-2);
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-3);
}
.step-nav-btn {
  background: none;
  border: none;
  padding: var(--space-2) var(--space-4);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  position: relative;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.step-nav-btn:hover {
  color: var(--color-primary);
}
.step-nav-btn.active {
  color: var(--color-primary);
}
.step-nav-btn.active::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 3px;
  background: var(--color-primary);
  border-radius: 3px 3px 0 0;
}
/* ---------------------------------------------------------------------- */

/* Tabs step-options visibility */
.step-options { display: none; }
.step-options.active { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); }
  