/* GitHub Copilot: ВСЕГДА используйте .github/promt.md для понимания архитектуры проекта */
/* Этот файл - основные стили Bootstrap + кастомные для веб-интерфейса */

/* Основные стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* Улучшенная читаемость для обычного контента */
.container, .container-fluid {
    color: #212529;
}

/* Заголовки */
h1:not(.stats-card h1):not(.navbar h1) {
    color: #212529 !important;
    font-weight: 600;
}

h2:not(.stats-card h2):not(.navbar h2),
h3:not(.stats-card h3):not(.navbar h3),
h4:not(.stats-card h4):not(.navbar h4),
h5:not(.stats-card h5):not(.navbar h5),
h6:not(.stats-card h6):not(.navbar h6) {
    color: #495057 !important;
    font-weight: 600;
}

/* Обычный текст */
.card:not(.stats-card) h1,
.card:not(.stats-card) h2,
.card:not(.stats-card) h3,
.card:not(.stats-card) h4,
.card:not(.stats-card) h5,
.card:not(.stats-card) h6 {
    color: #212529 !important;
}

.card:not(.stats-card) p,
.card:not(.stats-card) span:not(.badge),
.card:not(.stats-card) div:not(.btn) {
    color: #495057 !important;
}

/* Навигация */
.navbar-brand {
    font-weight: bold;
    color: #ffffff !important;
}

.navbar-nav .nav-link {
    border-radius: 0.375rem;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    color: #ffffff !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
    font-weight: 600;
}

/* Счетчик уведомлений */
.badge-notification {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 1.5rem;
    height: 1.5rem;
    line-height: 1.3;
    text-align: center;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Карточки */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.card-body {
    background-color: #ffffff !important;
    color: #212529 !important;
}

/* Кнопки */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff !important;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #ffffff !important;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
    color: #ffffff !important;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
    color: #ffffff !important;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000000 !important;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: #000000 !important;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff !important;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    color: #ffffff !important;
}

.btn-group .btn {
    border-radius: 0.375rem;
}

/* Алерты */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-success {
    color: #0f5132 !important;
    background-color: #d1e7dd !important;
}

.alert-danger {
    color: #842029 !important;
    background-color: #f8d7da !important;
}

.alert-warning {
    color: #664d03 !important;
    background-color: #fff3cd !important;
}

.alert-info {
    color: #055160 !important;
    background-color: #d1ecf1 !important;
}

/* Таблицы */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05rem;
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.025);
}

.table th {
    color: #495057 !important;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    color: #212529 !important;
    vertical-align: middle;
}

.table-dark th,
.table-dark td {
    color: #ffffff !important;
}

/* Формы */
.form-control, .form-select {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.input-group .form-control:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
}

.input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
}

.form-control {
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    color: #495057 !important;
    background-color: #ffffff !important;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    color: #495057 !important;
    background-color: #ffffff !important;
}

.form-label {
    color: #495057 !important;
    font-weight: 500;
}

/* Бейджи */
.badge {
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.8em;
}

/* Статистические карточки */
.card.bg-primary:hover,
.card.bg-success:hover,
.card.bg-warning:hover,
.card.bg-info:hover,
.card.bg-danger:hover {
    transform: translateY(-3px);
}

.card .card-footer a {
    text-decoration: none;
    font-weight: 500;
}

.card .card-footer a:hover {
    text-decoration: underline;
}

/* Чат */
#messages-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 0.5rem;
    padding: 1rem;
}

#messages-container::-webkit-scrollbar {
    width: 6px;
}

#messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#messages-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Сообщения в чате */
.bg-light {
    background-color: #ffffff !important;
    border: 1px solid #e9ecef;
    color: #212529 !important;
}

.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
}

/* Стили для сообщений в чате */
.message-user {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border: 1px solid #e9ecef;
}

.message-admin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
}

.message-admin .text-light,
.message-admin .btn-outline-light {
    color: rgba(255, 255, 255, 0.8) !important;
}

.message-admin .btn-outline-light:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.message-text {
    color: inherit !important;
}

/* Дополнительные стили для чата */
.message-admin .message-text {
    font-weight: 500;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-user .message-text {
    color: #212529 !important;
}

/* Улучшенные стили для контейнера сообщений */
#messages-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 0.5rem;
    padding: 1rem;
}

/* Стили для времени и индикаторов */
.message-admin .text-light {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.8rem;
}

.message-user .text-muted {
    color: #6c757d !important;
    font-size: 0.8rem;
}

/* Улучшенные кнопки для сообщений админа */
.message-admin .btn-outline-light {
    color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    background-color: transparent;
}

.message-admin .btn-outline-light:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
}

/* Стили для редактирования сообщений */
.edit-input {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #212529 !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
}

.edit-input:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Анимации для сообщений */
.message-admin,
.message-user {
    transition: all 0.3s ease;
}

.message-admin:hover,
.message-user:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Статус индикаторы для Telegram */
.bi-telegram {
    color: rgba(255, 255, 255, 0.8) !important;
}

.message-user .bi-telegram {
    color: #0088cc !important;
}

/* Темная тема (опционально) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .card {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    
    .table {
        color: #ffffff;
    }
    
    .form-control {
        background-color: #2d2d2d;
        color: #ffffff;
        border-color: #404040;
    }
    
    .form-control:focus {
        background-color: #2d2d2d;
        color: #ffffff;
    }
}

/* Специальные классы */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.border-custom {
    border: 1px solid #e9ecef;
}

/* Кастомные утилиты */
.cursor-pointer {
    cursor: pointer;
}

.transition-all {
    transition: all 0.3s ease;
}

/* Статус индикаторы */
.status-online {
    width: 10px;
    height: 10px;
    background-color: #28a745;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-offline {
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

/* Прелоадер */
.spinner-custom {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Исправления для черного фона и цветов */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.navbar-brand {
    font-weight: bold;
    color: #ffffff !important;
}

.navbar-nav .nav-link {
    border-radius: 0.375rem;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    color: #ffffff !important;
}

.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
    background-color: #ffffff !important;
    color: #212529 !important;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.75rem 0.75rem 0 0 !important;
    font-weight: 600;
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.card-body {
    background-color: #ffffff !important;
    color: #212529 !important;
}

/* Исправления для форм */
.form-control, .form-select {
    background-color: #ffffff !important;
    color: #212529 !important;
    border: 1px solid #ced4da !important;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Исправления для таблиц */
.table {
    background-color: #ffffff !important;
    color: #212529 !important;
}

.table td, .table th {
    background-color: #ffffff !important;
    color: #212529 !important;
}

/* Исправления для текста */
.text-dark, .text-body {
    color: #212529 !important;
}

.text-muted {
    color: #6c757d !important;
}

/* Логотип */
.navbar-brand img {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    filter: brightness(0) invert(1);
}

/* WebSocket индикатор подключения */
.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1050;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.connection-status.connected {
    background-color: #28a745;
    color: #ffffff;
}

.connection-status.disconnected {
    background-color: #dc3545;
    color: #ffffff;
}

.connection-status.connecting {
    background-color: #ffc107;
    color: #212529;
}

/* Анимация для новых сообщений */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.new-message {
    animation: messageSlideIn 0.3s ease-out;
}

/* Улучшенные стили чата */
#messages-container .message-user,
#messages-container .message-admin {
    margin-bottom: 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

/* Pulse анимация для новых сообщений */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

.message-pulse {
    animation: pulse 1s ease-in-out;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}

/* Статистические карточки */
.stats-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: #ffffff !important;
}

.stats-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
    transform: translateY(-3px);
}

.stats-card .card-body {
    color: #ffffff !important;
}

.stats-card .card-body h1,
.stats-card .card-body h2,
.stats-card .card-body h3,
.stats-card .card-body h4,
.stats-card .card-body h5,
.stats-card .card-body h6 {
    color: #ffffff !important;
    font-weight: bold;
    font-size: 2.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-bottom: 0;
}

.stats-card .card-body p {
    color: #ffffff !important;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0;
}

.stats-card .card-body span {
    color: #ffffff !important;
}

.stats-card .card-body div {
    color: #ffffff !important;
}

.stats-card .card-footer {
    background-color: rgba(0, 0, 0, 0.1) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.stats-card .card-footer a {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: all 0.3s ease;
}

.stats-card .card-footer a:hover {
    color: #ffffff !important;
    opacity: 0.8;
}

.stats-card i.fs-1 {
    color: #ffffff !important;
    opacity: 0.8;
}

/* Специальные цвета для карточек */
.stats-card.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important;
}

.stats-card.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e6a700 100%) !important;
}

.stats-card.bg-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%) !important;
}

.stats-card.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #087990 100%) !important;
}

/* Улучшенная читаемость */
.text-muted {
    color: #6c757d !important;
}

.badge {
    font-weight: 600;
    font-size: 0.8em;
}

/* Таблицы */
.table {
    color: #212529 !important;
}

.table th {
    color: #495057 !important;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    color: #212529 !important;
    vertical-align: middle;
}

.table-dark th,
.table-dark td {
    color: #ffffff !important;
}

/* Формы */
.form-control {
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    color: #495057 !important;
    background-color: #ffffff !important;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    color: #495057 !important;
    background-color: #ffffff !important;
}

.form-label {
    color: #495057 !important;
    font-weight: 500;
}

/* Алерты */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-success {
    color: #0f5132 !important;
    background-color: #d1e7dd !important;
}

.alert-danger {
    color: #842029 !important;
    background-color: #f8d7da !important;
}

.alert-warning {
    color: #664d03 !important;
    background-color: #fff3cd !important;
}

.alert-info {
    color: #055160 !important;
    background-color: #d1ecf1 !important;
}

/* Чат и сообщения */
.message-container {
    max-height: 600px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: #212529 !important;
}

.message-user {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.message-admin {
    background-color: #f3e5f5;
    border-left: 4px solid #9c27b0;
}

.message-time {
    font-size: 0.8rem;
    color: #6c757d !important;
    margin-top: 0.25rem;
}

/* Список пользователей */
.user-card {
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
    background-color: #ffffff;
    color: #212529 !important;
}

.user-card:hover {
    border-color: #adb5bd;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.user-name {
    color: #495057 !important;
    font-weight: 600;
}

.user-message-preview {
    color: #6c757d !important;
    font-size: 0.9rem;
}

/* Счетчики непрочитанных */
.unread-count {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 1.25rem;
    height: 1.25rem;
    line-height: 1.1;
    text-align: center;
    border-radius: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Экстренное исправление видимости текста */
.bg-primary h4,
.bg-primary p,
.bg-success h4,
.bg-success p,
.bg-warning h4,
.bg-warning p,
.bg-info h4,
.bg-info p {
    color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.bg-primary,
.bg-success,
.bg-warning,
.bg-info {
    color: #ffffff !important;
}

.bg-primary *,
.bg-success *,
.bg-warning *,
.bg-info * {
    color: #ffffff !important;
}

/* Страница входа */
.login-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.login-card {
    background-color: #ffffff !important;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.login-card .card-body {
    background-color: #ffffff !important;
    color: #212529 !important;
    padding: 3rem !important;
}

.login-card h2 {
    color: #212529 !important;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-card p.text-muted {
    color: #6c757d !important;
    font-size: 1rem;
}

.login-card .form-label {
    color: #495057 !important;
    font-weight: 600;
}

.login-card .form-control {
    background-color: #f8f9fa !important;
    border: 2px solid #e9ecef;
    color: #495057 !important;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.login-card .form-control:focus {
    background-color: #ffffff !important;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    color: #212529 !important;
}

.login-card .input-group-text {
    background-color: #e9ecef;
    border: 2px solid #e9ecef;
    color: #495057;
}

.login-card .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff !important;
    font-weight: 600;
    padding: 0.75rem;
    font-size: 1.1rem;
}

.login-card .btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #ffffff !important;
}

.login-card small.text-muted {
    color: #6c757d !important;
}

.login-card .bi-robot {
    color: #0d6efd !important;
}