/* Улучшение навбара */
.navbar {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Принудительная одна строка */
.navbar .container-fluid {
    flex-wrap: nowrap !important;
}

/* === Стили для обрезки текста === */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tiny-text {
    font-size: 0.75rem;
}

/* ───── Footer ───── */
.footer-link:hover,
.footer-link:focus {
  color: var(--bs-body-color) !important;
  text-decoration: underline !important;
}

/* Safe area для PWA (home indicator на iPhone, Android gesture bar) */
footer {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ───── Кнопка "Назад" ───── */
/* Убираем на страницах где history.length <= 1 — нет куда возвращаться */
.btn-back-mobile {
  transition: opacity 0.2s ease;
}

/* Отступ снизу чтобы fixed-кнопка не перекрывала контент страницы */
@media (max-width: 991.98px) {
  #content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* === Стили для имени пользователя/команды === */
.context-name {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;

    /* На мобильных (по умолчанию) */
    max-width: 70px;
    font-size: 0.85rem;
}

/* На планшетах и десктопах */
@media (min-width: 768px) {
    .context-name {
        max-width: 150px;
        font-size: 1rem;
    }
}

/* Дополнительные твики для мобильного заголовка */
@media (max-width: 767.98px) {
    /* Чтобы навбар не скакал по высоте */
    .navbar-brand, .navbar-nav .nav-link {
        font-size: 1rem;
    }
}

/* Области нажатия */
.nav-link, .dropdown-item {
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
}
.dropdown-item i {
    width: 1.5rem;
    text-align: center;
}
.btn-link:focus, .btn-link:active {
    box-shadow: none;
}

/* Увеличение размера кнопок тулбара и иконок внутри них */
.toolbar-left .btn-group .btn {
    min-width: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.toolbar-left .btn-group .btn i {
    font-size: 1.2rem;
}

/* === Кастомные сообщения === */
.custom-messages {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 1050;
    max-width: 360px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.custom-message {
    padding: 14px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.custom-message.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

/* Типы сообщений */
.custom-message.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    border-left-color: #28a745 !important;
    color: #155724 !important;
}

.custom-message.success .message-icon {
    color: #28a745 !important;
}

.custom-message.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%) !important;
    border-left-color: #dc3545 !important;
    color: #721c24 !important;
}

.custom-message.error .message-icon {
    color: #dc3545 !important;
}

.custom-message.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%) !important;
    border-left-color: #ffc107 !important;
    color: #856404 !important;
}

.custom-message.warning .message-icon {
    color: #ffc107 !important;
}

.custom-message.info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%) !important;
    border-left-color: #17a2b8 !important;
    color: #0c5460 !important;
}

.custom-message.info .message-icon {
    color: #17a2b8 !important;
}

.custom-message .message-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.custom-message .message-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.custom-message .btn-close {
    opacity: 0.6;
    flex-shrink: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    margin-top: -2px;
    transition: all 0.2s ease;
}

.custom-message .btn-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.2);
}

/* Адаптивность для мобильных */
@media (max-width: 575.98px) {
    .custom-messages {
        top: 70px;
        right: 8px;
        left: 8px;
        max-width: none;
    }
}