/* ============================================
   CSS-ПЕРЕМЕННЫЕ ТЕМ
   Подключается ПЕРВЫМ на всех страницах
   ============================================ */

/* === СВЕТЛАЯ ТЕМА (по умолчанию) === */
:root {
	--bg-page: #ffffff;
	--bg-card: #ffffff;
	--bg-card-rgb: 255, 255, 255; /* Для blur-эффекта */
	--border-color: #e5e7eb;
	--border-color-rgb: 229, 231, 235; /* Для blur-эффекта */
	--border-focus: #9ca3af;
	--text-primary: #111827;
	--text-secondary: #6b7280;
	--btn-primary: #111827;
	--btn-primary-hover: #374151;
	--btn-secondary: #ffffff;
	--btn-secondary-border: #d1d5db;
	--btn-secondary-hover: #f9fafb;
	--btn-ok-text: #ffffff;
	--primary-color: #3b82f6;
	--primary-color: #3b82f6;
	--error-color: #dc2626;
	--success-color: #166534;
	--success-bg: #f0fdf4;
	--error-bg: #fef2f2;
	--user-context-bg: #f9fafb;
	--input-placeholder: #9ca3af;
	--hover-bg: #f3f4f6;
	--canvas-text-color: 100, 116, 139;
	--autofill-bg: #ffffff;
	--idle-sky-top: #c8d8ee;
	--idle-sky-mid: #a0c0d8;
	--idle-haze: rgba(180, 200, 160, 0.35);
	--idle-sun: #fff9c4;
	--idle-star: #fff8d0;
	--idle-ground-far: #6a9040;
	--idle-grass: #5c8a3a;
	--idle-path: #b8986a;
	--idle-path-rut: #9a7848;
	--idle-mote: rgba(255, 248, 180, 0.7);
	--idle-stone: #9a8060;
	--idle-leaf: #8a5a20;
	--idle-puddle: rgba(100, 140, 180, 0.25);
	--idle-twig: #6a5030;
	--idle-track: rgba(0, 0, 0, 0.12);
	--idle-far-dark: #2a4820;
	--idle-far-mid: #3a6030;
	--idle-mid-dark: #224018;
	--idle-mid-mid: #2c5020;
	--idle-near-dark: #1a3010;
	--idle-near-mid: #224018;
	--idle-trunk: #5a3a18;
	--idle-birch: #ddd4c0;
	--idle-shirt: #e8f0f8;
	--idle-skin: #f0c8a0;
	--idle-cat: #3a3020;
	--idle-cat-stripe: #1a1008;
	--idle-lapel: #c8d8e8;
	--idle-hair: #3a2510;
	--idle-bird: #2a2010;
	--idle-pink: #c08080;
}

/* === ТЁМНАЯ ТЕМА === */
[data-theme="dark"] {
	--bg-page: #0f0f10;
	--bg-card: #1a1a1c;
	--bg-card-rgb: 26, 26, 28; /* Для blur-эффекта */
	--border-color: #2d2d30;
	--border-color-rgb: 45, 45, 48; /* Для blur-эффекта */
	--border-focus: #52525b;
	--text-primary: #f3f4f6;
	--text-secondary: #a1a1aa;
	--btn-primary: #e4e4e7;
	--btn-primary-hover: #d4d4d8;
	--btn-secondary: #1a1a1c;
	--btn-secondary-border: #3f3f46;
	--btn-secondary-hover: #27272a;
	--error-color: #f87171;
	--success-color: #4ade80;
	--success-bg: rgba(74, 222, 128, 0.1);
	--error-bg: rgba(248, 113, 113, 0.1);
	--user-context-bg: #27272a;
	--input-placeholder: #71717a;
	--hover-bg: #27272a;
	--canvas-text-color: 161, 161, 170;
	--autofill-bg: #1a1a1c;
	--idle-sky-top: #080818;
	--idle-sky-mid: #0e0e28;
	--idle-haze: rgba(20, 30, 20, 0.55);
	--idle-sun: rgba(80, 80, 140, 0.4);
	--idle-star: #c0c0ff;
	--idle-ground-far: #1a2e10;
	--idle-grass: #1e3a14;
	--idle-path: #2a2018;
	--idle-path-rut: #1a1410;
	--idle-mote: rgba(100, 120, 160, 0.45);
	--idle-stone: #3a3020;
	--idle-leaf: #2a2010;
	--idle-puddle: rgba(40, 60, 80, 0.3);
	--idle-twig: #2a2010;
	--idle-track: rgba(255, 255, 255, 0.08);
	--idle-far-dark: #0a120a;
	--idle-far-mid: #101808;
	--idle-mid-dark: #080e06;
	--idle-mid-mid: #0c1408;
	--idle-near-dark: #060c04;
	--idle-near-mid: #080e06;
	--idle-trunk: #1a1008;
	--idle-birch: #2a2018;
	--idle-shirt: #1a1e28;
	--idle-skin: #c0a888;
	--idle-cat: #2a2018;
	--idle-cat-stripe: #101008;
	--idle-lapel: #2a3040;
	--idle-hair: #5a4030;
	--idle-bird: #3a3a5a;
	--idle-pink: #604040;
}

/* ============================================
   БАЗОВЫЕ ПЕРЕОПРЕДЕЛЕНИЯ ДЛЯ ТЁМНОЙ ТЕМЫ
   (Применяются ко всем страницам)
   ============================================ */

/* Кнопка "Далее" в тёмной теме — тёмный текст */
[data-theme="dark"] .btn-primary {
	color: #18181b !important;
}

[data-theme="dark"] .btn-primary:hover:not(:disabled) {
	color: #09090b !important;
}

/* Кнопка OK в column filter popup — тёмная тема */
[data-theme="dark"] .col-filter-btn-ok {
	color: #18181b !important;
}

/* Кнопка OK в column filter popup — тема Закат */
[data-theme="sunset"] .col-filter-btn-ok {
	color: #ffffff !important;
}

/* Кнопка OK в column filter popup — тема Восход */
[data-theme="sunrise"] .col-filter-btn-ok {
	color: #ffffff !important;
}

/* Активная кнопка фильтра в тёмной теме */
[data-theme="dark"] .th-filter-btn.active {
	color: var(--btn-primary) !important;
}

/* Автозаполнение в тёмной теме */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px var(--autofill-bg) inset !important;
	-webkit-text-fill-color: var(--text-primary) !important;
}

/* Сброс иконок полей ввода в тёмной теме */
[data-theme="dark"] .input-field .user-icon,
[data-theme="dark"] .input-field .pwd-icon {
	filter: invert(1);
}

[data-theme="dark"] .reset-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%2352525b'/%3E%3Cpath d='M13.5 6.5l-7 7M6.5 6.5l7 7' stroke='%23fff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* === ТЕМА "ЗАКАТ" (Бежевая) === */
[data-theme="sunset"] {
	--bg-page: #f5e6d3;
	--bg-card: #fffbf5;
	--bg-card-rgb: 255, 251, 245; /* Для blur-эффекта */
	--border-color: #d4a574;
	--border-color-rgb: 212, 165, 116; /* Для blur-эффекта */
	--border-focus: #c9875a;
	--text-primary: #5c4033;
	--text-secondary: #8b7355;
	--btn-primary: #e67e5a;
	--btn-primary-hover: #d4654a;
	--btn-secondary: #fffbf5;
	--btn-secondary-border: #d4a574;
	--btn-secondary-hover: #faebd7;
	--error-color: #c44536;
	--success-color: #6b8e5a;
	--success-bg: rgba(107, 142, 90, 0.15);
	--error-bg: rgba(196, 69, 54, 0.15);
	--user-context-bg: #faebd7;
	--input-placeholder: #a89070;
	--hover-bg: #faebd7;
	--canvas-text-color: 139, 115, 85;
	--autofill-bg: #fffbf5;
	--idle-sky-top: #f0c898;
	--idle-sky-mid: #e09050;
	--idle-haze: rgba(200, 140, 80, 0.45);
	--idle-sun: #ffcc60;
	--idle-star: #ffe0a0;
	--idle-ground-far: #a06828;
	--idle-grass: #806020;
	--idle-path: #c09868;
	--idle-path-rut: #9a7848;
	--idle-mote: rgba(255, 200, 120, 0.6);
	--idle-stone: #8a6830;
	--idle-leaf: #7a4020;
	--idle-puddle: rgba(160, 100, 60, 0.2);
	--idle-twig: #6a4820;
	--idle-track: rgba(0, 0, 0, 0.12);
	--idle-far-dark: #3a2010;
	--idle-far-mid: #4a2c14;
	--idle-mid-dark: #2a1808;
	--idle-mid-mid: #341e0c;
	--idle-near-dark: #1e1006;
	--idle-near-mid: #281408;
	--idle-trunk: #5a3010;
	--idle-birch: #c8a880;
	--idle-shirt: #f0e8d8;
	--idle-skin: #f0c8a0;
	--idle-cat: #5a3020;
	--idle-cat-stripe: #2a1008;
	--idle-lapel: #e8d8c8;
	--idle-hair: #5a3010;
	--idle-bird: #5a3010;
	--idle-pink: #c07070;
}

/* Кнопка в теме "Закат" — белый текст */
[data-theme="sunset"] .btn-primary {
	color: #ffffff !important;
}

[data-theme="sunset"] .btn-primary:hover:not(:disabled) {
	color: #ffffff !important;
}

/* Автозаполнение в теме "Закат" */
[data-theme="sunset"] input:-webkit-autofill,
[data-theme="sunset"] input:-webkit-autofill:hover,
[data-theme="sunset"] input:-webkit-autofill:focus,
[data-theme="sunset"] input:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px var(--autofill-bg) inset !important;
	-webkit-text-fill-color: var(--text-primary) !important;
}

/* Иконки в теме "Закат" — тёмно-коричневые */
[data-theme="sunset"] .input-field .user-icon,
[data-theme="sunset"] .input-field .pwd-icon {
	filter: none;
}

[data-theme="sunset"] .reset-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%23d4a574'/%3E%3Cpath d='M13.5 6.5l-7 7M6.5 6.5l7 7' stroke='%23fff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Сообщения в теме "Закат" */
[data-theme="sunset"] .status-message {
	border-color: rgba(196, 69, 54, 0.3);
}

[data-theme="sunset"] .status-message.success {
	border-color: rgba(107, 142, 90, 0.3);
}

/* === ТЕМА "ВОСХОД" (Утренняя) === */
[data-theme="sunrise"] {
	--bg-page: #f0e6f0;
	--bg-card: #fafbff;
	--bg-card-rgb: 250, 251, 255; /* Для blur-эффекта */
	--border-color: #b8a9d9;
	--border-color-rgb: 184, 169, 217; /* Для blur-эффекта */
	--border-focus: #9d8bc4;
	--text-primary: #3d3654;
	--text-secondary: #7a7290;
	--btn-primary: #8b7bb5;
	--btn-primary-hover: #7a6aa8;
	--btn-secondary: #fafbff;
	--btn-secondary-border: #b8a9d9;
	--btn-secondary-hover: #ede4f5;
	--error-color: #c44569;
	--success-color: #6a8e7f;
	--success-bg: rgba(106, 142, 127, 0.15);
	--error-bg: rgba(196, 69, 105, 0.15);
	--user-context-bg: #ede4f5;
	--input-placeholder: #a89bc0;
	--hover-bg: #ede4f5;
	--canvas-text-color: 122, 114, 144;
	--autofill-bg: #fafbff;
	--idle-sky-top: #e8d8f0;
	--idle-sky-mid: #c8b0e0;
	--idle-haze: rgba(180, 150, 200, 0.4);
	--idle-sun: #e8c8ff;
	--idle-star: #e0c0ff;
	--idle-ground-far: #7060a0;
	--idle-grass: #6050a0;
	--idle-path: #b0a0c8;
	--idle-path-rut: #9080a8;
	--idle-mote: rgba(220, 200, 255, 0.6);
	--idle-stone: #6050a0;
	--idle-leaf: #5040a0;
	--idle-puddle: rgba(120, 100, 180, 0.25);
	--idle-twig: #4030a0;
	--idle-track: rgba(0, 0, 0, 0.1);
	--idle-far-dark: #281838;
	--idle-far-mid: #302048;
	--idle-mid-dark: #1e1028;
	--idle-mid-mid: #241830;
	--idle-near-dark: #180e20;
	--idle-near-mid: #1e1428;
	--idle-trunk: #3a2040;
	--idle-birch: #c0a8d0;
	--idle-shirt: #f0e8f8;
	--idle-skin: #f0c8a0;
	--idle-cat: #3a2050;
	--idle-cat-stripe: #1a0830;
	--idle-lapel: #d8c8e8;
	--idle-hair: #3a2050;
	--idle-bird: #3a2050;
	--idle-pink: #c07898;
}

/* Кнопка в теме "Восход" — белый текст */
[data-theme="sunrise"] .btn-primary {
	color: #ffffff !important;
}

[data-theme="sunrise"] .btn-primary:hover:not(:disabled) {
	color: #ffffff !important;
}

/* Автозаполнение в теме "Восход" */
[data-theme="sunrise"] input:-webkit-autofill,
[data-theme="sunrise"] input:-webkit-autofill:hover,
[data-theme="sunrise"] input:-webkit-autofill:focus,
[data-theme="sunrise"] input:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px var(--autofill-bg) inset !important;
	-webkit-text-fill-color: var(--text-primary) !important;
}

/* Иконки в теме "Восход" — не инвертируем */
[data-theme="sunrise"] .input-field .user-icon,
[data-theme="sunrise"] .input-field .pwd-icon {
	filter: none;
}

[data-theme="sunrise"] .reset-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='10' fill='%23b8a9d9'/%3E%3Cpath d='M13.5 6.5l-7 7M6.5 6.5l7 7' stroke='%23fff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Сообщения в теме "Восход" */
[data-theme="sunrise"] .status-message {
	border-color: rgba(196, 69, 105, 0.3);
}

[data-theme="sunrise"] .status-message.success {
	border-color: rgba(106, 142, 127, 0.3);
}
