/* Modern SaaS Design System */
:root {
    --bg-gradient-start: #0b0f19;
    --bg-gradient-end: #111827;
    --glass-bg: rgba(20, 22, 31, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover-border: rgba(59, 130, 246, 0.4);
    --glass-blur: 16px;

    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b;
    --danger: #ef4444;
    --accent: #8b5cf6;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace;
}

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

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    font-family: var(--font-main);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE ROOT SCALE
   ============================================ */
html {
    font-size: 16px;
}

@media (max-width: 1920px) and (max-height: 1200px) and (min-width: 768px) {
    html { font-size: 12px; }
}

@media (max-width: 1400px) and (max-height: 900px) and (min-width: 768px) {
    html { font-size: 11px; }
}

@media (max-width: 1200px) and (max-height: 800px) and (min-width: 768px) {
    html { font-size: 10px; }
}

@media (max-width: 767.98px) {
    html { font-size: 14px; }
}

/* ============================================
   GLASSMORPHISM CARDS
   ============================================ */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    transition: all 0.25s ease;
}

.glass-card:hover {
    border-color: var(--glass-hover-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px var(--primary-glow);
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar-glass {
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ============================================
   BADGES
   ============================================ */
.badge-version {
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.badge-pro {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #fcd34d 100%);
    color: #000000;
    border: 1px solid rgba(251, 191, 36, 0.6);
    font-weight: 700;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

a.badge-pro:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    padding: 1.25rem;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a0aec0;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.stat-label i {
    font-size: 0.85rem;
    color: var(--primary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: var(--font-mono);
}

.stat-value .unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   SEARCH SECTION
   ============================================ */
.search-input {
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1.25rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(0, 0, 0, 0.6);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.btn-search {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary) 100%);
    border: none;
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-search:hover {
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-1px);
}

/* Кнопка очистки поля */
.search-clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 0.8rem;
}

.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #f1f5f9;
    transform: translateY(-50%) scale(1.05);
}

.search-clear-btn.visible {
    opacity: 1;
}

.position-relative {
    position: relative;
}

/* ============================================
   EXTENDED FIELDS CONTROLS
   ============================================ */
.toggle-extended {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.toggle-extended:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
}

.toggle-extended.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-clear-all {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-clear-all:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

/* ============================================
   EXTENDED FIELDS GRID
   ============================================ */
.extended-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.field-input-group {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.field-input-group:hover {
    background: rgba(0, 0, 0, 0.3);
}

.field-input-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--glass-border);
}

.field-name {
    font-size: 0.75rem;
}

.field-badges {
    display: inline-flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.field-badge {
    font-size: 0.55rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 500;
    cursor: help;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.badge-exact {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-stem {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-fuzzy {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-ngram {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-phrase {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.field-badge:hover {
    transform: translateY(-1px);
}

.field-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.field-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.field-input::placeholder {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================================
   SEARCH STATS BAR
   ============================================ */
.search-stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.search-stats-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.search-stats-main span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.search-stats-main i {
    color: var(--primary);
    font-size: 1rem;
}

.search-stats-filters {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-score-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem;
    padding: 0.125rem 0.5rem;
}

.filter-score-input {
    width: 3.5rem;
    padding: 0.25rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: center;
    font-family: var(--font-mono);
}

.filter-score-input:focus {
    outline: none;
}

.filter-score-input::placeholder {
    color: var(--text-muted);
}

.filter-score-clear {
    padding: 0 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
}

.filter-score-clear:hover {
    color: var(--danger);
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-reset-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 0.625rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.filter-reset-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   RESULTS
   ============================================ */
.result-item {
    background: rgba(20, 22, 31, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.result-item:hover {
    border-color: var(--glass-hover-border);
    background: rgba(26, 29, 42, 0.7);
}

.result-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.result-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
}

/* Score Visualization */
.score-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 160px;
}

.score-bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 50%, var(--success) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.score-badge {
    min-width: 3.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
}

.score-exact {
    color: var(--success);
}

.score-high {
    color: var(--success);
}

.score-medium {
    color: var(--warning);
}

.score-low {
    color: var(--danger);
}

/* Result Badges Row */
.result-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
}

.badge-id {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    cursor: pointer;
}

.badge-id:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.02);
}

.badge-code {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-barcode {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-art {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-extended {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Match Type Row */
.result-match-row {
    display: flex;
    justify-content: flex-end;
}

.result-match-badge {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 9999px;
}

/* Highlighting */
.highlight-exact {
    background: var(--success-glow);
    color: var(--success);
    font-weight: 700;
    padding: 0 0.25rem;
    border-radius: 3px;
}

/* ============================================
   API REFERENCE
   ============================================ */
.api-row {
    display: flex;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.api-row:last-child {
    border-bottom: none;
}

.method-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
    min-width: 3.5rem;
    text-align: center;
}

.method-post {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.method-get {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.method-delete {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.api-path {
    flex: 1;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.api-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.btn-copy {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--primary);
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* ============================================
   LEGEND
   ============================================ */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    70% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .stat-value {
        font-size: 1.25rem;
    }

    .extended-fields-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .score-container {
        min-width: auto;
        width: 100%;
    }

    .search-row {
        flex-direction: column;
    }

    .btn-search {
        width: 100%;
        justify-content: center;
    }

    .result-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-badges-row {
        max-height: none;
    }

    .api-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   RESULT FIELDS GRID - КАК В ДОПОЛНИТЕЛЬНЫХ ПОЛЯХ
   ============================================ */
.result-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.result-field-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}

.result-field-badge:hover {
    background: rgba(0, 0, 0, 0.35);
}

.result-field-badge .field-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.result-field-badge .field-label i {
    font-size: 0.7rem;
    color: var(--primary);
}

.result-field-badge .field-value {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
    flex: 1;
}

/* Типы совпадений */
.match-type {
    font-size: 0.55rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 500;
    white-space: nowrap;
}

.match-exact {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.match-ngram {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.match-fuzzy {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.match-phrase {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.match-dynamic {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.match-default {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Обязательные поля — простые чипсы (как было) */
.required-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.required-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-mono);
}

.chip-id {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    cursor: pointer;
}

.chip-id:hover {
    background: rgba(59, 130, 246, 0.3);
}

.chip-code {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.chip-barcode {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.chip-art {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Pagination styles — дополнение к твоему дизайну */
.pagination-wrapper {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.custom-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.page-btn:hover:not(.active-page):not(:disabled) {
    background: rgba(13, 110, 253, 0.2);
    border-color: #0d6efd;
    color: white;
}

.page-btn.active-page {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.4);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    color: #aaa;
    font-size: 0.8rem;
}

/* Free Edition Badge */
.badge-free {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    color: white;
    border: 1px solid rgba(96, 165, 250, 0.6);
    font-weight: 700;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

a.badge-free:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Pro Upsell Block */
.pro-features-box {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.pro-features-box:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.08);
}

.pro-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.pro-feature-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.pro-feature-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.25);
    transform: translateY(-2px);
}

.pro-feature-item .feature-icon {
    font-size: 1.25rem;
    color: var(--primary);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    border-radius: 0.5rem;
}

.pro-feature-item span {
    line-height: 1.3;
}

.pro-cta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.pro-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Точная подсветка совпавших токенов */
mark.search-match {
    background: rgba(255, 215, 0, 0.25);
    color: inherit;
    padding: 2px 4px;
    border-radius: 4px;
    border-bottom: 2px solid #ffc107;
    font-weight: 600;
}

/* Бейджи совпавших токенов */
.matched-tokens .badge {
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

/* Critical error banner */
#critical-error-banner {
    position: fixed;
    top: 70px;
    left: 20px;
    right: 20px;
    z-index: 2000;
    background: rgba(220, 53, 69, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Retry buttons in fallback UI */
.kpi-fallback {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
}

.kpi-fallback i {
    font-size: 2rem;
    opacity: 0.5;
}

/* Loading skeleton для KPI */
.skeleton-card {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
    height: 80px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ============================================
   СТРАТЕГИИ И АКТИВНЫЕ ФИЛЬТРЫ
   ============================================ */

/* Группа опций поиска */
.search-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-top: 0.5rem;
}

.option-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.5rem;
}

/* Активные фильтры */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--glass-border);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.filter-badge i {
    font-size: 0.65rem;
}

.filter-badge .badge-clear {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.filter-badge .badge-clear:hover {
    opacity: 1;
    color: var(--danger);
}

/* Переключатели режима */
.mode-switch-group {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem;
    padding: 0.125rem;
}

.mode-switch-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 0.625rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0;
}

.mode-switch-btn i {
    font-size: 0.8rem;
}

.mode-switch-btn:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.15);
}

.btn-check:checked + .mode-switch-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Переключатели стратегий */
.strategy-switch-group {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.75rem;
    padding: 0.125rem;
}

.strategy-switch-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 0.625rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.strategy-switch-btn i {
    font-size: 0.8rem;
}

.strategy-switch-btn:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.15);
}

.strategy-switch-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Бейдж стратегии в результатах */
.strategy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.strategy-auto {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.strategy-fs_only {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.strategy-hybrid {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.strategy-parallel {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.strategy-embedding_only {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .search-options-group {
        flex-direction: column;
        align-items: stretch;
    }

    .option-divider {
        display: none;
    }

    .strategy-switch-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .strategy-switch-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .search-stats-bar {
        flex-wrap: wrap;
    }

    .search-stats-filters {
        justify-content: flex-start;
        width: 100%;
    }
}

/* Индикатор стратегии в статистике */
#strategy-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--primary);
}

/* Unified pill buttons */
.btn-pill {
    border-radius: 0.625rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* Unified nav buttons */
.btn-nav {
    border-radius: 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
}

.btn-nav i {
    font-size: 0.8rem;
}

/* ============================================
   HIERARCHY TREE (Reddit-style)
   ============================================ */
.mode-options-container {
    display: grid;
    align-items: start;
}

.mode-options-container > .mode-options-group {
    grid-area: 1 / 1;
}

.mode-options-group {
    display: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.375rem 0.625rem;
}

.hierarchy-tree-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}

.hierarchy-tree {
    display: inline-block;
    min-width: 100%;
    width: max-content;
    padding: 0.5rem;
}

.hierarchy-node {
    position: relative;
}

.hierarchy-node-content {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    padding: 0.25rem 0;
}

.hierarchy-toggle,
.hierarchy-toggle-spacer {
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.35rem;
}

.hierarchy-toggle {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    line-height: 1;
    border: none;
    background: transparent;
    cursor: pointer;
}

.hierarchy-toggle:hover {
    color: var(--primary);
}

.hierarchy-node-body {
    flex: 1 1 auto;
    min-width: 280px;
    cursor: pointer;
}

.hierarchy-node-body.hierarchy-node--active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(59, 130, 246, 0.12);
}

.hierarchy-children {
    position: relative;
    margin-left: 0.375rem;
    padding-left: 0.375rem;
    border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.hierarchy-children:empty {
    display: none;
}

.hierarchy-node .result-title {
    word-break: break-word;
}

@media (max-width: 768px) {
    .hierarchy-node-body {
        min-width: 240px;
    }
}

/* ============================================
   COMPACT LANDSCAPE DESKTOPS
   ============================================ */
@media (max-height: 800px) and (orientation: landscape) {
    .navbar-glass.py-3 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .navbar-glass.mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .btn-nav {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        gap: 0.25rem;
    }

    .btn-nav i {
        font-size: 0.7rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .glass-card.p-4 {
        padding: 0.75rem !important;
    }

    .search-input {
        padding: 0.5rem 2rem 0.5rem 0.75rem;
    }

    .btn-search {
        padding: 0.5rem 1rem;
    }

    .search-options-group {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .result-item {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
    }

    .footer {
        padding: 0.75rem 0;
        margin-top: 1.5rem;
    }
}