/* ---------------------------------- */
/* МЕДИА-КОНТЕНТ (изображения, видео) */
/* ---------------------------------- */
.message-text img, .message-text video {
    max-width: 220px;
    max-height: 220px;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}
.message-text img:hover {
    transform: scale(1.02);
}
.message .message-bubble img {
    max-width: 100px;
    max-height: 100px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    cursor: pointer;
}
.message .message-bubble img[src*=".gif"],
.message .message-bubble img[src*=".GIF"] {
    max-width: 100px;
    max-height: 100px;
}
.chat-image-full {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 12px;
    cursor: pointer;
    object-fit: contain;
}
.image-message-container {
    margin: 4px 0;
}

/* Кастомный видеоплеер */
.custom-video-player {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    min-height: 200px;
}
.video-element {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}
.video-loading-overlay,
.video-error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 1;
}
.loading-spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
.video-top-controls {
    position: absolute;
    top: 4px;
    left: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 20px;
    transition: opacity 0.3s ease;
    z-index: 2;
}
.video-top-controls.hidden {
    opacity: 0;
    pointer-events: none;
}
.video-top-controls.visible {
    opacity: 1;
}
.video-mute-btn {
    background: none;
    border: none;
    color: white;
    font-size: 9px;
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}
.video-mute-btn:hover {
    transform: scale(1.1);
}
.video-remaining-time {
    color: white;
    font-size: 9px;
    font-family: monospace;
    font-weight: 500;
    text-shadow: 0 1px 2px black;
    letter-spacing: 0.5px;
}
.video-bottom-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1px 1px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    transition: opacity 0.3s ease;
    z-index: 0;
}
.video-bottom-progress.hidden {
    opacity: 0;
    pointer-events: none;
}
.video-bottom-progress.visible {
    opacity: 1;
}
.video-progress-area {
    position: relative;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    cursor: pointer;
}
.video-buffered-bar {
    position: absolute;
    height: 100%;
    background: rgba(255,255,255,0.5);
    border-radius: 2px;
    pointer-events: none;
}
.video-progress-fill {
    position: absolute;
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    pointer-events: none;
}
.video-progress-slider {
    position: relative;
    width: 100%;
    height: 4px;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
    margin: 0;
    padding: 0;
}
.video-caption {
    position: absolute;
    bottom: 60px;
    left: 12px;
    color: white;
    background: rgba(0,0,0,0.6);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 2;
    pointer-events: none;
}
.message:has(.custom-video-player) .message-bubble {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 14px !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
}
.message.own:has(.custom-video-player) .message-bubble {
    background: transparent !important;
    background-image: none !important;
}
.message:has(.custom-video-player) {
    padding: 0 !important;
    margin: 4px 0 !important;
}
.message:has(.custom-video-player) .message-avatar {
    align-self: flex-start;
    margin-top: 8px;
}