/* Мобильные стили для TinyMCE */
@media screen and (max-width: 768px) {
    /* Стили для TinyMCE редактора на мобильных */
    .tox-tinymce {
        border-radius: 8px !important;
        max-width: 100% !important;
        font-size: 16px !important; /* Предотвращение zoom на iOS */
    }
    
    .tox-toolbar {
        flex-wrap: wrap !important;
        padding: 4px !important;
    }
    
    .tox-toolbar__group {
        margin: 2px !important;
    }
    
    .tox-tbtn {
        padding: 6px !important;
        margin: 1px !important;
    }
    
    .tox-edit-area {
        border-radius: 0 0 8px 8px !important;
    }
    
    .tox-editor-container {
        max-width: 100% !important;
    }
    
    /* Скрываем statusbar на мобильных */
    .tox-statusbar {
        display: none !important;
    }
    
    /* Fallback для textarea если TinyMCE не загрузился */
    .tinymce-editor {
        width: 100% !important;
        border-radius: 8px !important;
        border: 1px solid #ccc !important;
        padding: 10px !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 16px !important; /* Предотвращает zoom на iOS */
        line-height: 1.4 !important;
    }
}

/* Мобильные стили */
@media screen and (max-width: 768px) {
    /* Основной контейнер для мобильной версии детальной страницы */
    .mobile-detail-page {
        min-height: 100vh;
        background: #F8FAFC;
        padding-bottom: 80px;
        animation: slide-up 0.3s ease-out;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Фиксированная шапка с размытым фоном */
    .detail-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        z-index: 100;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* Секция с основной информацией о задаче */
    .task-info-section {
        margin-top: 8px; /* высота шапки + отступ */
        padding: 20px 16px;
        background: white;
        margin-bottom: 8px;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    /* Остальные стили остаются без изменений ... */
}

/* Глобальные стили для мобильных устройств */
@media screen and (max-width: 768px) {
    /* Сброс стандартных отступов */
    body {
        margin: 0;
        padding: 0;
        background: #F8FAFC;
    }

    /* Предотвращение горизонтальной прокрутки */
    html, body {
        overflow-x: hidden;
        position: relative;
        width: 100%;
    }

    /* Оптимизация размеров кнопок для тач-устройств */
    button, 
    .btn, 
    .dropdown-item {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* Улучшение читаемости текста */
    body {
        font-size: 16px;
        line-height: 1.5;
    }

    /* Адаптивные отступы для контейнеров */
    .container, 
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* Основные стили страницы */
.mobile-detail-page {
    min-height: 100vh;
    background: #F8FAFC;
    padding-bottom: 80px;
    animation: slide-up 0.3s ease-out;
}

/* Анимация появления страницы */
@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для шапки */
.detail-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Стили для кнопок навигации */
.back-button,
.menu-button {
    min-width: 44px;
    min-height: 44px;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 50%;
    transition: background-color 0.2s;
}

/* Эффект при нажатии на кнопки */
.back-button:active,
.menu-button:active {
    background-color: #F1F5F9;
}

/* Заголовок задачи */
.task-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

/* Секция с основной информацией */
.task-info-section {
    padding: 20px 16px;
    background: white;
    margin-bottom: 8px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Название задачи */
.task-name {
    font-size: 24px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 16px;
    line-height: 1.3;
}

/* Секция статусов */
.status-section {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Общие стили для бейджей */
.status-badge,
.priority-badge {
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    transition: transform 0.2s;
}

/* Эффект при нажатии на бейджи */
.status-badge:active,
.priority-badge:active {
    transform: scale(0.95);
}

/* Цветовая схема для разных статусов */
.status-badge.pending { 
    background: #F8FAFC; 
    color: #64748B;
    border: 1px solid #E2E8F0;
}

.status-badge.in_progress { 
    background: #EFF6FF; 
    color: #2563EB;
    border: 1px solid #BFDBFE;
}

.status-badge.paused {
    background: #fff7ed;
    color: #d97706;
    border: 1px solid #fef3c7;
}

.status-badge.review { 
    background: #FEF3C7; 
    color: #B45309;
    border: 1px solid #FDE68A;
}

.status-badge.completed { 
    background: #DCFCE7; 
    color: #16A34A;
    border: 1px solid #BBF7D0;
}

/* Цветовая схема для приоритетов */
.priority-badge.low { 
    background: #F0FDF4;
    color: #16A34A;
    border: 1px solid #BBF7D0;
}

.priority-badge.medium { 
    background: #FEF3C7;
    color: #B45309;
    border: 1px solid #FDE68A;
}

.priority-badge.high { 
    background: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

/* Информация о дедлайне */
.deadline-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748B;
    font-size: 14px;
    padding: 8px 12px;
    background: #F8FAFC;
    border-radius: 8px;
    width: fit-content;
}

/* Секция участников */
.participants-section {
    padding: 16px;
    background: white;
    margin-bottom: 8px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Стили для участника */
.participant {
    flex: 1;
}

/* Метка участника */
.participant-label {
    font-size: 13px;
    color: #64748B;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Информация об участнике */
.participant-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Стили для аватаров */
.avatar,
.avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Заполнитель аватара */
.avatar-placeholder {
    background: linear-gradient(135deg, #E2E8F0, #CBD5E1);
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

/* Секция описания */
.description-section {
    padding: 20px;
    background: white;
    margin-bottom: 8px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Заголовок описания */
.description-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #1E293B;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Иконка в заголовке */
.description-section h3 svg {
    opacity: 0.7;
}

/* Контент описания */
.description-content {
    font-size: 15px;
    line-height: 1.6;
    color: #475569;
}

/* Секция галереи */
.images-section {
    padding: 20px;
    background: white;
    margin-bottom: 8px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Заголовок галереи */
.images-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1E293B;
    margin-bottom: 16px;
}

/* Иконка в заголовке галереи */
.images-section h3 svg {
    opacity: 0.7;
}

/* Сетка изображений */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

/* Элемент изображения */
.image-item {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

/* Эффект при нажатии на изображение */
.image-item:active {
    transform: scale(0.98);
}

/* Само изображение */
.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Секция комментариев */
.comments-section {
    padding: 20px;
    background: white;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

/* Заголовок комментариев */
.comments-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1E293B;
    margin-bottom: 16px;
}

/* Иконка в заголовке комментариев */
.comments-section h3 svg {
    opacity: 0.7;
}

/* Список комментариев */
.comments-list {
    margin-bottom: 20px;
}

/* Элемент комментария */
.comment-item {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #F8FAFC;
    border-radius: 12px;
    animation: fadeIn 0.3s ease-out;
}

/* Анимация появления комментария */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Стиль для собственных комментариев */
.comment-item.own-comment {
    background: #EFF6FF;
    margin-left: 20%;
}

/* Шапка комментария */
.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

/* Автор комментария */
.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: #1E293B;
}

/* Время комментария */
.comment-time {
    font-size: 12px;
    color: #64748B;
}

/* Содержимое комментария */
.comment-content {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
}

/* Форма добавления комментария */
.comment-form {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 16px;
    border-top: 1px solid #E2E8F0;
    z-index: 10;
}

/* Поле ввода комментария */
#commentInput {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    transition: border-color 0.2s ease;
    flex: 1;
    border: none;
    background: none;
    resize: none;
    padding: 8px;
    font-size: 15px;
    max-height: 120px;
    min-height: 40px;
    color: #1E293B;
}

/* Плейсхолдер поля ввода */
#commentInput::placeholder {
    color: #94A3B8;
}

/* Фокус на поле ввода */
#commentInput:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Кнопка отправки комментария */
#sendComment {
    transform: scale(1);
    transition: transform 0.2s ease;
    background: #2563EB;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
}

/* Эффект при нажатии кнопки отправки */
#sendComment:active {
    transform: scale(0.95);
}

/* Общие анимации для интерактивных элементов */
.back-button,
.menu-button,
.status-badge,
.priority-badge,
.image-item,
#sendComment {
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* Состояния при наведении */
.back-button:hover,
.menu-button:hover {
    background-color: #F1F5F9;
}

#sendComment:hover {
    background-color: #1D4ED8;
}

/* Адаптивные стили для маленьких экранов */
@media (max-width: 360px) {
    .task-info-section,
    .participants-section,
    .description-section,
    .images-section,
    .comments-section {
        padding: 16px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .status-badge,
    .priority-badge {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .participant-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .avatar-wrapper {
        margin-bottom: 8px;
    }
}

/* Эффект ripple для интерактивных элементов */
.ripple-effect {
    position: relative;
    overflow: hidden;
}

/* Анимация ripple */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

/* Анимация эффекта ripple */
@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Стили для кастомного дропдауна */
.custom-dropdown {
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
}

/* Элементы дропдауна */
.custom-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    color: #1E293B;
    transition: all 0.2s ease;
}

/* Ховер для элементов дропдауна */
.custom-dropdown .dropdown-item:hover {
    background: #F1F5F9;
}

/* Опасные действия в дропдауне */
.custom-dropdown .dropdown-item.text-danger {
    color: #DC2626;
}

/* Иконки в дропдауне */
.custom-dropdown .dropdown-item svg {
    opacity: 0.7;
}

/* Иконки статусов */
.status-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Цвета иконок статусов */
.status-badge.pending .status-icon { background: #64748B; }
.status-badge.in_progress .status-icon { background: #2563EB; }
.status-badge.paused .status-icon { background: #fc9e2b; }
.status-badge.review .status-icon { background: #B45309; }
.status-badge.completed .status-icon { background: #16A34A; }

/* Детали участников */
.participant-details {
    flex: 1;
}

/* Имя участника */
.participant-name {
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 4px;
}

/* Роль участника */
.participant-role {
    font-size: 13px;
    color: #64748B;
}

/* Стрелка назначения */
.assignment-arrow {
    display: flex;
    justify-content: center;
    padding: 16px 0;
    color: #94A3B8;
}

/* Просмотрщик изображений */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Активное состояние просмотрщика */
.image-viewer.active {
    display: flex;
    animation: fade-in 0.3s ease-out;
}

/* Контент просмотрщика */
.viewer-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

/* Изображение в просмотрщике */
.viewer-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Анимация появления */
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Спиннер загрузки */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* Анимация спиннера */
.loading-spinner::after {
    content: "";
    width: 30px;
    height: 30px;
    border: 3px solid #E2E8F0;
    border-top-color: #2563EB;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

/* Анимация вращения спиннера */
@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* Сообщение об ошибке */
.error-message {
    text-align: center;
    padding: 20px;
    color: #DC2626;
    background: #FEE2E2;
    border-radius: 8px;
    margin: 10px 0;
}

/* Анимации для комментариев */
[data-aos="fade-up"] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Активное состояние анимации */
[data-aos="fade-up"].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* Стили заголовков секций */
.description-section h3,
.images-section h3,
.comments-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1E293B;
    margin-bottom: 16px;
}

/* Иконки в заголовках */
.description-section h3 svg,
.images-section h3 svg,
.comments-section h3 svg {
    opacity: 0.7;
}

/* Стили для шапки детальной страницы */
header.detail-header {
    padding-top: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
    padding-right: 0px;
    border-radius: 10px;
}