/* Стоокс - Пользовательские стили */

/* Основные переменные */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Общие стили */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Улучшенная навигация */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin: 0 2px;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* Карточки */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-header {
    background-color: rgba(102, 126, 234, 0.05);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 12px 12px 0 0 !important;
}

/* Кнопки */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Формы */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Таблицы */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--light-color);
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* Бейджи */
.badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
}

/* Статусы клиентов */
.bg-demo {
    background-color: #fff3cd !important;
    color: #856404 !important;
}

/* Алерты */
.alert {
    border: none;
    border-radius: 10px;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
    background-color: #d1edff;
    color: #0c5460;
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    border-left-color: var(--warning-color);
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    border-left-color: var(--info-color);
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Модальные окна */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0 0 12px 12px;
}

/* Дашборд карточки */
.dashboard-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.dashboard-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.dashboard-card .card-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Загрузчики */
.spinner-custom {
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Улучшения для мобильных устройств */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-bottom: 5px;
        border-radius: 8px !important;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* Темная тема (опционально) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .card {
        background-color: #2d2d2d;
        color: #ffffff;
    }
    
    .table {
        color: #ffffff;
    }
    
    .table thead th {
        background-color: #3d3d3d;
        color: #ffffff;
    }
}

/* Кастомные утилиты */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
}

.border-custom {
    border: 2px solid rgba(102, 126, 234, 0.2);
}

/* Улучшения для печати */
@media print {
    .navbar,
    .btn,
    .alert,
    .modal {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
}

/* Скрытые элементы */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* === УЛУЧШЕНИЯ ДЛЯ ИКОНОК И КНОПОК === */

/* Единообразные иконки Bootstrap Icons */
.bi {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* Кликабельные карточки на дашборде */
a.text-decoration-none .card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
}

a.text-decoration-none .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Активный эффект при клике */
a.text-decoration-none .card:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Обеспечиваем, что текст остается читаемым при наведении */
a.text-decoration-none:hover .card .text-white {
    color: inherit !important;
}

/* Кнопки действий в таблицах */
.btn-group-sm .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.2;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-group-sm .btn i {
    font-size: 14px;
    line-height: 1;
}

/* Выравнивание иконок в кнопках */
.btn i {
    vertical-align: middle;
    line-height: 1;
}

/* Небольшие отступы для текста после иконок */
.btn i + span,
.btn i + text {
    margin-left: 0.25rem;
}

/* Заголовки с иконками */
h1 i, h2 i, h3 i, h4 i, h5 i, h6 i {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Иконки в navbar */
.navbar-nav .nav-link i {
    margin-right: 0.375rem;
    vertical-align: middle;
    font-size: 1rem;
}

/* Иконки в картах */
.card-title i {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Иконки в алертах */
.alert i {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Иконки в модальных заголовках */
.modal-title i {
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Особое выравнивание для btn-group */
.btn-group .btn {
    position: relative;
    overflow: hidden;
}

.btn-group .btn:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Исправление выравнивания для disabled кнопок */
.btn:disabled i,
.btn.disabled i {
    opacity: 0.6;
}

/* Статусные иконки в таблицах */
.table td i.text-success,
.table td i.text-info,
.table td i.text-warning,
.table td i.text-danger {
    font-size: 12px;
    vertical-align: baseline;
}

/* Иконки Telegram */
.bi-telegram {
    color: #0088cc;
}

/* Размеры иконок */
.icon-sm {
    font-size: 12px;
}

.icon-md {
    font-size: 16px;
}

.icon-lg {
    font-size: 20px;
}

.icon-xl {
    font-size: 24px;
}

/* Центрирование содержимого в ячейках таблицы */
.table .text-center {
    vertical-align: middle;
}

/* Улучшения для группы кнопок на мобильных */
@media (max-width: 576px) {
    .btn-group-sm .btn {
        min-width: 32px;
        height: 32px;
        padding: 0.25rem 0.375rem;
    }
    
    .btn-group-sm .btn i {
        font-size: 12px;
    }
    
    /* На мобильных делаем кнопки вертикальными для экономии места */
    .btn-group-vertical-mobile {
        flex-direction: column;
    }
    
    .btn-group-vertical-mobile .btn {
        border-radius: 4px !important;
        margin-bottom: 2px;
    }
}

/* Анимации для кнопок */
.btn {
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Улучшения для tooltip */
.btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

/* Постоянные алерты (не исчезают) */
.alert-permanent {
    /* Специальный класс для алертов, которые не должны автоматически скрываться */
    position: relative;
}

.alert-permanent .btn-close {
    display: none;
}

/* Липкие элементы в модальных окнах */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ========================================
   АВТОЗАПОЛНЕНИЕ ПОЛЕЙ - ВИЗУАЛЬНЫЕ ИНДИКАТОРЫ
   ======================================== */

/* Поля, заполненные автоматически */
.form-control.auto-filled,
.form-select.auto-filled {
    background-color: #e7f5e7 !important;
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
    position: relative;
}

.form-control.auto-filled:focus,
.form-select.auto-filled:focus {
    background-color: #e7f5e7 !important;
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Иконка галочки для заполненных полей */
.form-control.auto-filled + .auto-fill-indicator,
.form-select.auto-filled + .auto-fill-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #28a745;
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
}

/* Для input-group */
.input-group .form-control.auto-filled + .auto-fill-indicator {
    right: 50px; /* Учитываем кнопку поиска */
}

/* Поля, которые нуждаются в заполнении */
.form-control.needs-attention,
.form-select.needs-attention {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

.form-control.needs-attention:focus,
.form-select.needs-attention:focus {
    background-color: #fff3cd !important;
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

/* Иконка восклицательного знака для полей, требующих внимания */
.form-control.needs-attention + .attention-indicator,
.form-select.needs-attention + .attention-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffc107;
    font-size: 16px;
    pointer-events: none;
    z-index: 5;
}

/* Для input-group */
.input-group .form-control.needs-attention + .attention-indicator {
    right: 50px; /* Учитываем кнопку поиска */
}

/* Анимация при автозаполнении */
.form-control.just-filled,
.form-select.just-filled {
    animation: fillPulse 0.6s ease-in-out;
}

@keyframes fillPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Информационные блоки */
.auto-fill-info {
    background: linear-gradient(135deg, #e7f5e7 0%, #f0fff0 100%);
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auto-fill-info .icon {
    color: #28a745;
    font-size: 20px;
}

.attention-info {
    background: linear-gradient(135deg, #fff3cd 0%, #fffef0 100%);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.attention-info .icon {
    color: #ffc107;
    font-size: 20px;
} 