/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */

html[data-theme="light"] {
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-hover-border: rgba(59, 130, 246, 0.45);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
}

html[data-theme="light"] body {
    color: var(--text-primary);
}

html[data-theme="light"] .navbar-glass {
    background: rgba(255, 255, 255, 0.82);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .navbar-brand {
    color: #0f172a !important;
}

html[data-theme="light"] .text-white {
    color: #0f172a !important;
}

html[data-theme="light"] .text-secondary {
    color: #475569 !important;
}

html[data-theme="light"] .glass-card {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .glass-card:hover {
    border-color: var(--glass-hover-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 20px var(--primary-glow);
}

html[data-theme="light"] .stat-label {
    color: var(--text-secondary);
}

html[data-theme="light"] .stat-value {
    color: var(--text-primary);
}

html[data-theme="light"] .search-input {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

html[data-theme="light"] .search-input::placeholder {
    color: #94a3b8;
}

html[data-theme="light"] .search-input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

html[data-theme="light"] .form-control:focus,
html[data-theme="light"] .form-select:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

html[data-theme="light"] .btn-outline-secondary {
    color: #475569;
    border-color: rgba(0, 0, 0, 0.18);
}

html[data-theme="light"] .btn-outline-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.25);
    color: #0f172a;
}

html[data-theme="light"] .btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

html[data-theme="light"] .btn-outline-primary:hover {
    background: var(--primary);
    color: #ffffff;
}

html[data-theme="light"] .footer {
    border-top-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .pro-features-box {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.18);
}

html[data-theme="light"] .pro-feature-item {
    color: #334155;
}

html[data-theme="light"] .result-item {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .hierarchy-node-body.hierarchy-node--active {
    background: rgba(59, 130, 246, 0.18);
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

html[data-theme="light"] .mode-options-group {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .result-item .badge.bg-dark,
html[data-theme="light"] .hierarchy-node-body .badge.bg-dark {
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .match-highlight {
    color: #0f172a;
    background: rgba(245, 158, 11, 0.25);
}

html[data-theme="light"] .search-stats-bar {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .suggestion-item {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .suggestion-item:hover,
html[data-theme="light"] .suggestion-item.active {
    background: rgba(59, 130, 246, 0.1);
}

/* PRO-specific elements */
html[data-theme="light"] .search-options-group {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .option-divider {
    background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .mode-switch-group,
html[data-theme="light"] .strategy-switch-group {
    background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .mode-switch-btn,
html[data-theme="light"] .strategy-switch-btn {
    color: var(--text-primary);
}

html[data-theme="light"] .mode-switch-btn:hover,
html[data-theme="light"] .strategy-switch-btn:hover {
    background: rgba(59, 130, 246, 0.12);
}

html[data-theme="light"] .filter-badge {
    background: rgba(255, 255, 255, 0.8);
    color: #475569;
    border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .filter-badge i {
    color: #64748b;
}

html[data-theme="light"] .active-filters {
    border-top-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .filter-score-wrapper {
    background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .filter-score-input {
    color: var(--text-primary);
}

html[data-theme="light"] .filter-score-clear {
    color: var(--text-secondary);
}

html[data-theme="light"] .filter-score-clear:hover {
    color: var(--danger);
}

/* Дополнительные поля в светлой теме */
html[data-theme="light"] .field-input-group {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .field-input-group:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(59, 130, 246, 0.3);
}

html[data-theme="light"] .field-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

html[data-theme="light"] .field-input::placeholder {
    color: var(--text-muted);
}

html[data-theme="light"] .toggle-extended {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--primary);
}

html[data-theme="light"] .toggle-extended.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

html[data-theme="light"] .form-select,
html[data-theme="light"] #search-limit {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.15);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px 12px;
}

html[data-theme="light"] .filter-reset-btn {
    color: var(--text-secondary);
    border-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .filter-reset-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

html[data-theme="light"] .match-details {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .score-bar-bg {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .score-badge {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

html[data-theme="light"] .score-bar-fill {
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Match badges and chips */
html[data-theme="light"] .result-match-badge {
    color: #475569;
}

html[data-theme="light"] .match-exact {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
}

html[data-theme="light"] .match-ngram {
    color: #6d28d9;
    background: rgba(139, 92, 246, 0.12);
}

html[data-theme="light"] .match-fuzzy {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
}

html[data-theme="light"] .match-phrase {
    color: #be185d;
    background: rgba(236, 72, 153, 0.12);
}

html[data-theme="light"] .match-dynamic {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.12);
}

html[data-theme="light"] .match-default {
    color: #374151;
    background: rgba(107, 114, 128, 0.12);
}

html[data-theme="light"] .chip-id {
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.12);
}

html[data-theme="light"] .chip-code {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
}

html[data-theme="light"] .chip-barcode {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
}

html[data-theme="light"] .chip-art {
    color: #6d28d9;
    background: rgba(139, 92, 246, 0.12);
}

/* Admin-specific elements */
html[data-theme="light"] .metric-card {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .metric-label {
    color: #475569;
}

html[data-theme="light"] .metric-value {
    color: #0f172a;
}

html[data-theme="light"] .log-entry {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .action-group {
    background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .action-group-title {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .glass-table th {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .glass-table td {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .glass-table tr:hover td {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .status-badge {
    background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
}

html[data-theme="light"] .toast-glass {
    color: var(--text-primary);
}

html[data-theme="light"] .glass-card h6 {
    color: var(--text-primary) !important;
}

html[data-theme="light"] .small.text-secondary,
html[data-theme="light"] #synonyms-body .text-muted,
html[data-theme="light"] #feedback-suggestions .text-secondary,
html[data-theme="light"] .text-center.text-muted.py-3,
html[data-theme="light"] .text-center.text-muted.py-4 {
    color: var(--text-secondary) !important;
}

/* Toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.05);
}

html[data-theme="light"] .theme-toggle {
    color: #475569;
    border-color: rgba(0, 0, 0, 0.18);
}

html[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}
