/* ============================================================
   СкороСервис CRM — Комплексные стили (Light & Dark Theme)
   ============================================================ */

/* ── Скроллбар ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ── Плавные переходы ── */
aside {
    transition: width 0.3s ease, transform 0.3s ease;
}

/* ── Анимация появления ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ── Фикс для select ── */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ── Убираем синюю подсветку при тапе на мобильном ── */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ── Безопасная зона внизу (iPhone с чёлкой + общий отступ) ── */
.safe-bottom {
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
}

/* ── Отступ контента под нижнюю навигацию на мобильном ── */
@media (max-width: 1023px) {
    main {
        padding-bottom: 5.5rem !important;
    }
}

/* ── Плавная прокрутка ── */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ── Предотвращаем «прыгание» контента при скрытии скроллбара ── */
html {
    overflow-y: scroll;
}

/* ── Фикс для iOS input zoom ── */
@media (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="month"],
    input[type="week"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ── Скрыть скроллбар у горизонтальных табов ── */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ── Карточки — плавное появление ── */
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.card-animate {
    animation: cardIn 0.25s ease-out both;
}

/* ── Светлая тема: цветовые утилиты ── */
.bg-blue-50      { background-color: #eff6ff !important; }
.bg-emerald-50,
.bg-green-50    { background-color: #ecfdf5 !important; }
.bg-amber-50,
.bg-yellow-50   { background-color: #fffbeb !important; }
.bg-rose-50,
.bg-red-50      { background-color: #fff1f2 !important; }
.bg-purple-50    { background-color: #faf5ff !important; }
.bg-indigo-50    { background-color: #eef2ff !important; }
.bg-cyan-50      { background-color: #ecfeff !important; }
.bg-orange-50    { background-color: #fff7ed !important; }

.border-blue-200     { border-color: #bfdbfe !important; }
.border-emerald-200,
.border-green-200   { border-color: #a7f3d0 !important; }
.border-amber-200,
.border-yellow-200  { border-color: #fde68a !important; }
.border-rose-200,
.border-red-200     { border-color: #fecdd3 !important; }
.border-purple-200   { border-color: #e9d5ff !important; }
.border-indigo-200   { border-color: #c7d2fe !important; }
.border-cyan-200     { border-color: #a5f3fc !important; }
.border-orange-200   { border-color: #fed7aa !important; }

.bg-blue-100     { background-color: #dbeafe !important; }
.bg-emerald-100,
.bg-green-100   { background-color: #d1fae5 !important; }
.bg-amber-100,
.bg-yellow-100  { background-color: #fef3c7 !important; }
.bg-rose-100,
.bg-red-100     { background-color: #ffe4e6 !important; }
.bg-purple-100   { background-color: #f3e8ff !important; }
.bg-indigo-100   { background-color: #e0e7ff !important; }
.bg-cyan-100     { background-color: #cffafe !important; }
.bg-orange-100   { background-color: #ffedd5 !important; }

.bg-rose-500     { background-color: #f43f5e !important; }

/* ============================================================
   ТЁМНАЯ ТЕМА (html.dark)
   ============================================================ */

/* Плавный переход при смене темы */
*, *::before, *::after {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.transition, [class*="animate-"], aside {
    transition: none;
}
aside { transition: width 0.3s ease, transform 0.3s ease; }

/* ── 1. Основные фоны и контейнеры ── */
html.dark body                          { background-color: #0f172a; color: #e2e8f0; }
html.dark .bg-white                     { background-color: #1e293b !important; }
html.dark .bg-gray-50                   { background-color: #1e293b !important; }
html.dark .bg-slate-50                  { background-color: #1e293b !important; }
html.dark .bg-gray-100                  { background-color: #0f172a !important; }
html.dark .bg-slate-100                 { background-color: #0f172a !important; }
html.dark .bg-gray-200                  { background-color: #334155 !important; }
html.dark .bg-slate-200                 { background-color: #334155 !important; }

/* ── 2. Текстовые цвета ── */
html.dark .text-gray-900,
html.dark .text-slate-900               { color: #f1f5f9 !important; }
html.dark .text-gray-800,
html.dark .text-slate-800               { color: #e2e8f0 !important; }
html.dark .text-gray-700,
html.dark .text-slate-700               { color: #cbd5e1 !important; }
html.dark .text-gray-600,
html.dark .text-slate-600               { color: #94a3b8 !important; }
html.dark .text-gray-500,
html.dark .text-slate-500               { color: #94a3b8 !important; }
html.dark .text-gray-400,
html.dark .text-slate-400               { color: #94a3b8 !important; }
html.dark .text-gray-300,
html.dark .text-slate-300               { color: #64748b !important; }

/* ── 3. Границы ── */
html.dark .border-gray-50,
html.dark .border-gray-100,
html.dark .border-slate-100             { border-color: #334155 !important; }
html.dark .border-gray-200,
html.dark .border-slate-200             { border-color: #334155 !important; }
html.dark .border-gray-300,
html.dark .border-slate-300             { border-color: #475569 !important; }
html.dark .border-dashed                { border-color: #475569 !important; }
html.dark .divide-gray-100 > * + *,
html.dark .divide-gray-200 > * + *,
html.dark .divide-slate-100 > * + *,
html.dark .divide-slate-200 > * + *     { border-color: #334155 !important; }

/* ── 4. Карточки, модалки и тени ── */
html.dark .rounded-2xl.bg-white,
html.dark .rounded-xl.bg-white,
html.dark .rounded-lg.bg-white         { background-color: #1e293b !important; }
html.dark .shadow-xs                   { box-shadow: 0 1px 2px rgba(0,0,0,0.4) !important; }
html.dark .shadow-sm                   { box-shadow: 0 1px 3px rgba(0,0,0,0.5) !important; }
html.dark .shadow-md                   { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.6) !important; }
html.dark .shadow-lg                   { box-shadow: 0 10px 25px rgba(0,0,0,0.6) !important; }
html.dark .shadow-xl                   { box-shadow: 0 20px 40px rgba(0,0,0,0.7) !important; }
html.dark .shadow-2xl                  { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8) !important; }

/* ── 5. Инпуты, селекты, формы ── */
html.dark input,
html.dark input[type="text"],
html.dark input[type="password"],
html.dark input[type="email"],
html.dark input[type="tel"],
html.dark input[type="number"],
html.dark input[type="date"],
html.dark input[type="time"],
html.dark input[type="datetime-local"],
html.dark input[type="month"],
html.dark input[type="week"],
html.dark input[type="search"],
html.dark input[type="file"],
html.dark textarea,
html.dark select {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

html.dark input[type="date"],
html.dark input[type="time"],
html.dark input[type="datetime-local"],
html.dark input[type="month"],
html.dark input[type="week"] {
    color-scheme: dark !important;
}

html.dark input.bg-transparent {
    background-color: transparent !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #64748b !important;
}

/* ── 6. Хедер и сайдбар ── */
html.dark header                       { background-color: #1e293b !important; border-color: #334155 !important; }
html.dark header .text-gray-800        { color: #e2e8f0 !important; }
html.dark header .text-gray-500        { color: #94a3b8 !important; }
html.dark header .text-gray-700        { color: #cbd5e1 !important; }
html.dark header .hover\:bg-gray-100:hover { background-color: #334155 !important; }

html.dark aside                        { background-color: #020617 !important; }
html.dark aside .text-gray-400         { color: #94a3b8 !important; }
html.dark aside .text-gray-500         { color: #94a3b8 !important; }
html.dark aside nav a                  { color: #94a3b8 !important; }
html.dark aside nav a i                { color: #94a3b8 !important; }
html.dark aside nav a span             { color: #cbd5e1 !important; }
html.dark aside nav a:hover            { background-color: #334155 !important; }
html.dark aside nav a:hover i,
html.dark aside nav a:hover span       { color: #f1f5f9 !important; }
html.dark aside .border-gray-800       { border-color: #334155 !important; }
html.dark aside button.text-gray-400   { color: #94a3b8 !important; }
html.dark aside button:hover.text-gray-400 { color: #f1f5f9 !important; }

.crm-sidebar-logo,
html.dark aside .crm-sidebar-logo,
html.dark 

/* ── 7. Таблицы данных ── */
html.dark table                        { background-color: #1e293b; }
html.dark thead                        { background-color: #0f172a !important; }
html.dark th                           { color: #94a3b8 !important; border-color: #334155 !important; }
html.dark td                           { border-color: #334155 !important; color: #cbd5e1 !important; }
html.dark tbody tr:hover               { background-color: #334155 !important; }
html.dark .border-b                    { border-color: #334155 !important; }
html.dark .bg-primary-50               { background-color: rgba(37, 99, 235, 0.25) !important; }

/* ── 8. Цветные плашки, бейджи и акценты ── */

/* Зелёные / Клиенты / Успех */
html.dark .bg-green-50,
html.dark .bg-emerald-50               { background-color: rgba(6, 78, 59, 0.4) !important; }
html.dark .bg-green-100,
html.dark .bg-emerald-100              { background-color: rgba(6, 78, 59, 0.6) !important; }
html.dark .border-green-200,
html.dark .border-emerald-200          { border-color: rgba(16, 185, 129, 0.35) !important; }
html.dark .text-green-900,
html.dark .text-emerald-900,
html.dark .text-green-800,
html.dark .text-emerald-800,
html.dark .text-green-700,
html.dark .text-emerald-700            { color: #a7f3d0 !important; }
html.dark .text-green-600,
html.dark .text-emerald-600            { color: #34d399 !important; }
html.dark .text-green-500,
html.dark .text-emerald-500            { color: #6ee7b7 !important; }

/* Синие / Заявки / Инфо */
html.dark .bg-blue-50                  { background-color: rgba(30, 58, 138, 0.35) !important; }
html.dark .bg-blue-100                 { background-color: rgba(30, 58, 138, 0.55) !important; }
html.dark .border-blue-200             { border-color: rgba(59, 130, 246, 0.35) !important; }
html.dark .text-blue-900,
html.dark .text-blue-800,
html.dark .text-blue-700               { color: #bfdbfe !important; }
html.dark .text-blue-600,
html.dark .text-blue-500               { color: #93c5fd !important; }

/* Фиолетовые / Аудиозаписи */
html.dark .bg-purple-50                { background-color: rgba(88, 28, 135, 0.35) !important; }
html.dark .bg-purple-100               { background-color: rgba(88, 28, 135, 0.55) !important; }
html.dark .border-purple-200           { border-color: rgba(168, 85, 247, 0.35) !important; }
html.dark .text-purple-900,
html.dark .text-purple-800,
html.dark .text-purple-700             { color: #e9d5ff !important; }
html.dark .text-purple-600             { color: #c084fc !important; }

/* Индиго */
html.dark .bg-indigo-50                { background-color: rgba(49, 46, 129, 0.35) !important; }
html.dark .bg-indigo-100               { background-color: rgba(49, 46, 129, 0.55) !important; }
html.dark .border-indigo-200           { border-color: rgba(99, 102, 241, 0.35) !important; }
html.dark .text-indigo-900,
html.dark .text-indigo-800,
html.dark .text-indigo-700             { color: #c7d2fe !important; }
html.dark .text-indigo-600             { color: #818cf8 !important; }

/* Жёлтые / Янтарные / Предупреждения */
html.dark .bg-amber-50,
html.dark .bg-yellow-50                { background-color: rgba(120, 53, 15, 0.35) !important; }
html.dark .bg-amber-100,
html.dark .bg-yellow-100               { background-color: rgba(120, 53, 15, 0.55) !important; }
html.dark .border-amber-200,
html.dark .border-yellow-200           { border-color: rgba(245, 158, 11, 0.35) !important; }
html.dark .text-amber-900,
html.dark .text-yellow-900,
html.dark .text-amber-800,
html.dark .text-yellow-800             { color: #fde68a !important; }
html.dark .text-amber-600,
html.dark .text-yellow-600             { color: #fbbf24 !important; }

/* Красные / Розовые / Ошибки / Срочные */
html.dark .bg-red-50,
html.dark .bg-rose-50                  { background-color: rgba(127, 29, 29, 0.35) !important; }
html.dark .bg-red-100,
html.dark .bg-rose-100                 { background-color: rgba(153, 27, 27, 0.55) !important; }
html.dark .border-red-100,
html.dark .border-red-200,
html.dark .border-rose-100,
html.dark .border-rose-200             { border-color: rgba(248, 113, 113, 0.36) !important; }
html.dark .text-red-900,
html.dark .text-red-800,
html.dark .text-red-700,
html.dark .text-red-600,
html.dark .text-red-500,
html.dark .text-red-400,
html.dark .text-rose-600               { color: #fca5a5 !important; }

/* Оранжевые */
html.dark .bg-orange-50                { background-color: rgba(124, 45, 18, 0.34) !important; }
html.dark .bg-orange-100               { background-color: rgba(154, 52, 18, 0.48) !important; }
html.dark .border-orange-100,
html.dark .border-orange-200,
html.dark .border-orange-300           { border-color: rgba(251, 146, 60, 0.42) !important; }
html.dark .text-orange-900,
html.dark .text-orange-800,
html.dark .text-orange-700,
html.dark .text-orange-600             { color: #fdba74 !important; }

/* Циан / MAX */
html.dark .bg-cyan-50                  { background-color: rgba(22, 78, 99, 0.35) !important; }
html.dark .bg-cyan-100                 { background-color: rgba(22, 78, 99, 0.55) !important; }
html.dark .border-cyan-200             { border-color: rgba(6, 182, 212, 0.35) !important; }
html.dark .text-cyan-800,
html.dark .text-cyan-700               { color: #67e8f9 !important; }

/* ── 9. Кнопки и контролы ── */
html.dark .bg-gray-100                 { background-color: #334155 !important; }
html.dark .hover\:bg-gray-50:hover    { background-color: #334155 !important; }
html.dark .hover\:bg-gray-100:hover   { background-color: #334155 !important; }
html.dark .hover\:bg-gray-200:hover   { background-color: #475569 !important; }
html.dark .bg-white\/50               { background-color: rgba(51, 65, 85, 0.5) !important; }
html.dark .hover\:bg-white:hover      { background-color: #475569 !important; }

/* ── 10. Нижняя мобильная навигация ── */
html.dark nav.fixed.bottom-0          { background-color: #1e293b !important; border-color: #334155 !important; }

/* ── 11. Скроллбары в тёмной теме ── */
html.dark ::-webkit-scrollbar-thumb  { background: #475569; }
html.dark ::-webkit-scrollbar-track  { background: #0f172a; }

/* ── 12. Переключатель темы ── */
.dark-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease !important;
    flex-shrink: 0;
}
.dark-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease !important;
}
html.dark .dark-toggle              { background: var(--crm-primary, #2563eb); }
html.dark .dark-toggle::after       { transform: translateX(16px); }

/* ── 13. MAX Messenger Icon ── */
.messenger-max-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask: url('/public/assets/img/messengers/max.svg') center / contain no-repeat;
    mask: url('/public/assets/img/messengers/max.svg') center / contain no-repeat;
}



/* ── Чистый белый скругленный фон логотипа во всех темах ── */
.crm-sidebar-logo,
html.dark .crm-sidebar-logo,
aside .crm-sidebar-logo,
html.dark aside .crm-sidebar-logo {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}
