html {
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f1f5f9;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 10px;
  box-shadow:
    inset 0 0 6px rgba(0, 0, 0, 0.1),
    0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
  box-shadow:
    inset 0 0 6px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.2);
}

body {
  -ms-overflow-style: scrollbar;
}

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --gray: #95a5a6;
    --border: #e0e0e0;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

body {
    background-color: #e6e6fa;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-top: 70px;
}

/* Навигационная панель */
.navbar {
    background-color: var(--dark);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0.8rem 1rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem !important;
    border-radius: 4px;
    transition: var(--transition);
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Карточки */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 0;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Кнопки */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

body .btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

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

.btn-success {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background-color: #f5f5f5;
}

/* Формы */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.1);
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    z-index: 10;
}

.form-control.with-icon {
    padding-left: 45px;
}

/* Заявки */
.ticket-card {
    box-shadow: inset 2px 0 0 var(--primary),
                0 2px 6px rgba(0,0,0,0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.ticket-card:hover {
    box-shadow: inset 3px 0 0 var(--primary-dark),
                0 4px 12px rgba(0,0,0,0.1);
}

.ticket-card:hover {
    background-color: #f8f9ff;
}

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

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Исправленное модальное окно добавления пользователя */
#add-user-modal.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
}

#add-user-modal.modal-overlay[style*="display: flex"] {
    display: flex !important;
}

#add-user-modal .modal-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: scale(1);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 10000;
    animation: modalSlideIn 0.3s ease;
}

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

#add-user-modal .modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

#add-user-modal .modal-body {
    padding: 1.5rem;
    background: white;
}

#add-user-modal .modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

#add-user-modal .modal-close:hover {
    color: #343a40;
    background: rgba(0,0,0,0.05);
}

/* Bootstrap модальные окна */
.modal-backdrop {
    z-index: 9990 !important;
}

.modal {
    z-index: 9995 !important;
}

/* Аватарки (общие) */
.avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

main .avatar.bg-light {
    background-color: var(--bs-gray-200) !important;
}

/* Уведомления */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-alert-toast {
    animation: fadeIn 0.3s ease forwards;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 350px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Общие стили для текста */
.text-wrap {
    white-space: normal !important;
}

.text-break {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

/* Стили для таблицы с заявками */
.table-responsive {
    overflow-x: auto;
}

#tickets-content td, #tickets-content th {
    vertical-align: middle;
}

/* Стили для длинных текстов в карточках */
.card-body p {
    word-break: break-word;
    margin-bottom: 0;
}

/* Ограничение ширины для статусного бейджа */
.status-badge-container {
    max-width: 200px;
    text-align: right;
}

.status-badge {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}

/* Стили для блока пользователя в навбаре */
.navbar-user {
    padding: 0.5rem;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);
    height: 100%;
}

.navbar-user .avatar {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.btn.btn-outline.btn-sm {
    border-radius: 5px;
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    background-color: var(--bs-gray-200);
}

.btn.btn-outline.btn-sm:hover {
    background-color: var(--bs-gray-300);
}

.btn.btn-sm.btn-outline.filter-item.text-start.active {
    border-color: var(--bs-dark-border-subtle);
    background-color: var(--bs-gray-400);
}

.flex-shrink-0 {
   align-self: start;
   margin-top: 5px;
}

.avatar .fas.fa-user {
    font-size: 10px;
}

.navbar .dropdown-menu {
    background: var(--dark);
    right: 0;
    left: auto;
    margin-top: .125rem;
}

.navbar .dropdown-item {
    color: rgba(255, 255, 255, .55);
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    color: rgba(255, 255, 255, .75);
    background: rgba(255, 255, 255, .15);
}

@media (min-width: 992px) {
  .navbar .nav-item.dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .navbar .dropdown-menu {
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
  }

  /* Отключаем стандартное поведение Bootstrap по клику */
  .navbar .nav-item.dropdown .dropdown-toggle[data-bs-toggle="dropdown"] {
    pointer-events: none;
  }

  .navbar .nav-item.dropdown:hover .dropdown-toggle[data-bs-toggle="dropdown"] {
    pointer-events: auto;
  }
}

/* Кастомный тултип */
.notification-icon {
    position: relative;
    color: rgba(255, 255, 255, 0.75);
    transition: all 0.3s ease;
}

.notification-icon:hover {
    color: white;
}

.notification-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    padding: 8px 12px;
    background-color: var(--dark);
    color: rgba(255, 255, 255, .55);
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    white-space: nowrap;
    transform: translateY(5px);
    transform: translateX(50%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification-icon:hover .notification-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transform: translateX(50%);
}

/* Настройки */
.settings-card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.settings-card .card-header {
    border-radius: 8px 8px 0 0 !important;
    font-weight: 500;
}

.notification-icon {
    cursor: pointer;
}

.card-header.notifications, .modal-header.attachments, .modal-header.fileHeader {
    background-color: var(--dark);
}

.settings-btn {
    min-width: 220px;
    padding: 8px 16px;
}

.btn-group-settings {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .btn-group-settings {
        flex-direction: column;
    }

    .settings-btn {
        width: 100%;
    }
}

.text-muted a {
    text-decoration: none;
    color: inherit;
    font-weight: bold;
}

/* Анимации и фон для модального окна вложений */
#attachmentModal {
    --modal-animation-duration: 0.3s;
    animation: fadeIn var(--modal-animation-duration) ease-out;
}

/* Градиентный заголовок */
.bg-gradient-primary {
    background: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%);
}

/* Кастомный скролл */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* Эффекты при наведении */
#downloadAttachment:hover {
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

/* Загрузочный оверлей */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

/* Адаптивные отступы */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem auto;
    }
}

/* Тень для контента */
.carousel-inner {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 10px;
    background-color: var(--bs-gray-400);
}

/* Плавные переходы */
.carousel-item {
    transition: transform 0.6s ease-in-out;
}

/* Карусель и контролы */
#attachmentCarousel {
    position: relative;
    padding: 40px 50px 0 50px;
}

.carousel-control-prev,
.carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    opacity: 0.7;
    transition: opacity 0.3s;
    z-index: 5;
}

.carousel-control-prev {
    left: 5px;
}

.carousel-control-next {
    right: 5px;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
    background: rgba(0,0,0,0.3);
}

/* Особые стили для разных типов контента */
.audio-controls {
    position: relative;
    z-index: 10;
}

.video-controls {
    position: relative;
    z-index: 10;
}

#attachmentCarousel .carousel-control-prev,
#attachmentCarousel .carousel-control-next {
    opacity: 0;
}

#attachmentCarousel:hover .carousel-control-prev,
#attachmentCarousel:hover .carousel-control-next {
    opacity: 0.7;
}

@media (max-width: 768px) {
    .modal-xl .modal-content.border-0.shadow-lg {
        align-self: center !important;
    }

    #attachmentCarousel .carousel-control-prev,
    #attachmentCarousel .carousel-control-next {
        opacity: 0.7 !important;
    }
}

/* Гарантируем, что будет только один бэкдроп */
.modal-backdrop {
    display: none !important;
}

.modal-backdrop.show {
    display: block !important;
}

/* Фикс для затемнения */
body.modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}

.collapse-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

#fileCounter {
    align-self: center;
}

.btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
}

.modal-footer.bg-light {
    border-radius: 15px;
}

.modal-xl .modal-content.border-0.shadow-lg {
    box-shadow: none;
    background-color: unset;
}

.modal-xl .modal-content.border-0.shadow-lg {
    box-shadow: none !important;
    background-color: unset;
    align-self: start;
}

.d-flex.direction-column {
    flex-direction: column;
}

.full-width {
    width: 100%;
    align-items: center;
    margin-bottom: 10px;
}

/* Стили для страниц ошибок */
.error-template {
    padding: 40px 15px;
    animation: fadeIn 0.5s ease;
}

.error-template h1 {
    font-size: 8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.error-template h2 {
    color: #555;
    margin-bottom: 2rem;
}

.error-details {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    margin: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.error-details p {
    margin-bottom: 0.5rem;
    color: #666;
}

.error-details p:last-child {
    margin-bottom: 0;
}

.error-actions .btn {
    margin: 0 5px;
    padding: 0.75rem 2rem;
}

@media (max-width: 768px) {
    .error-template h1 {
        font-size: 6rem;
    }

    .error-actions .btn {
        display: block;
        margin: 10px auto;
        width: 100%;
        max-width: 300px;
    }
}

.status-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
