/* Стили для модального окна голосовых сообщений и видео-кружочков */

.media-recorder-modal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.media-recorder-modal.show {
    opacity: 1;
    visibility: visible;
}

.media-recorder-modal .modal-content {
    background-color: var(--surface);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border-2);
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-recorder-modal.show .modal-content {
    transform: scale(1);
}

/* Header */
.media-recorder-modal .modal-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.media-recorder-modal .modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    /* Reduced from 650 */
    color: var(--text);
    letter-spacing: -0.01em;
}

.media-recorder-modal .modal-close {
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

.media-recorder-modal .modal-close:hover {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text);
}

/* Body */
.media-recorder-modal .modal-body {
    padding: 0;
    overflow-y: auto;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}

/* Tabs */
.media-recorder-tabs {
    display: flex;
    padding: 16px 24px 0;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.media-recorder-tab {
    background: none;
    border: none;
    padding: 0 0 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.media-recorder-tab:hover {
    color: var(--text);
}

.media-recorder-tab.active {
    color: var(--accent);
    font-weight: 600;
}

.media-recorder-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

/* Areas */
.media-recorder-area {
    display: none;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.media-recorder-area.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Area */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(246, 247, 251, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 200px;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--accent);
    background: var(--accent-surface);
}

.file-upload-icon {
    font-size: 42px;
    margin-bottom: 4px;
    color: var(--accent);
}

.file-upload-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.file-upload-hint {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 280px;
    line-height: 1.4;
}

/* Preview */
.file-preview {
    display: none;
    flex-direction: column;
    gap: 16px;
    background: transparent;
    /* Removed gray background */
    border-radius: 16px;
    padding: 0;
    /* Removed padding to align with modal */
    border: none;
    /* Removed border */
}

.file-preview.active {
    display: flex;
}

.file-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.file-preview-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.file-preview-remove {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.file-preview-remove:hover {
    background: #ef4444;
    color: white;
}

.file-preview-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

/* Visualization (Waveform / Video) */
.media-preview-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.voice-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(78, 164, 246, 0.08);
    /* Light blue tint */
    border: 1px solid rgba(78, 164, 246, 0.2);
    border-radius: 14px;
    box-shadow: none;
}

.play-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    /* Fallback */
    background: linear-gradient(135deg, #4ea4f6 0%, #3d88d8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: white;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(78, 164, 246, 0.4);
}

.play-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.waveform-canvas-container {
    flex: 1;
    height: 24px;
    /* Telegram style height */
    position: relative;
    cursor: pointer;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Trimming UI */
.trim-controls {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.trim-slider-container {
    position: relative;
    height: 24px;
    /* Match waveform */
    background: transparent;
    border-radius: 0;
    margin: 0 4px;
}

/* Recording UI */
.recorder-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 30px 0;
}

.recorder-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.recorder-btn-record {
    background: #ef4444;
    color: white;
}

.recorder-btn-record:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.3);
}

.recorder-btn.recording {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.recorder-time {
    font-variant-numeric: tabular-nums;
    font-size: 32px;
    font-weight: 300;
    color: var(--text);
    letter-spacing: 1px;
}

/* Footer */
.media-recorder-modal .modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface-2);
}

/* Video specific */
.video-crop-selector {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    background: #000;
}

.crop-controls {
    margin-top: 16px;
}

.video-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.video-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(15, 23, 42, 0.1);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.video-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    pointer-events: none;
}

.video-progress-handle {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 0 0 2px white;
}

.video-progress-bar:hover .video-progress-handle,
.video-progress-handle.active {
    opacity: 1;
}

.video-time {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    width: 36px;
}

/* Processing Overlay */
.processing-overlay {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
}

.processing-content {
    background-color: var(--surface);
    padding: 32px 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    min-width: 300px;
    border: 1px solid var(--border-2);
}

.processing-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 3px solid var(--border-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.processing-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.processing-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.processing-progress-bar {
    flex: 1;
    height: 6px;
    background-color: var(--border-2);
    border-radius: 3px;
    overflow: hidden;
}

.processing-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.processing-progress-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}