/**
 * Базовые стили приложения Kareta
 *
 * Загружается первым (assets_config.php → header.php).
 * Стили для всех страниц:
 *   - CSS переменные (:root): цвета, градиенты, safe-area, размеры кнопок
 *   - Логотипы, баланс кассы
 *   - Навигационное меню (navbar)
 *   - Общие утилиты, бейджи
 *   - Кастомный select
 *   - Централизованные стили модальных окон
 *   - Современный футер (modern-footer)
 */

/* ============================================
   CSS Переменные (Custom Properties)
   ============================================ */
:root {
    /* Safe area для устройств с вырезами (iPhone X+, Android) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    
    /* Основные цвета */
    --color-primary: #1e3c72;
    --color-primary-light: #2a5298;
    
    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --gradient-primary-reverse: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    --gradient-primary-vertical: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
    
    /* Цвета для других элементов */
    --color-success: #28a745;
    --color-success-light: #20c997;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    
    /* Градиенты для других элементов */
    --gradient-success: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --gradient-danger: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    --gradient-warning: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    --gradient-info: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    
    /* Размеры кнопок - единая система для консистентности */
    --btn-padding-sm: 0.5rem 0.75rem;      /* Маленькие кнопки */
    --btn-padding-md: 0.75rem 1.5rem;     /* Средние кнопки (по умолчанию) */
    --btn-padding-lg: 1rem 2rem;           /* Большие кнопки */
    --btn-font-size-sm: 0.875rem;         /* Маленький шрифт */
    --btn-font-size-md: 1rem;              /* Средний шрифт (по умолчанию) */
    --btn-font-size-lg: 1.125rem;          /* Большой шрифт */
    --btn-min-height-touch: 44px;         /* 2.75rem - минимальный размер для touch-устройств (рекомендация Apple/Google) */
    
    /* Фокус для клавиатурной навигации (доступность) */
    --focus-ring-color: var(--color-primary);
    --focus-ring-offset: 2px;
    --focus-ring-width: 3px;

    /* Чат (Card Style) */
    --chat-primary: #2c4a7c;
    --chat-primary-light: #3a5f94;
    --chat-accent: #4a90e2;
    --chat-bg: #ffffff;
    --chat-body-bg: #fafbfc;
    --chat-message-left-bg: #ffffff;
    --chat-message-left-border: rgba(44, 74, 124, 0.06);
    --chat-message-left-shadow: 0 3px 12px rgba(44, 74, 124, 0.08);
    --chat-message-right-gradient: linear-gradient(135deg, #2c4a7c 0%, #3a5f94 100%);
    --chat-message-right-border: rgba(44, 74, 124, 0.12);
    --chat-message-right-shadow: 0 4px 16px rgba(44, 74, 124, 0.2);
    --chat-text-left: #1a1a2e;
    --chat-text-right: #ffffff;
    --chat-timestamp-incoming: #8b92a0;
    --chat-timestamp-outgoing: rgba(0, 0, 0, 0.5);
    --chat-input-bg: #e8eef5;
    --chat-input-border: rgba(44, 74, 124, 0.08);
    --chat-input-shadow: 0 -2px 16px rgba(44, 74, 124, 0.1);
    --chat-send-gradient: linear-gradient(180deg, #2c4a7c 0%, #4a90e2 100%);
    --chat-send-shadow: 0 4px 14px rgba(44, 74, 124, 0.3);
    --chat-container-shadow: 0 32px 80px rgba(44, 74, 124, 0.3);
    --chat-header-border: rgba(44, 74, 124, 0.08);
    /* Модалка диалога: единые ограничения (переопределяются в mobile/tablet/desktop) */
    --chat-modal-max-width: min(480px, calc(100vw - 1.5rem));
    --chat-modal-max-height: min(90dvh, 900px);
    --chat-modal-min-height: min(420px, 72dvh);

    /* Kareta / iOS public — PLAN_WEB_MOBILE_IOS_ALIGNMENT (светлая тема; эталон AppTheme / KaretaTextStyle) */
    --kareta-text-dark: #1a1a2e;
    --kareta-text-secondary: #64748b;
    --kareta-bg-page: #f8f9fb;
    --kareta-bg-surface: #ffffff;
    --kareta-primary-blue: #2c4a7c;
    --kareta-accent-blue: #4a90e2;
    /* Текст на градиенте шапки витрины (.public-header) */
    --kareta-on-primary: #ffffff;
    --kareta-card-price: #059669;
    --kareta-card-price-bg: rgba(5, 150, 105, 0.08);
    --kareta-card-price-border: rgba(5, 150, 105, 0.22);
    /* CarDetailsSize.cardRadius 24pt */
    --kareta-card-radius: 1.5rem;
    --kareta-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --kareta-card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --kareta-image-placeholder-bg: #f8f9fb;
    /* Разделители, блоки продавца, характеристики */
    --kareta-border-hairline: #e2e8f0;
    /* CTA / вторичные кнопки в деталях (см. .public-car-details-cta) */
    --kareta-cta-radius: 0.75rem;
    /* public.php: нижний отступ скролла под стек FAB (support…comparison) + safe area; mobile.css */
    --kareta-public-main-padding-bottom: calc(9.5rem + env(safe-area-inset-bottom, 0px));
    /* Бейдж числа на кнопке «Фильтры» (контраст к градиенту) */
    --kareta-mobile-filters-count-badge: #ff4757;
    /* Подложка offcanvas моб. фильтров (ближе к --kareta-bg-page) */
    --kareta-filters-canvas-bg: #f5f7fb;
    /* Детали авто (iOS: KaretaTextStyle / AppTheme.CarDetailsSize) — mobile.css / android.css */
    --kareta-font-display: "Playfair Display", Georgia, "Times New Roman", serif;
    /* specRowCornerRadius 18pt; photoGalleryCornerRadius 22pt */
    --kareta-details-spec-row-radius: 1.125rem;
    --kareta-details-gallery-radius: 1.375rem;
    --kareta-details-spec-border: rgba(44, 74, 124, 0.14);
    /* Публичная витрина: единый sans-стек (Chrome/Safari — один визуальный эталон) */
    --kareta-font-ui-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Inter", Arial, sans-serif;
}

/* Доступность: видимый фокус при навигации с клавиатуры (Tab), без лишнего outline при клике мышью */
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

.btn:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

/* Ссылка "Перейти к контенту" — скрыта, видна при фокусе (Tab) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    font-weight: 600;
    border-radius: 0 0 0.5rem 0.5rem;
    text-decoration: none;
    transition: top 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.skip-link:focus {
    top: 0;
    outline: var(--focus-ring-width) solid white;
    outline-offset: 2px;
}

/* Уменьшение движения для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Responsive: таблицы и блоки по ширине экрана
   ============================================ */

/* Предотвращаем горизонтальный скролл страницы */
html {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
    /* Safari/iOS: отключаем автоподбор размера текста в колонках flex/grid (должен совпадать с Chrome) */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

/* Контейнеры не выходят за ширину экрана */
.container,
.container-fluid {
    max-width: 100%;
    width: 100%;
    overflow-x: hidden; /* таблица/контент не растягивают страницу */
}

/* Основной контент по ширине экрана */
main,
#main-content,
.main-content {
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
}

/* Обёртка таблиц: по ширине экрана, при переполнении — горизонтальный скролл */
.table-responsive {
    width: 100%;
    max-width: 100%;
    min-width: 0; /* сжимается во flex-контексте, не выталкивает родителя */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

.table-responsive .table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
}

/* Карточки и блоки контента не выходят за экран */
.card,
.card-body,
.card-header {
    max-width: 100%;
    box-sizing: border-box;
}

/* Карточка не расширяет страницу — обрезка при переполнении */
.card {
    overflow-x: hidden;
}

/* card-body не тянет ширину по контенту таблицы (flex/min-width) */
.card-body {
    min-width: 0;
}

/* Ряды и колонки Bootstrap не выходят за экран */
.row {
    max-width: 100%;
}

.row > [class*="col-"] {
    max-width: 100%;
    min-width: 0; /* позволяет flex/grid элементам сжиматься */
    box-sizing: border-box;
}

/* Логотипы - базовые стили (размеры в mobile.css, tablet.css, desktop.css) */
.navbar-logo {
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.navbar-logo:hover {
    opacity: 0.8;
}

.login-logo {
    width: auto;
    object-fit: contain;
    max-width: 100%;
    /* Размеры (height) в mobile.css, tablet.css, desktop.css */
}

/* Баланс кассы */
.cash-balance {
    font-size: 1.25rem;
    font-weight: 700;
    color: #28a745;
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
    text-shadow: 0 1px 2px rgba(40, 167, 69, 0.1);
    letter-spacing: 0.02em;
}

.cash-balance.updating {
    animation: balancePulse 0.6s ease-in-out;
}

.cash-balance.updated {
    animation: balanceSuccess 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cash-balance-badge {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 0.75rem;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 
                0 2px 4px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.cash-balance-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(40, 167, 69, 0.1), 
        transparent);
    transition: left 0.5s ease;
}

.cash-balance-badge.refreshing::before {
    left: 100%;
}

.cash-balance-badge .text-muted {
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.cash-balance-refresh {
    color: #6c757d;
    text-decoration: none;
    vertical-align: middle;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    transform-style: preserve-3d;
}

.cash-balance-refresh::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(40, 167, 69, 0.1) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cash-balance-refresh:hover {
    color: #28a745;
    text-decoration: none;
    transform: translateY(-3px) scale(1.15) rotateY(5deg);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3),
                0 2px 6px rgba(40, 167, 69, 0.2);
}

.cash-balance-refresh:hover::before {
    opacity: 1;
    transform: scale(1.2);
}

.cash-balance-refresh:active {
    transform: translateY(-1px) scale(1.05) rotateY(-2deg);
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.2);
}

.cash-balance-refresh:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.25);
    border-radius: 50%;
}

.cash-balance-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cash-balance-refresh i {
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    transform-style: preserve-3d;
}

.cash-balance-refresh i.spinning {
    animation: spin3D 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    color: #28a745;
}

.cash-balance-refresh:not(:disabled):hover i {
    transform: rotateY(15deg) rotateX(5deg);
}

/* 3D анимация вращения */
@keyframes spin3D {
    0% {
        transform: rotateY(0deg) rotateZ(0deg);
    }
    50% {
        transform: rotateY(180deg) rotateZ(180deg);
    }
    100% {
        transform: rotateY(360deg) rotateZ(360deg);
    }
}

/* Анимация пульсации баланса при обновлении */
@keyframes balancePulse {
    0%, 100% {
        transform: scale(1) translateZ(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.05) translateZ(20px);
        opacity: 0.8;
    }
}

/* Анимация успешного обновления баланса */
@keyframes balanceSuccess {
    0% {
        transform: scale(1) translateZ(0) rotateX(0deg);
        color: #28a745;
    }
    25% {
        transform: scale(1.15) translateZ(30px) rotateX(10deg);
        color: #20c997;
        text-shadow: 0 0 20px rgba(40, 167, 69, 0.5);
    }
    50% {
        transform: scale(1.1) translateZ(20px) rotateX(-5deg);
        color: #17a2b8;
        text-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
    }
    75% {
        transform: scale(1.05) translateZ(10px) rotateX(2deg);
        color: #28a745;
        text-shadow: 0 0 10px rgba(40, 167, 69, 0.3);
    }
    100% {
        transform: scale(1) translateZ(0) rotateX(0deg);
        color: #28a745;
        text-shadow: none;
    }
}

/* Эффект волны при обновлении */
@keyframes balanceWave {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4),
                    0 4px 12px rgba(0, 0, 0, 0.1),
                    0 2px 4px rgba(0, 0, 0, 0.06);
        transform: translateZ(0);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(40, 167, 69, 0),
                    0 6px 16px rgba(40, 167, 69, 0.15),
                    0 3px 8px rgba(40, 167, 69, 0.1);
        transform: translateZ(10px) scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0),
                    0 4px 12px rgba(0, 0, 0, 0.1),
                    0 2px 4px rgba(0, 0, 0, 0.06);
        transform: translateZ(0) scale(1);
    }
}

.cash-balance-badge.wave-effect {
    animation: balanceWave 0.6s ease-out;
}

/* Навигационное меню */
.navbar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-weight: 600;
}

.navbar-nav .nav-link i {
    font-size: 1.1rem;
}

/* Адаптивное меню с переносом на вторую строку */
.navbar-nav-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    justify-content: flex-end;
}

.navbar-nav-flex .nav-item {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Разделитель в меню */
.navbar-nav .navbar-text.text-white-50 {
    font-size: 1.2rem;
    padding: 0;
    margin: 0 0.5rem;
}

/* Навбар текст - белое пространство */
.navbar-text {
    white-space: normal;
}

/* Бейдж уведомлений в навбаре */
#navNotificationsBadge {
    display: none;
    font-size: 0.7rem;
    padding: 0.25em 0.5em;
}

#navNotificationsBadge.show {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Бейдж непрочитанных сообщений */
#navUnreadCount {
    display: none;
}

#navUnreadCount.show {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Только сдвиг по X: translate(-50% Y) срезал цифры у верхней границы шапки */
#navNotificationsBadge,
#navUnreadCount {
    top: 0.5rem;
    line-height: 1.1;
    transform: translate3d(-50%, 0, 0) !important;
    box-sizing: border-box;
}

/* Бейдж уведомлений в модальном окне */
#modalNotificationsBadge {
    display: none;
}

#modalNotificationsBadge.show {
    display: inline-block;
}

/* Модальное окно уведомлений - пустое состояние */
#noNotificationsModal {
    display: none;
}

#noNotificationsModal.show {
    display: block;
}

/* Список уведомлений в модальном окне */
#notificationsModalList {
    display: none;
}

#notificationsModalList.show {
    display: block;
}

/* Утилиты для показа/скрытия элементов */
.hide {
    display: none !important;
}

.show {
    display: block !important;
}

.show-inline {
    display: inline-block !important;
}

/* Контейнеры для select опций */
.select-options-container {
    max-height: 200px;
    overflow-y: auto;
}

.select-options-container-lg {
    max-height: 300px;
    overflow-y: auto;
}

/* Минимальная высота для карточек заметок */
.card-text-min-height {
    min-height: 60px;
}

/* Курсор указатель */
.cursor-pointer {
    cursor: pointer;
}

/* Предложения расходов */
.expense-suggestions {
    display: none;
}

.expense-suggestions.show {
    display: block;
}

/* Стандартная высота и выравнивание всех кнопок */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: var(--btn-min-height-touch);
    padding: var(--btn-padding-md);
    font-size: var(--btn-font-size-md);
    line-height: 1.2;
    white-space: nowrap;
}

.btn i.bi,
.btn .bi {
    flex-shrink: 0;
    font-size: 1.1em;
}

.btn-sm {
    min-height: 38px;
    padding: var(--btn-padding-sm);
    font-size: var(--btn-font-size-sm);
}

.btn-sm i.bi,
.btn-sm .bi {
    font-size: 1em;
}

.btn-lg {
    min-height: 48px;
    padding: var(--btn-padding-lg);
    font-size: var(--btn-font-size-lg);
}

/* Текст кнопки (рядом с иконкой) */
.btn-text {
    display: inline;
}

/* Бейджи статусов */
.status-badge {
    font-size: 0.85rem;
}

/* Прибыль */
.profit-positive {
    color: #28a745;
}

.profit-negative {
    color: #dc3545;
}

/* Кастомный select с поиском внутри dropdown */
.custom-select-wrapper {
    width: 100%;
    position: relative;
}

/* Скрываем оригинальный select цвета внутри wrapper */
.custom-select-wrapper > select#addCarColor,
.custom-select-wrapper > select#setForSaleColor,
select#addCarColor.hidden-original-select,
select#setForSaleColor.hidden-original-select {
    position: absolute !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    display: none !important;
}

.custom-select-button {
    background-color: #fff;
    border: 1px solid #ced4da;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
}

.custom-select-button:hover {
    border-color: #86b7fe;
}

.custom-select-button:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.custom-select-button .selected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-button .bi-chevron-down {
    transition: transform 0.2s;
    margin-left: 0.5rem;
}

.custom-select-button.show .bi-chevron-down {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    width: 100%;
    margin-top: 0.125rem;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1055 !important; /* Выше чем модальное окно Bootstrap (1050) */
    background-color: #fff;
    min-width: 100%;
}

.custom-select-dropdown.show {
    display: block !important;
}

.select-search-in-dropdown {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.select-search-in-dropdown .position-relative {
    position: relative;
}

.select-search-in-dropdown input {
    padding-left: 2rem;
    font-size: 0.875rem;
}

.select-search-icon-in-dropdown {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    z-index: 1;
}

.select-options-container {
    max-height: 200px;
    overflow-y: auto;
}

.select-options-container .dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    white-space: nowrap;
}

.select-options-container .dropdown-item:hover {
    background-color: #f8f9fa;
}

.select-options-container .dropdown-item.active {
    background-color: #0d6efd;
    color: #fff;
}

.select-options-container .dropdown-item-text {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Скрытые поля ввода */
.brand-manual-input,
.model-manual-input {
    display: none;
}

.brand-manual-input.show,
.model-manual-input.show {
    display: block;
}

/* ============================================
   Централизованные стили модальных окон 2025
   ============================================ */

/* Базовые стили модального окна */
.modal {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal-dialog {
    margin: 1.5rem auto;
    max-width: 600px;
    transition: all 0.3s ease;
}

.modal-dialog-centered {
    min-height: calc(100% - 3rem);
}

/* Содержимое модального окна */
.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    background: #fff;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Заголовок модального окна */
.modal-header {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 1.5rem 2rem;
    border-radius: 1rem 1rem 0 0;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    font-size: 1.5rem;
}

.modal-header .btn-close {
    background: #fff;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    opacity: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    filter: none;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modal-header .btn-close::before {
    content: '×';
    color: var(--color-primary);
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    display: block;
}

.modal-header .btn-close svg {
    display: none;
}

.modal-header .btn-close:hover {
    background: #fff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.modal-header .btn-close:focus {
    box-shadow: 0 0 0 0.25rem rgba(30, 60, 114, 0.3);
    border-color: var(--color-primary);
    opacity: 1;
}

/* Тело модального окна */
.modal-body {
    padding: 2rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) #f0f0f0;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-primary-reverse);
}

/* Формы в модальном окне */
.modal-body .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.modal-body .form-control,
.modal-body .form-select {
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(30, 60, 114, 0.15);
    outline: none;
}

.modal-body .form-control:hover,
.modal-body .form-select:hover {
    border-color: #ced4da;
}

.modal-body .mb-3 {
    margin-bottom: 1.5rem;
}

/* Футер модального окна */
.modal-footer {
    background: #f8f9fa;
    border: none;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 2rem;
    border-radius: 0 0 1rem 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-footer .btn {
    padding: var(--btn-padding-md);
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: var(--btn-font-size-md);
    transition: all 0.3s ease;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modal-footer .btn-secondary {
    background: #6c757d;
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.modal-footer .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
    color: #fff;
}

.modal-footer .btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
}

.modal-footer .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.4);
    color: #fff;
}

.modal-footer .btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.modal-footer .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
    color: #fff;
}

.modal-footer .btn-danger {
    background: #dc3545;
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.modal-footer .btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 35, 51, 0.4);
    color: #fff;
}

/* Большие модальные окна */
.modal-dialog.modal-lg {
    max-width: 800px;
}

.modal-dialog.modal-xl {
    max-width: 1140px;
}

/* Улучшения для удобства использования */
.modal.show .modal-dialog {
    transform: none;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

/* Фокус на первом поле при открытии */
.modal.show .modal-body input:not([type="hidden"]):first-of-type,
.modal.show .modal-body select:first-of-type,
.modal.show .modal-body textarea:first-of-type {
    animation: inputFocus 0.5s ease-out;
}

@keyframes inputFocus {
    0% {
        box-shadow: 0 0 0 0 rgba(30, 60, 114, 0);
    }
    50% {
        box-shadow: 0 0 0 0.25rem rgba(30, 60, 114, 0.25);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(30, 60, 114, 0);
    }
}

/* Улучшенная доступность */
.modal[aria-hidden="false"] {
    display: block !important;
}

/* Специальные стили для модальных окон с предупреждениями */
.modal-header.bg-danger {
    background: #dc3545 !important;
}

.modal-header.bg-warning {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%) !important;
}

.modal-header.bg-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
}

.modal-header.bg-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

/* Современный футер 2025 */
.modern-footer {
    background: var(--gradient-primary);
    color: #ffffff;
    margin-top: 4rem;
    padding: 3rem 0 1.5rem;
    position: relative;
    overflow: hidden;
}

.modern-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 50%, #4facfe 100%);
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

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

.footer-content {
    margin-bottom: 2rem;
}

.footer-brand .footer-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.footer-brand .footer-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 0;
}

.footer-section-title {
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.footer-links a:hover {
    color: #ffffff;
    transform: translateX(5px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.footer-contact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-contact li {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.footer-contact i {
    color: #4facfe;
    font-size: 1.1rem;
}

.footer-contact-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.footer-contact-link:hover {
    color: #ffffff;
    transform: translateX(5px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.language-switcher {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lang-btn.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-color: #4facfe;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    margin-top: 2rem;
}

.copyright {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-size: 0.9rem;
}

.footer-social {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.footer-version {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

/* OBD Scan — CSS переменные (светлая тема) */
.obd-scan-page {
    --obd-page-bg: #f8f9fa;
    --obd-card-bg: #ffffff;
    --obd-border: #dee2e6;
    --obd-border-focus: #86b7fe;
    --obd-text: #1a1a2e;
    --obd-text-secondary: #495057;
    --obd-text-muted: #6c757d;
    --obd-primary: #1e3c72;
    --obd-primary-light: #2a5298;
    --obd-accent: #0d6efd;
    --obd-severity-critical: #dc3545;
    --obd-severity-critical-bg: rgba(220, 53, 69, 0.1);
    --obd-severity-high: #fd7e14;
    --obd-severity-high-bg: rgba(253, 126, 20, 0.1);
    --obd-severity-medium: #ffc107;
    --obd-severity-medium-bg: rgba(255, 193, 7, 0.15);
    --obd-severity-low: #198754;
    --obd-severity-low-bg: rgba(25, 135, 84, 0.1);
}


