/* test.css - Стили для модуля прикрепления файлов - БЕЗ АНИМАЦИЙ */

/* ===== МЕНЮ ПРИКРЕПЛЕНИЯ (как в WhatsApp) ===== */
#attach-menu {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    padding: 8px 0;
    z-index: 1100;
    min-width: 180px;
}

#attach-menu .attach-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 15px;
    color: #111;
}

#attach-menu .attach-menu-item:hover {
    background: #f0f2f5;
}

#attach-menu .attach-menu-item i {
    font-size: 22px;
    color: #128c7e;
    width: 28px;
    text-align: center;
}

body.dark-theme #attach-menu {
    background: #2c2c2c;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

body.dark-theme #attach-menu .attach-menu-item {
    color: #e0e0e0;
}

body.dark-theme #attach-menu .attach-menu-item:hover {
    background: #3d3d3d;
}

body.dark-theme #attach-menu .attach-menu-item i {
    color: #7c5bff;
}

/* ===== ОСНОВНЫЕ СТИЛИ ПРЕВЬЮ ===== */
#media-preview {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 200px;
    background: white;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
}

/* Крестик закрыть — правый верхний угол */
.media-preview-close {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    background: rgba(0,0,0,0.5) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    font-size: 20px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10;
}

.media-preview-close:hover {
    background: rgba(0,0,0,0.7) !important;
}

/* Область превью */
.media-preview-area {
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    position: relative;
}

/* Индикатор загрузки */
.media-preview-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #666;
    font-size: 13px;
}

.media-preview-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #128c7e;
    border-radius: 50%;
    animation: media-preview-spin 0.8s linear infinite;
}

@keyframes media-preview-spin {
    to { transform: rotate(360deg); }
}

.media-preview-error {
    color: #666;
    font-size: 13px;
    text-align: center;
}

/* Изображения в превью */
#media-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

/* Видео в превью */
#media-preview video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
    background: #000;
}

/* ===== СТИЛИ ДЛЯ МЕДИА В ЧАТЕ (БЕЗ МОРГАНИЯ) ===== */
/* ФИКС: Отключаем все анимации и переходы */
.chat-media,
.media-container,
#messagesBox * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

/* Контейнер для медиа в сообщениях */
.chat-media {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    margin: 6px 0 8px 0;
    object-fit: cover;
    display: block;
    background: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    opacity: 1 !important;
    visibility: visible !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    image-rendering: optimizeQuality;
}

/* Изображения в чате - АДАПТИВНЫЕ */
.chat-media[src*=".jpg"],
.chat-media[src*=".jpeg"],
.chat-media[src*=".png"],
.chat-media[src*=".gif"],
.chat-media[src*=".webp"] {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: transparent;
}

/* Обёртка для видео — оверлей перехватывает тап до play-кнопки */
.video-tap-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.video-tap-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 1;
}

/* Видео в чате */
.chat-media video,
video.chat-media {
    width: 100%;
    height: auto;
    max-height: 300px;
    border-radius: 10px;
    background: #000;
}
video.chat-media {
    cursor: pointer;
}

/* Контейнер для медиа */
.media-container {
    max-width: 240px;
    max-height: 300px;
    position: relative;
    display: inline-block;
    margin: 4px 0;
    contain: layout style paint;
}

.media-container img,
.media-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    #media-preview {
        max-width: 200px;
        bottom: 65px;
    }
    
    .chat-media {
        max-height: 250px;
    }
    
    .media-container {
        max-width: 200px;
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    #media-preview {
        max-width: 180px;
        bottom: 60px;
        padding: 8px;
    }
    
    .media-preview-area {
        height: 120px;
    }
    
    .chat-media {
        max-height: 200px;
    }
    
    .media-container {
        max-width: 180px;
        max-height: 200px;
    }
}

/* ===== ТЕМНАЯ ТЕМА (если используется) ===== */
@media (prefers-color-scheme: dark) {
    #media-preview {
        background: #2d2d2d;
        color: #fff;
        box-shadow: 0 6px 25px rgba(0,0,0,0.3);
    }
    
    .media-preview-area {
        background: #3d3d3d;
    }
    
    .chat-media {
        background: #3d3d3d;
    }
    
    .chat-media[src*=".jpg"],
    .chat-media[src*=".jpeg"],
    .chat-media[src*=".png"],
    .chat-media[src*=".gif"],
    .chat-media[src*=".webp"] {
        background: transparent;
    }
}

/* ===== ПОЛНОЭКРАННЫЙ ПРОСМОТР ИЗОБРАЖЕНИЙ ===== */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    cursor: default;
}

.fullscreen-image-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.fullscreen-image {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: grab;
}

.fullscreen-image.zoomed {
    cursor: move;
}

.fullscreen-image:active {
    cursor: grabbing;
}

/* Навигация влево/вправо */
.fullscreen-nav-prev,
.fullscreen-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    line-height: 1;
    padding: 0;
    user-select: none;
}

.fullscreen-nav-prev {
    left: 16px;
}

.fullscreen-nav-next {
    right: 16px;
}

.fullscreen-nav-prev:hover,
.fullscreen-nav-next:hover {
    background: #128c7e;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Кнопка закрытия */
.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.close-fullscreen:hover {
    background: rgba(0, 0, 0, 0.65);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Элементы управления зумом */
.zoom-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.zoom-btn {
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.zoom-btn:hover:not(:disabled) {
    background: #128c7e;
    border-color: rgba(255, 255, 255, 0.5);
}

.zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Индикатор зума */
.zoom-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 14px;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .zoom-controls {
        bottom: 20px;
    }
    
    .zoom-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .close-fullscreen {
        top: 10px;
        right: 10px;
        width: 44px;
        height: 44px;
    }
}

/* Инструкция */
.fullscreen-instruction {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-top: 20px;
    text-align: center;
    padding: 0 20px;
}

.fullscreen-instruction span {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 0 4px;
}

/* Курсор для изображений в чате */
.chat-media[src*=".jpg"],
.chat-media[src*=".jpeg"],
.chat-media[src*=".png"],
.chat-media[src*=".gif"],
.chat-media[src*=".webp"] {
    cursor: zoom-in;
}

.chat-media[src*=".jpg"]:hover,
.chat-media[src*=".jpeg"]:hover,
.chat-media[src*=".png"]:hover,
.chat-media[src*=".gif"]:hover,
.chat-media[src*=".webp"]:hover {
    opacity: 0.95;
}

/* ===== ВИДЕО В ПОЛНОЭКРАННОМ ОВЕРЛЕЕ ===== */
.video-fullscreen-video {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
}