:root {
    --bg-page: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-elevated: #f8fafc;
    --bg-subtle: #f1f5f9;
    --bg-input: #ffffff;
    --text-primary: #1e293b;
    --text-heading: #002B49;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-default: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-input: #cbd5e1;
    --accent-blue: #1d4ed8;
    --accent-red: #E30613;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-page: #0B1220;
    --bg-surface: #131C31;
    --bg-elevated: #1B2640;
    --bg-subtle: #162038;
    --bg-input: #1B2640;
    --text-primary: #F1F5F9;
    --text-heading: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #94A3B8;
    --border-default: rgba(148, 163, 184, 0.18);
    --border-subtle: rgba(148, 163, 184, 0.12);
    --border-input: rgba(148, 163, 184, 0.28);
    --accent-blue: #60a5fa;
    --accent-red: #f87171;
}

html {
    scroll-behavior: smooth;
    font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    background-color: var(--bg-page);
    color: var(--text-primary);
}

body {
    font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    background-color: var(--bg-page);
    color: var(--text-primary);
    transition: background-color 0.22s ease, color 0.22s ease;
}

.role-tab.active {
    background-color: #002B49;
    color: #ffffff;
}

.role-tab:not(.active) {
    background-color: #f1f5f9;
    color: #475569;
}

.role-tab:not(.active):hover {
    background-color: #e2e8f0;
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО ВХОДА В ГАРАНТ (fade + scale + blur)
   ========================================== */

.garant-modal-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.garant-modal-backdrop.is-open {
    opacity: 1;
}

.garant-modal-panel {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
    transition: opacity 0.22s ease, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.garant-modal-backdrop.is-open .garant-modal-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ==========================================
   КАРТОЧКИ И КНОПКИ (спокойные микроанимации)
   ========================================== */

.interactive-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.interactive-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -8px rgba(0, 43, 73, 0.14);
    border-color: #60a5fa;
}

.interactive-btn {
    transition: transform 0.18s ease, box-shadow 0.22s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.interactive-btn:hover {
    box-shadow: 0 8px 20px -6px rgba(0, 43, 73, 0.22);
}

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

/* ==========================================
   HERO ДЕМОНСТРАЦИЯ «ИСКРЫ»
   ========================================== */

@keyframes heroGlowBreath {
    0%, 100% {
        opacity: 0.45;
        transform: scale(1);
    }
    50% {
        opacity: 0.72;
        transform: scale(1.03);
    }
}

.hero-demo-glow {
    animation: heroGlowBreath 6s ease-in-out infinite;
}

@keyframes statusPulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.hero-status-dot {
    animation: statusPulseRing 2.4s ease-out infinite;
}

#heroIskraDemoBody {
    transition: opacity 0.16s ease, transform 0.16s ease;
}

#heroIskraDemoBody.is-switching {
    opacity: 0;
    transform: translateY(5px);
}

/* Плавное появление контента при переключении разделов и вкладок */
@keyframes fadeInSoft {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in,
.hero-demo-fade,
.section-fade-in {
    animation: fadeInSoft 0.26s ease-out;
}

/* Прогресс-бар правого виджета «Сколько времени сэкономит ИСКРА 2.0?» */
.iskra-progress-bar {
    transition: width 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   ОФИЦИАЛЬНЫЙ ЗНАК «ИСКРЫ» (монохром в покое -> цветной при наведении)
   ========================================== */

.iskra-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: grayscale(100%);
    opacity: 0.85;
    transition: filter 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.iskra-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Белая круглая подложка для тёмного фона (верхнее меню и Hero-блок) */
.iskra-brand-icon--dark {
    background-color: #ffffff;
    border-radius: 9999px;
    padding: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    filter: grayscale(100%) contrast(1.1);
    opacity: 0.92;
}

.iskra-brand-icon:hover,
.iskra-hover-trigger:hover .iskra-brand-icon,
.iskra-hover-trigger:focus-within .iskra-brand-icon {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.06);
}

/* Красивый тонкий скроллбар для ленты новостей */
#primeNewsContainer::-webkit-scrollbar {
    width: 6px;
}
#primeNewsContainer::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}
#primeNewsContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}
#primeNewsContainer::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================
   ТЁМНАЯ ТЕМА ([data-theme="dark"]) — КОРПОРАТИВНАЯ СИНЕ-ГРАФИТОВАЯ ПАЛИТРА
   ========================================== */

[data-theme="dark"] body {
    background-color: var(--bg-page) !important;
    color: var(--text-primary) !important;
}

/* Основные поверхности и карточки */
[data-theme="dark"] .bg-white,
[data-theme="dark"] header,
[data-theme="dark"] #tools-section,
[data-theme="dark"] #heroIskraDemo,
[data-theme="dark"] #quickContactCard {
    background-color: var(--bg-surface) !important;
}

[data-theme="dark"] .bg-slate-50,
[data-theme="dark"] .bg-slate-100,
[data-theme="dark"] .hover\:bg-slate-50:hover,
[data-theme="dark"] .hover\:bg-slate-100:hover {
    background-color: var(--bg-elevated) !important;
}

[data-theme="dark"] .bg-slate-200\/70,
[data-theme="dark"] .hover\:bg-slate-200:hover {
    background-color: #233252 !important;
}

/* Логотип ГАРАНТ и нативная плашка «ООО фирма «Апрель»» в тёмной теме */
[data-theme="dark"] .garant-header-logo {
    filter: brightness(1.35) contrast(1.08) drop-shadow(0 0 8px rgba(255, 255, 255, 0.22));
}

[data-theme="dark"] .april-header-badge {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(148, 163, 184, 0.2) !important;
}

[data-theme="dark"] .april-header-badge:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(96, 165, 250, 0.4) !important;
}

[data-theme="dark"] .april-header-badge .april-title {
    color: #F1F5F9 !important;
}

[data-theme="dark"] .april-header-badge .april-sub,
[data-theme="dark"] .april-header-badge .april-year {
    color: #94A3B8 !important;
}

/* Кнопка переключения темы */
.theme-toggle-btn {
    background-color: var(--bg-elevated);
    color: var(--text-heading);
    border-color: var(--border-input);
}

.theme-toggle-btn:hover {
    border-color: var(--accent-blue);
}

/* Границы */
[data-theme="dark"] .border-slate-100,
[data-theme="dark"] .border-slate-200,
[data-theme="dark"] .border-slate-200\/70,
[data-theme="dark"] .border-slate-300,
[data-theme="dark"] .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--border-default) !important;
}

[data-theme="dark"] .border-blue-100,
[data-theme="dark"] .border-blue-200,
[data-theme="dark"] .border-blue-200\/70 {
    border-color: rgba(96, 165, 250, 0.28) !important;
}

[data-theme="dark"] .border-amber-200,
[data-theme="dark"] .border-amber-200\/60,
[data-theme="dark"] .border-amber-200\/70 {
    border-color: rgba(251, 191, 36, 0.3) !important;
}

[data-theme="dark"] .border-red-200 {
    border-color: rgba(248, 113, 113, 0.32) !important;
}

[data-theme="dark"] .border-emerald-200 {
    border-color: rgba(52, 211, 153, 0.3) !important;
}

/* Тональные блоки и плашки в тёмной теме */
[data-theme="dark"] .bg-blue-50,
[data-theme="dark"] .bg-blue-50\/60,
[data-theme="dark"] .bg-blue-50\/70,
[data-theme="dark"] .bg-blue-100 {
    background-color: rgba(37, 99, 235, 0.16) !important;
}

[data-theme="dark"] .bg-amber-50,
[data-theme="dark"] .bg-amber-50\/40,
[data-theme="dark"] .bg-amber-50\/60,
[data-theme="dark"] .bg-amber-50\/70,
[data-theme="dark"] .bg-amber-100 {
    background-color: rgba(245, 158, 11, 0.14) !important;
}

[data-theme="dark"] .bg-red-50,
[data-theme="dark"] .bg-red-50\/50 {
    background-color: rgba(227, 6, 19, 0.14) !important;
}

[data-theme="dark"] .bg-emerald-50,
[data-theme="dark"] .bg-emerald-50\/70,
[data-theme="dark"] .bg-emerald-100 {
    background-color: rgba(16, 185, 129, 0.16) !important;
}

[data-theme="dark"] .bg-purple-100 {
    background-color: rgba(147, 51, 234, 0.22) !important;
}

[data-theme="dark"] .from-slate-50.to-amber-50\/70,
[data-theme="dark"] .from-amber-500\/10,
[data-theme="dark"] .from-slate-100.to-blue-50\/70 {
    background-image: linear-gradient(135deg, rgba(27, 38, 64, 0.96), rgba(30, 58, 95, 0.65)) !important;
}

/* Текстовые цвета */
[data-theme="dark"] .text-\[\#002B49\],
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .text-slate-800 {
    color: var(--text-heading) !important;
}

[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-slate-600 {
    color: #CBD5E1 !important;
}

[data-theme="dark"] .text-slate-500,
[data-theme="dark"] .text-slate-400 {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-blue-700,
[data-theme="dark"] .text-blue-800,
[data-theme="dark"] .text-blue-900 {
    color: #93C5FD !important;
}

[data-theme="dark"] .text-amber-900,
[data-theme="dark"] .text-amber-800,
[data-theme="dark"] .text-amber-700 {
    color: #FCD34D !important;
}

[data-theme="dark"] .text-emerald-800,
[data-theme="dark"] .text-emerald-700 {
    color: #6EE7B7 !important;
}

[data-theme="dark"] .text-purple-900,
[data-theme="dark"] .text-purple-700 {
    color: #D8B4FE !important;
}

[data-theme="dark"] .text-red-700,
[data-theme="dark"] .text-red-600 {
    color: #FCA5A5 !important;
}

/* Сохраняем контраст на белых кнопках поверх тёмных баннеров (карточка партнёра и ВОС) */
[data-theme="dark"] .keep-light-btn {
    background-color: #ffffff !important;
    color: #002B49 !important;
}

[data-theme="dark"] .keep-light-btn:hover {
    background-color: #f1f5f9 !important;
}

/* Поля ввода, текстовые области и выпадающие списки */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-input) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #94A3B8 !important;
}

/* Вкладки ролей и карточек */
[data-theme="dark"] .role-tab:not(.active) {
    background-color: var(--bg-elevated);
    color: #CBD5E1;
    border-color: var(--border-default);
}

[data-theme="dark"] .role-tab:not(.active):hover {
    background-color: #233252;
    color: #ffffff;
}

[data-theme="dark"] .role-tab.active,
[data-theme="dark"] .bg-\[\#002B49\] {
    background-color: #0E3A63 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .bg-red-600,
[data-theme="dark"] .bg-\[\#E30613\] {
    background-color: #DC2626 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .bg-red-600:hover,
[data-theme="dark"] .bg-\[\#E30613\]:hover {
    background-color: #B91C1C !important;
}

/* Интерактивные карточки и знак Искры в тёмной теме */
[data-theme="dark"] .interactive-card:hover {
    box-shadow: 0 14px 32px -8px rgba(0, 0, 0, 0.55);
    border-color: rgba(96, 165, 250, 0.55) !important;
}

[data-theme="dark"] .iskra-brand-icon {
    background-color: rgba(255, 255, 255, 0.94);
    border-radius: 9999px;
    padding: 3px;
    filter: grayscale(100%) contrast(1.1);
    opacity: 0.92;
}

[data-theme="dark"] .iskra-brand-icon:hover,
[data-theme="dark"] .iskra-hover-trigger:hover .iskra-brand-icon,
[data-theme="dark"] .iskra-hover-trigger:focus-within .iskra-brand-icon {
    filter: grayscale(0%);
    opacity: 1;
}

/* Скроллбар в тёмной теме */
[data-theme="dark"] #primeNewsContainer::-webkit-scrollbar-track {
    background: #0B1220;
}

[data-theme="dark"] #primeNewsContainer::-webkit-scrollbar-thumb {
    background: #334155;
}

[data-theme="dark"] #primeNewsContainer::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ==========================================
   ДОСТУПНОСТЬ: УВАЖАЕМ PREFERS-REDUCED-MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .interactive-card:hover,
    .interactive-btn:active,
    .garant-modal-panel,
    .iskra-brand-icon:hover,
    .iskra-hover-trigger:hover .iskra-brand-icon {
        transform: none !important;
    }
}
