/* ================================== */
/*    МОДАЛКА ПРЕДПРОСМОТРА ФАЙЛА     */
/* ================================== */

.file-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview-container {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.file-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}
.file-preview-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.file-preview-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
    margin-bottom: 24px;
    position: relative;
}

.file-preview-video {
    max-width: 100%;
    max-height: calc(90vh - 160px);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: block;
}

.file-preview-image {
    max-width: 100%;
    max-height: calc(90vh - 160px);
    border-radius: 12px;
    object-fit: contain;
}

.file-preview-video-wrapper {
    position: relative;
    display: inline-block;
}

.file-preview-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: white;
    font-size: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
}
.file-preview-play-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.file-preview-panel {
    width: 80%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    border-radius: 40px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.file-preview-caption {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 15px;
    padding: 10px 0;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 80px;
    overflow-y: auto;
}
.file-preview-caption:focus {
    outline: none;
}

.file-preview-send-btn {
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}
.file-preview-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}
.file-preview-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.file-preview-error {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 68, 68, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
}

/* ================================== */
/*   ЭЛЕМЕНТЫ УПРАВЛЕНИЯ ВИДЕО       */
/* ================================== */

.file-preview-video-controls {
    width: 80%;
    max-width: 600px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 12px 16px;
}

.video-progress-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.video-progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.video-progress-slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.video-time-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    font-family: monospace;
}

.trim-badge {
    background: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
}

/* ================================== */
/*   ТАЙМЛАЙН С КАДРАМИ (rc-slider)   */
/* ================================== */

.video-timeline-wrapper {
    width: 100%;
    position: relative;
}

.video-timeline-frames {
    display: flex;
    width: 100%;
    background: #1a1a1a;
    border-radius: 12px;
    cursor: pointer;
    height: 48px;
    overflow: hidden;
    margin-bottom: 12px;
    user-select: none;
    -webkit-user-select: none;
}

.video-timeline-frame {
    flex: 1 1 0;
    height: 48px;
}

.video-timeline-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.video-timeline-placeholder {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    padding: 12px;
}

/* Слайдер обрезки (rc-slider) */
.video-trim-slider {
    margin-top: 8px;
    padding: 0 4px;
}

.video-trim-slider .rc-slider-rail {
    background-color: rgba(255, 255, 255, 0.3);
    height: 4px;
    border-radius: 2px;
}

.video-trim-slider .rc-slider-track {
    background-color: var(--primary);
    height: 4px;
}

.video-trim-slider .rc-slider-handle {
    background-color: var(--primary);
    border: 2px solid white;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.video-trim-slider .rc-slider-handle:active {
    box-shadow: 0 0 0 2px rgba(76, 154, 255, 0.3);
    transform: scale(1.1);
}

.video-trim-slider .rc-slider-handle-dragging {
    box-shadow: 0 0 0 2px rgba(76, 154, 255, 0.5);
}