/* ==============================================
   IOIT Project Management - Dark Theme Fix v2
   Исправление темной темы ТОЛЬКО для страницы авторизации
   Не затрагивает цветные панели на дашборде
   ============================================== */

/* Темная тема - основные переменные */
[data-coreui-theme="dark"] {
  --cui-input-bg: #323a49;
  --cui-input-color: rgba(255, 255, 255, 0.87);
  --cui-input-border-color: #4a566d;
  --cui-input-placeholder-color: rgba(255, 255, 255, 0.6);
  --cui-input-focus-border-color: #5856d6;
  --cui-input-focus-bg: #3d4555;
}

/* ============================================== */
/* СТРАНИЦА ЛОГИНА - Специфичные правила         */
/* ============================================== */

/* Используем селектор для страницы логина (min-vh-100 обычно есть только на login) */
[data-coreui-theme="dark"] .min-vh-100 .form-control,
[data-coreui-theme="dark"] .min-vh-100 input[type="text"],
[data-coreui-theme="dark"] .min-vh-100 input[type="email"],
[data-coreui-theme="dark"] .min-vh-100 input[type="password"] {
  background-color: #323a49 !important;
  border-color: #4a566d !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

/* Placeholder текст в темной теме - только для login */
[data-coreui-theme="dark"] .min-vh-100 .form-control::placeholder,
[data-coreui-theme="dark"] .min-vh-100 input::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
  opacity: 1 !important;
}

/* Focus состояние для полей ввода - только для login */
[data-coreui-theme="dark"] .min-vh-100 .form-control:focus,
[data-coreui-theme="dark"] .min-vh-100 input:focus {
  background-color: #3d4555 !important;
  border-color: #5856d6 !important;
  color: rgba(255, 255, 255, 0.87) !important;
  box-shadow: 0 0 0 0.25rem rgba(88, 86, 214, 0.25) !important;
}

/* Input Group (иконки слева от полей) - только для login */
[data-coreui-theme="dark"] .min-vh-100 .input-group-text {
  background-color: #323a49 !important;
  border-color: #4a566d !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

/* Карточка логина - НЕ затрагиваем карточки на дашборде */
[data-coreui-theme="dark"] .min-vh-100 .card {
  background-color: #212631 !important;
  border-color: #323a49 !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

[data-coreui-theme="dark"] .min-vh-100 .card-body {
  background-color: #212631 !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

/* Заголовки - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 h1,
[data-coreui-theme="dark"] .min-vh-100 h2,
[data-coreui-theme="dark"] .min-vh-100 h3,
[data-coreui-theme="dark"] .min-vh-100 h4 {
  color: rgba(255, 255, 255, 0.87) !important;
}

/* Кнопки - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .btn-primary {
  background-color: #5856d6 !important;
  border-color: #5856d6 !important;
  color: #fff !important;
}

[data-coreui-theme="dark"] .min-vh-100 .btn-primary:hover {
  background-color: #4644b4 !important;
  border-color: #4644b4 !important;
}

[data-coreui-theme="dark"] .min-vh-100 .btn-link {
  color: #5e5ccf !important;
}

[data-coreui-theme="dark"] .min-vh-100 .btn-link:hover {
  color: #7e7cd9 !important;
}

/* Алерты - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .alert {
  border-color: #4a566d !important;
}

[data-coreui-theme="dark"] .min-vh-100 .alert-danger {
  background-color: rgba(229, 83, 83, 0.2) !important;
  border-color: #e55353 !important;
  color: #f2a9a9 !important;
}

[data-coreui-theme="dark"] .min-vh-100 .alert-success {
  background-color: rgba(27, 158, 62, 0.2) !important;
  border-color: #1b9e3e !important;
  color: #96dbad !important;
}

/* Текст и ссылки - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 p,
[data-coreui-theme="dark"] .min-vh-100 span {
  color: rgba(255, 255, 255, 0.87) !important;
}

[data-coreui-theme="dark"] .min-vh-100 a {
  color: #5e5ccf !important;
}

[data-coreui-theme="dark"] .min-vh-100 a:hover {
  color: #7e7cd9 !important;
}

/* Label для форм - только на странице логина, НО исключаем floating labels */
[data-coreui-theme="dark"] .min-vh-100 .form-label:not(.form-floating > label),
[data-coreui-theme="dark"] .min-vh-100 label:not(.form-floating > label) {
  color: rgba(255, 255, 255, 0.87) !important;
}

/* ============================================== */
/* FLOATING LABELS - Полная реализация          */
/* ============================================== */

/* Базовое состояние - label внутри поля (когда поле пустое и не в фокусе) */
[data-coreui-theme="dark"] .min-vh-100 .form-floating > label {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  height: 100% !important;
  padding: 1rem 0.75rem !important;
  pointer-events: none !important;
  border: 1px solid transparent !important;
  transform-origin: 0 0 !important;
  transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out !important;
  color: rgba(255, 255, 255, 0.6) !important;
  background-color: transparent !important;
  opacity: 0.65 !important;
  transform: scale(1) translateY(0) !important;
}

/* Активное состояние - label поднимается вверх и уменьшается */
/* Срабатывает когда: поле в фокусе ИЛИ поле заполнено (не показывается placeholder) */
[data-coreui-theme="dark"] .min-vh-100 .form-floating > .form-control:focus ~ label,
[data-coreui-theme="dark"] .min-vh-100 .form-floating > .form-control:not(:placeholder-shown) ~ label {
  opacity: 1 !important;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem) !important;
  color: rgba(255, 255, 255, 0.87) !important;
  background-color: var(--cui-card-bg) !important;
  padding: 0.25rem 0.5rem !important;
  height: auto !important;
}

/* Фон страницы логина */
[data-coreui-theme="dark"] .min-vh-100.bg-body-tertiary {
  background-color: #212631 !important;
}

/* Google OAuth кнопка - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .btn-google {
  background-color: #323a49 !important;
  border-color: #4a566d !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

[data-coreui-theme="dark"] .min-vh-100 .btn-google:hover {
  background-color: #3d4555 !important;
  border-color: #5856d6 !important;
}

/* Разделитель (или/OR) - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Автозаполнение браузера - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 input:-webkit-autofill,
[data-coreui-theme="dark"] .min-vh-100 input:-webkit-autofill:hover,
[data-coreui-theme="dark"] .min-vh-100 input:-webkit-autofill:focus {
  -webkit-text-fill-color: rgba(255, 255, 255, 0.87) !important;
  -webkit-box-shadow: 0 0 0 1000px #323a49 inset !important;
  box-shadow: 0 0 0 1000px #323a49 inset !important;
  border-color: #4a566d !important;
}

/* ============================================== */
/* Исправление разделителя "Или войдите через"   */
/* ============================================== */

/* Разделитель с текстом по центру - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .position-relative {
  color: rgba(255, 255, 255, 0.87) !important;
}

[data-coreui-theme="dark"] .min-vh-100 .position-relative::before,
[data-coreui-theme="dark"] .min-vh-100 .position-relative::after {
  background-color: #4a566d !important;
}

[data-coreui-theme="dark"] .min-vh-100 .text-center.position-relative span,
[data-coreui-theme="dark"] .min-vh-100 .position-relative span {
  background-color: #212631 !important;
  color: rgba(255, 255, 255, 0.6) !important;
}

[data-coreui-theme="dark"] .min-vh-100 .text-muted.text-center {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* HR элементы - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 hr {
  border-color: #4a566d !important;
  opacity: 1 !important;
}

/* Любой span с классом bg-light или bg-white - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 span.bg-light,
[data-coreui-theme="dark"] .min-vh-100 span.bg-white,
[data-coreui-theme="dark"] .min-vh-100 .bg-light,
[data-coreui-theme="dark"] .min-vh-100 .bg-white {
  background-color: #212631 !important;
}

/* Small текст - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 small,
[data-coreui-theme="dark"] .min-vh-100 .small {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Специфичные правила для страницы логина */
[data-coreui-theme="dark"] .min-vh-100 .text-center.my-4,
[data-coreui-theme="dark"] .min-vh-100 .text-center.my-3 {
  color: rgba(255, 255, 255, 0.6) !important;
}

[data-coreui-theme="dark"] .min-vh-100 .text-center.my-4 span,
[data-coreui-theme="dark"] .min-vh-100 .text-center.my-3 span {
  background-color: #212631 !important;
  color: rgba(255, 255, 255, 0.6) !important;
  padding: 0 0.5rem !important;
}

/* Для элементов с z-index (текст поверх линии) - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .position-relative span[style*="z-index"] {
  background-color: #212631 !important;
}

/* Дополнительное правило для span внутри card-body - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 .card-body .text-center span {
  background-color: #212631 !important;
}

/* ============================================== */
/* Исправление логотипа для темной темы          */
/* ============================================== */

/* Инверсия логотипа - только на странице логина */
[data-coreui-theme="dark"] .min-vh-100 img[src*="logo"],
[data-coreui-theme="dark"] .min-vh-100 img[alt*="logo"],
[data-coreui-theme="dark"] .min-vh-100 img[alt*="Logo"] {
  filter: brightness(0) invert(1) !important;
  opacity: 0.87 !important;
}

/* Убедимся что Google logo не затронут */
[data-coreui-theme="dark"] .min-vh-100 img[alt*="Google"],
[data-coreui-theme="dark"] .min-vh-100 img[src*="google"] {
  filter: none !important;
  opacity: 1 !important;
}

/* ============================================== */
/* ГЛОБАЛЬНЫЕ правила для всего приложения       */
/* БЕЗ !important чтобы не перекрывать цвета     */
/* ============================================== */

/* Иконки SVG в темной теме - везде */
[data-coreui-theme="dark"] svg {
  color: currentColor;
  fill: currentColor;
}

/* Базовые формы - везде, но без !important */
[data-coreui-theme="dark"] .form-control,
[data-coreui-theme="dark"] input[type="text"],
[data-coreui-theme="dark"] input[type="email"],
[data-coreui-theme="dark"] input[type="password"],
[data-coreui-theme="dark"] textarea.form-control {
  background-color: #323a49;
  border-color: #4a566d;
  color: rgba(255, 255, 255, 0.87);
}

[data-coreui-theme="dark"] .form-control::placeholder,
[data-coreui-theme="dark"] input::placeholder,
[data-coreui-theme="dark"] textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
  opacity: 1;
}

[data-coreui-theme="dark"] .form-control:focus,
[data-coreui-theme="dark"] input:focus,
[data-coreui-theme="dark"] textarea:focus {
  background-color: #3d4555;
  border-color: #5856d6;
  color: rgba(255, 255, 255, 0.87);
  box-shadow: 0 0 0 0.25rem rgba(88, 86, 214, 0.25);
}

/* Input Group - везде */
[data-coreui-theme="dark"] .input-group-text {
  background-color: #323a49;
  border-color: #4a566d;
  color: rgba(255, 255, 255, 0.87);
}

/* Модальные окна - везде */
[data-coreui-theme="dark"] .modal-content {
  background-color: #212631;
  border-color: #323a49;
  color: rgba(255, 255, 255, 0.87);
}

[data-coreui-theme="dark"] .modal-header {
  border-bottom-color: #323a49;
}

[data-coreui-theme="dark"] .modal-footer {
  border-top-color: #323a49;
}

/* Dropdown - везде */
[data-coreui-theme="dark"] .dropdown-menu {
  background-color: #323a49;
  border-color: #4a566d;
}

[data-coreui-theme="dark"] .dropdown-item {
  color: rgba(255, 255, 255, 0.87);
}

[data-coreui-theme="dark"] .dropdown-item:hover {
  background-color: #3d4555;
  color: rgba(255, 255, 255, 0.87);
}

/* Select - везде */
[data-coreui-theme="dark"] select.form-select,
[data-coreui-theme="dark"] select.form-control {
  background-color: #323a49;
  border-color: #4a566d;
  color: rgba(255, 255, 255, 0.87);
}

/* Checkbox и Radio - везде */
[data-coreui-theme="dark"] .form-check-input {
  background-color: #323a49;
  border-color: #4a566d;
}

[data-coreui-theme="dark"] .form-check-input:checked {
  background-color: #5856d6;
  border-color: #5856d6;
}

[data-coreui-theme="dark"] .form-check-label {
  color: rgba(255, 255, 255, 0.87);
}

/* Toast уведомления - везде */
[data-coreui-theme="dark"] .toast {
  background-color: #323a49;
  border-color: #4a566d;
  color: rgba(255, 255, 255, 0.87);
}

[data-coreui-theme="dark"] .toast-header {
  background-color: #2a313d;
  border-bottom-color: #4a566d;
  color: rgba(255, 255, 255, 0.87);
}

/* Tooltip - везде */
[data-coreui-theme="dark"] .tooltip-inner {
  background-color: #323a49;
  color: rgba(255, 255, 255, 0.87);
}

/* Popover - везде */
[data-coreui-theme="dark"] .popover {
  background-color: #323a49;
  border-color: #4a566d;
}

[data-coreui-theme="dark"] .popover-body {
  color: rgba(255, 255, 255, 0.87);
}

/* ============================================== */
/* ONBOARDING FORMS - Дополнительные правила     */
/* ============================================== */

/* CFormInput в темной теме */
[data-coreui-theme="dark"] .min-vh-100 .form-control.is-invalid,
[data-coreui-theme="dark"] .min-vh-100 .form-control.is-valid {
  background-color: #323a49 !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

/* CFormTextarea в темной теме */
[data-coreui-theme="dark"] .min-vh-100 textarea.form-control {
  background-color: #323a49 !important;
  border-color: #4a566d !important;
  color: rgba(255, 255, 255, 0.87) !important;
}

[data-coreui-theme="dark"] .min-vh-100 textarea.form-control:focus {
  background-color: #3d4555 !important;
  border-color: #5856d6 !important;
}

/* Исправление label для всех форм в темной теме */
[data-coreui-theme="dark"] .min-vh-100 .form-label {
  color: rgba(255, 255, 255, 0.87) !important;
  background: transparent !important;
}

/* CCardHeader в onboarding */
[data-coreui-theme="dark"] .min-vh-100 .card-header {
  background-color: #5856d6 !important;
  color: #fff !important;
  border-bottom-color: #323a49 !important;
}

/* Кнопки в card header */
[data-coreui-theme="dark"] .min-vh-100 .card-header .btn,
[data-coreui-theme="dark"] .min-vh-100 .card-header button {
  color: #fff !important;
}

/* Span в card header - для названия формы */
[data-coreui-theme="dark"] .min-vh-100 .card-header span {
  background: transparent !important;
  color: #fff !important;
}

/* Invalid/Valid feedback */
[data-coreui-theme="dark"] .min-vh-100 .invalid-feedback,
[data-coreui-theme="dark"] .min-vh-100 .valid-feedback {
  color: rgba(255, 255, 255, 0.87) !important;
}
