/* HelpDesk — основные стили */

:root {
    --hd-primary: #4361ee;
    --hd-primary-dark: #3a56d4;
    --hd-gradient: linear-gradient(135deg, #4361ee 0%, #7209b7 100%);
    --hd-bg: #f0f2f5;
    --hd-card-shadow: 0 2px 12px rgba(0,0,0,.08);
    --hd-radius: 12px;
    --hd-radius-sm: 8px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--hd-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

main { flex: 1; }

/* ==================== НАВИГАЦИЯ ==================== */

.hd-navbar {
    background: #fff !important;
    border-bottom: 1px solid rgba(0,0,0,.06);
    padding: .5rem 0;
    z-index: 1030;
}

[data-bs-theme="dark"] .hd-navbar {
    background: #1e1e2e !important;
    border-bottom-color: rgba(255,255,255,.06);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    gap: .5rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--hd-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

.nav-link {
    font-weight: 500;
    font-size: .875rem;
    padding: .5rem .75rem !important;
    border-radius: var(--hd-radius-sm);
    transition: background .15s, color .15s;
}

.nav-link:hover {
    background: rgba(67, 97, 238, .08);
}

.nav-link.active {
    color: var(--hd-primary) !important;
    background: rgba(67, 97, 238, .1);
}

.dropdown-menu-animated {
    border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    border-radius: var(--hd-radius);
    padding: .5rem;
}

.dropdown-item {
    border-radius: var(--hd-radius-sm);
    padding: .5rem .75rem;
    font-size: .875rem;
}

.dropdown-item:hover {
    background: rgba(67, 97, 238, .08);
}

.theme-toggle-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== ЛОГИН ==================== */

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    background: var(--hd-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 8px 24px rgba(67, 97, 238, .3);
}

.card {
    border: none;
    box-shadow: var(--hd-card-shadow);
    border-radius: var(--hd-radius);
}

.rounded-4 {
    border-radius: var(--hd-radius) !important;
}

/* ==================== КАРТОЧКИ СТАТИСТИКИ ==================== */

.stat-card {
    border: none;
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-card-shadow);
    transition: transform .2s, box-shadow .2s;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: .8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ==================== БЕЙДЖИ ==================== */

.badge {
    font-weight: 600;
    font-size: .75rem;
    padding: .35em .65em;
    border-radius: 6px;
}

/* Приоритеты */
.badge-priority-low { background-color: #d1fae5; color: #065f46; }
.badge-priority-medium { background-color: #fef3c7; color: #92400e; }
.badge-priority-high { background-color: #fed7aa; color: #9a3412; }
.badge-priority-critical { background-color: #fecaca; color: #991b1b; }

/* Статусы */
.badge-status-new { background-color: #dbeafe; color: #1e40af; }
.badge-status-in_progress { background-color: #fef3c7; color: #92400e; }
.badge-status-waiting { background-color: #ede9fe; color: #5b21b6; }
.badge-status-done { background-color: #d1fae5; color: #065f46; }
.badge-status-closed { background-color: #e5e7eb; color: #374151; }

/* ==================== SLA ==================== */

.sla-overdue {
    border-left: 4px solid #ef4444 !important;
    animation: sla-pulse 1.5s ease-in-out infinite;
}

.sla-warning {
    border-left: 4px solid #f59e0b !important;
}

@keyframes sla-pulse {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(239, 68, 68, .05); }
}

/* ==================== ТАБЛИЦЫ ==================== */

.table {
    margin-bottom: 0;
}

.table th {
    white-space: nowrap;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    padding: .75rem;
}

.table td {
    vertical-align: middle;
    padding: .75rem;
    font-size: .875rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(67, 97, 238, .04);
}

.table-card {
    background: #fff;
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-card-shadow);
    overflow: hidden;
}

[data-bs-theme="dark"] .table-card {
    background: #1e1e2e;
}

/* ==================== ВКЛАДКИ ==================== */

.status-tabs {
    border: none;
    gap: .25rem;
    margin-bottom: 1rem;
}

.status-tabs .nav-link {
    border: 1px solid #e5e7eb;
    border-radius: 50px !important;
    padding: .4rem 1rem !important;
    font-size: .8rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    transition: all .15s;
}

.status-tabs .nav-link:hover {
    background: rgba(67, 97, 238, .08);
    border-color: var(--hd-primary);
    color: var(--hd-primary);
}

.status-tabs .nav-link.active {
    background: var(--hd-primary);
    border-color: var(--hd-primary);
    color: #fff !important;
}

.status-tabs .badge {
    font-size: .65rem;
    padding: .2em .45em;
    border-radius: 50px;
    margin-left: .25rem;
}

/* ==================== КОММЕНТАРИИ ==================== */

.comment-card {
    border: none;
    border-left: 3px solid var(--hd-primary);
    border-radius: var(--hd-radius-sm);
    margin-bottom: .75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.comment-card.internal {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

[data-bs-theme="dark"] .comment-card.internal {
    background: #2d2a1e;
}

.comment-header {
    font-size: .8rem;
    color: #6b7280;
}

/* ==================== ФИЛЬТРЫ ==================== */

.filter-panel {
    background: #fff;
    border-radius: var(--hd-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--hd-card-shadow);
}

[data-bs-theme="dark"] .filter-panel {
    background: #1e1e2e;
}

/* ==================== ФОРМЫ ==================== */

.form-control, .form-select {
    border-radius: var(--hd-radius-sm);
    padding: .5rem .75rem;
    font-size: .875rem;
    border-color: #e5e7eb;
}

.form-control:focus, .form-select:focus {
    border-color: var(--hd-primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, .15);
}

.input-group-text {
    border-radius: var(--hd-radius-sm);
    border-color: #e5e7eb;
    font-size: .875rem;
}

/* ==================== КНОПКИ ==================== */

.btn-primary {
    background: var(--hd-primary);
    border-color: var(--hd-primary);
    border-radius: var(--hd-radius-sm);
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--hd-primary-dark);
    border-color: var(--hd-primary-dark);
}

.btn {
    border-radius: var(--hd-radius-sm);
    font-size: .875rem;
    font-weight: 500;
}

/* ==================== ФАЙЛЫ ==================== */

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .35rem .75rem;
    margin: .15rem;
    background: #f3f4f6;
    border-radius: 6px;
    text-decoration: none;
    font-size: .8rem;
    color: #374151;
    transition: background .15s;
}

.attachment-link:hover {
    background: #e5e7eb;
    color: var(--hd-primary);
}

/* ==================== МОДАЛЬНЫЕ ОКНА ==================== */

.modal-content {
    border: none;
    border-radius: var(--hd-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.modal-header {
    border-bottom-color: #f3f4f6;
}

.modal-footer {
    border-top-color: #f3f4f6;
}

/* ==================== CSV ИМПОРТ ==================== */

.import-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: var(--hd-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #fafbfc;
}

.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--hd-primary);
    background: rgba(67, 97, 238, .03);
}

/* ==================== ОПИСАНИЕ ЗАЯВКИ ==================== */

.ticket-description {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f9fafb;
    padding: 1rem;
    border-radius: var(--hd-radius-sm);
    font-size: .9rem;
    line-height: 1.6;
}

[data-bs-theme="dark"] .ticket-description {
    background: #262636;
}

/* ==================== ФУТЕР ==================== */

.hd-footer {
    background: #fff;
}

[data-bs-theme="dark"] .hd-footer {
    background: #1e1e2e;
}

/* ==================== ПАГИНАЦИЯ ==================== */

.page-link {
    border-radius: var(--hd-radius-sm) !important;
    margin: 0 .15rem;
    font-size: .85rem;
    font-weight: 500;
}

.page-item.active .page-link {
    background: var(--hd-primary);
    border-color: var(--hd-primary);
}

/* ==================== УТИЛИТЫ ==================== */

.text-gradient {
    background: var(--hd-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bg-gradient-primary {
    background: var(--hd-gradient) !important;
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 768px) {
    .stat-card .stat-number {
        font-size: 1.4rem;
    }

    .filter-panel {
        padding: .75rem;
    }

    main {
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }
}

@media (max-width: 576px) {
    .table-responsive {
        font-size: .8rem;
    }
}
