.avatar {
    width: 150px;
    height: 150px;
    object-fit: cover;
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.navbar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 991px) {
    .navbar-logo {
        height: 30px;
    }
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    padding-top: 76px;
    /* Высота фиксированного navbar */
}


@media (max-width: 768px) {
    .navbar-collapse {
        margin: 10px 0;
    }

    .navbar-nav .dropdown-menu {
        position: absolute;
    }

    .navbar-logo {
        height: 35px;
    }
}

/* Улучшение для выпадающего меню */
.dropdown-menu {
    min-width: 200px;
}

.navbar-brand {
    margin-right: 1rem;
}

/* Стили для ссылок в навбаре */
.navbar-nav .nav-item {
    display: flex !important;
    align-items: center !important;
}

.navbar-nav .nav-link {
    font-weight: 600 !important;
    color: #333 !important;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
    margin: 0 0.25rem;
    position: relative;
    border-bottom: 3px solid transparent;
    display: flex !important;
    align-items: center !important;
}

.navbar-nav .nav-link:hover {
    color: #667eea !important;
}

.navbar-nav .nav-link.active {
    color: #667eea !important;
    border-bottom: 3px solid #667eea;
}

.text-brand-blue {
    color: #1e88e5 !important;
}

/* Стили для сообщений */
.message-own {
    background-color: #E8F5E9; /* Светло-зеленый */
    color: #333;
    border-radius: 18px 18px 18px 4px;
}

.message-other {
    background-color: #FFF4E6; /* Светло-оранжевый */
    color: #333;
    border-radius: 18px 18px 18px 4px;
}

.message-content {
    word-wrap: break-word;
}

/* Липкий сайдбар */
.sticky-sidebar {
    position: sticky;
    top: 76px; /* Высота navbar */
    align-self: flex-start;
}

/* Фиксированный сайдбар с фильтрами для задач и услуг */
.sticky-sidebar-filters {
    position: sticky;
    top: 76px; /* Высота navbar */
    align-self: flex-start;
    max-height: calc(100vh - 96px); /* Высота экрана минус навбар и отступы */
    overflow-y: auto;
    padding-bottom: 20px; /* Отступ снизу для удобства прокрутки */
}

/* Стилизация скроллбара для сайдбара фильтров */
.sticky-sidebar-filters::-webkit-scrollbar {
    width: 6px;
}

.sticky-sidebar-filters::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sticky-sidebar-filters::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.sticky-sidebar-filters::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Фоновые цвета для блоков сайдбара */
.sidebar-block-1 {
    background-color: #E8F5E9; /* Светло-зеленый */
    border: none !important;
    border-radius: 0 !important;
}

.sidebar-block-2 {
    background-color: #E3F2FD; /* Светло-голубой */
    border: none !important;
    border-radius: 0 !important;
}

.sidebar-block-3 {
    background-color: #FFF3E0; /* Светло-оранжевый */
    border: none !important;
    border-radius: 0 !important;
}

.sidebar-block-4 {
    background-color: #F3E5F5; /* Светло-фиолетовый */
    border: none !important;
    border-radius: 0 !important;
}

/* Градиент для кнопок */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    color: white !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%) !important;
    color: white !important;
}

.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%) !important;
    color: white !important;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.5) !important;
}

/* Стили для кнопок разделов категорий */
.section-btn {
    background-color: #fff;
    color: var(--bs-card-title-color);
    padding: 8px 15px;
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: left;
    position: relative;
    display: flex;
    min-width: 0;
    word-wrap: break-word;
    flex-shrink: 0;
    white-space: nowrap;
    text-decoration: none;
}

.section-btn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.section-btn::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: #ffffff;
    border-radius: 19px;
    z-index: -1;
}

.section-btn:hover {
    border-color: #667eea;
    color: #667eea;
    text-decoration: none;
}

.section-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #ffffff;
}

.section-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    min-width: 20px;
    width: auto;
    height: auto;
}

.section-icon i {
    font-size: 1.25rem;
    color: inherit;
    display: inline-block;
    line-height: 1;
    visibility: visible;
    opacity: 1;
}

.section-name {
    font-size: 1rem;
    font-weight: 400;
    flex-grow: 1;
}


/* Стили для ссылок категорий */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem 1rem;
}

@media (max-width: 992px) {
    .category-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .category-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

.category-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 1rem;
}

.category-link:hover {
    color: #5568d3;
    text-decoration: none;
}

/* Контейнер категорий */
.categories-container {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 1rem;
    padding-top: 2rem;
}

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


/* Цвет для заголовков на главной странице */
h1, h2, h3, h4, h5, h6 {
    color: #003366;
}

/* Исключение для заголовков в градиентном блоке */
.task-header-gradient h1,
.task-header-gradient h2,
.task-header-gradient h3,
.task-header-gradient h4,
.task-header-gradient h5,
.task-header-gradient h6 {
    color: #ffffff;
}

/* Стили для навбара с новой структурой */
.navbar .container > .d-flex {
    position: relative;
}

.navbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Стили для блока с иконками справа */
.navbar .d-flex.gap-2 {
    gap: 0.5rem !important;
}

.navbar .d-flex.gap-2 > .nav-item {
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link[data-bs-toggle="dropdown"] {
    padding: 0.5rem 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.navbar-nav .nav-link i.bi-envelope {
    color: #333;
    transition: color 0.3s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.navbar-nav .nav-link:hover i.bi-envelope {
    color: #667eea;
}

#messages-badge {
    font-size: 0.7rem;
    padding: 0.2em 0.5em;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Стили для выпадающего меню сообщений */
.messages-dropdown {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 320px;
    max-height: 500px;
    overflow-y: auto;
}

.messages-dropdown .dropdown-header {
    font-weight: 600;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.messages-dropdown-item {
    padding: 0.75rem 1rem;
    transition: background-color 0.2s ease;
    border: none;
    text-decoration: none;
}

.messages-dropdown-item:hover {
    background-color: #f8f9fa;
}

.messages-dropdown-item:active {
    background-color: #e9ecef;
}

.messages-dropdown::-webkit-scrollbar {
    width: 6px;
}

.messages-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 8px 8px 0;
}

.messages-dropdown::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.messages-dropdown::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.25rem 0 !important;
        min-height: 50px !important;
    }
    
    .navbar .container {
        padding: 0 15px !important;
    }
    
    .navbar-brand {
        padding: 0.25rem 0 !important;
        margin: 0 !important;
    }
    
    .messages-dropdown {
        min-width: 280px !important;
        max-width: 90vw;
    }
    
    .navbar-nav .nav-item.dropdown.me-3 {
        margin-right: 0.5rem !important;
    }
    
    .navbar-logo {
        height: 25px;
    }
    
    .navbar-avatar {
        width: 24px;
        height: 24px;
    }
    
    .navbar-nav .nav-link {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.875rem;
    }
    
    .navbar-nav .nav-link i.bi-envelope {
        font-size: 1.1rem;
    }
    
    /* Иконки для входа и регистрации на мобильных */
    .navbar-nav .nav-link i.bi-box-arrow-in-right,
    .navbar-nav .nav-link i.bi-person-plus {
        font-size: 1.25rem;
    }
    
    .navbar-toggler {
        padding: 0.25rem 0.5rem !important;
        border: none;
    }
    
    body {
        padding-top: 50px !important;
    }
    
    /* На мобильных устройствах сайдбар не фиксируется */
    .sticky-sidebar-filters {
        position: relative !important;
        top: 0 !important;
        max-height: none !important;
        overflow-y: visible !important;
    }
}

/* Ограничение описания в карточках услуг и задач (2-3 строки) */
.service-description-card,
.task-description-card {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
    max-height: calc(1.6em * 3); /* Примерная высота для 3 строк */
}

/* Стили для футера */
footer {
    border-top: 1px solid #dee2e6;
    margin-top: auto;
}

footer a {
    transition: color 0.2s ease;
}

footer a:hover {
    color: #667eea !important;
}

footer h5,
footer h6 {
    color: #003366;
}

footer ul.list-unstyled li {
    line-height: 1.8;
}

/* ============================================
   Стили из шаблонов (перенесены из inline и <style>)
   ============================================ */

/* Sticky footer - прижимает футер к низу страницы */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Для страниц без page_header добавляем отступ к контенту */
.main-content-wrapper > .container {
    padding-top: 76px;
}

/* Если в контейнере есть task-header-gradient (главная страница), убираем padding-top */
.main-content-wrapper > .container:has(.task-header-gradient) {
    padding-top: 0 !important;
}

/* Для главной страницы корректируем margin-top градиентного блока для компенсации навбара */
.main-content-wrapper .container .task-header-gradient {
    margin-top: -76px !important; /* Компенсируем весь навбар (76px) */
    margin-bottom: 40px !important; /* Сохраняем нижний отступ */
}

/* Убираем нижний отступ у заголовков на страницах с page_header (не на главной) */
.main-content-wrapper > .task-header-gradient {
    margin-bottom: 0 !important;
}

/* Уменьшаем отступ у контейнера после page_header - минимальный отступ вместо mt-4 */
.main-content-wrapper > .task-header-gradient ~ #main-content-container {
    margin-top: 0 !important;
    padding-top: 31px !important; /* Отступ 16px + 15px = 31px */
}

/* Для страниц без page_header добавляем отступ сверху для навбара */
.main-content-wrapper > #main-content-container:first-child {
    padding-top: 76px; /* Отступ для навбара на страницах без page_header */
}

footer {
    flex-shrink: 0;
}

/* Градиентный блок заголовка */
.task-header-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 60px 0 40px 0;
    margin: -32px calc(-50vw + 50%) 40px calc(-50vw + 50%);
    width: 100vw;
    position: relative;
}

.task-header-gradient.home {
    padding: 100px 0 80px 0;
}

/* Breadcrumb стили */
.breadcrumb-header {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    display: inline-flex;
}

/* Аватары маленькие (40px) */
.avatar-sm {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.avatar-placeholder {
    width: 40px;
    height: 40px;
}

/* Аватары средние (50px) */
.avatar-md {
    width: 50px;
    height: 50px;
    object-fit: cover;
}

.avatar-placeholder-md {
    width: 50px;
    height: 50px;
}

/* Аватары для миниатюр статей (65px) */
.avatar-article {
    width: 65px;
    height: 65px;
    object-fit: cover;
}

/* Аватар большого размера (150px) */
.avatar-lg {
    width: 150px;
    height: 150px;
}

/* Navbar элементы */
.nav-link-icon {
    padding: 0.5rem 0.75rem;
}

.nav-link-user {
    padding: 0.5rem 1rem;
}

.nav-link-register {
    margin-left: 10px !important;
}

.navbar-toggler-custom {
    border: none;
    padding: 0.5rem;
}

/* Badge стили */
.badge-notification {
    top: 2px;
    right: -5px;
    color: #000;
}

.badge-message {
    top: 2px;
    right: -5px;
}

/* Message элементы */
.message-avatar {
    flex-shrink: 0;
}

.message-content-wrapper {
    max-width: 70%;
}

.message-text-truncate {
    max-width: 150px;
}

.message-preview-truncate {
    max-width: 200px;
}

/* Кнопки действий */
.btn-action {
    padding: 12px;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Service cards стили */
.service-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 15px;
    border: 2px solid #e9ecef !important;
    cursor: pointer;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2) !important;
}

.service-card-color-1 {
    background-color: #E8F5E9;
}

.service-card-color-2 {
    background-color: #FFF4E6;
}

.service-card-color-3 {
    background-color: #E3F2FD;
}

.service-card-color-4 {
    background-color: #F3E5F5;
}

.service-card-color-5 {
    background-color: #FFF9E6;
}

.service-card-color-6 {
    background-color: #E0F2F1;
}

.service-card-title {
    color: #667eea;
    font-size: 1.25rem;
}

.service-card-text {
    font-size: 1rem;
    color: #495057;
    line-height: 1.6;
}

/* Секция с фоном */
.section-bg-light {
    background-color: #f8f9fa;
}

/* HR стили */
.hr-white {
    border-color: rgba(255, 255, 255, 0.3);
}

/* Иконки в списке преимуществ */
.feature-icon {
    font-size: 1.5rem;
}

/* Карточка профиля */
.profile-card {
    border-radius: 10px;
    background-color: #ffffff;
    border: 1px solid #e9ecef !important;
}

.profile-card-title {
    color: #667eea;
}

/* Flex элементы */
.flex-shrink-0 {
    flex-shrink: 0;
}

/* Карточки бесед */
.conversation-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.conversation-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Карточки задач */
.task-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 51, 102, 0.15) !important;
}

/* Карточки услуг (для списка услуг) */
.service-list .service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2) !important;
}

/* Радиокнопки выбора типа локации */
.location-type-radio-card {
    transition: all 0.3s ease;
    user-select: none;
    border: 1px solid #dee2e6;
    background-color: #ffffff;
}

.location-type-radio-card:hover {
    background-color: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.location-type-radio-card:has(input[type="radio"]:checked) {
    background-color: #e7f3ff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.location-type-radio-card:has(input[type="radio"]:checked) span {
    font-weight: 600;
    color: #667eea;
}

.location-type-radio-card input[type="radio"] {
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.location-type-radio-card input[type="radio"]:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 50%;
}

.location-type-radio-card span {
    line-height: 1.5;
}
