/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER И НАВИГАЦИЯ ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.dashboard-card {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    text-align: center;
    min-width: 150px;
}

.dashboard-title {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 5px;
}

.dashboard-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: #374151;
    border-color: #d1d5db;
    background: #f9fafb;
}

/* ===== КАРТОЧКИ ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

/* ===== КНОПКИ ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 6px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: white;
    color: #64748b;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #9ca3af;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

/* ===== ЗОНА ЗАГРУЗКИ ===== */
.upload-zone {
    border: 2px dashed #4361ee;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone.dragover {
    background: #eef2ff;
    border-color: #3a52d4;
}

.upload-zone svg {
    color: #64748b;
    margin-bottom: 16px;
}

.upload-zone p {
    color: #64748b;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* ===== СПИСОК ФАЙЛОВ ===== */
.file-list {
    margin-top: 30px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: white;
    transition: all 0.2s ease;
}

.file-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    margin-bottom: 5px;
    word-break: break-word;
    color: #1e293b;
}

.file-meta {
    font-size: 0.9rem;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.file-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* ===== БЕЙДЖИ КАЧЕСТВА И СТАТУСА ===== */
.quality-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.quality-good { 
    background: #dcfce7; 
    color: #166534; 
}

.quality-medium { 
    background: #fef3c7; 
    color: #92400e; 
}

.quality-poor { 
    background: #fee2e2; 
    color: #991b1b; 
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
}

.status-processing { 
    background: #fef3c7; 
    color: #92400e; 
}

.status-completed { 
    background: #dbeafe; 
    color: #1e40af; 
}

.status-edited { 
    background: #dcfce7; 
    color: #166534; 
}

.retry-count {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 5px;
}

.benchmark-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 5px;
}

.current-badge {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 5px;
}

/* ===== СОСТОЯНИЯ ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-state h3 {
    color: #64748b;
    margin-bottom: 8px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    margin-bottom: 20px;
}

/* ===== АУДИО ПЛЕЙЕР ===== */
.audio-player {
    margin-bottom: 24px;
}

.audio-player h3 {
    margin-bottom: 12px;
}

.retry-info {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    color: #92400e;
    font-size: 0.9rem;
}

/* ===== ВЕРСИИ ТРАНСКРИБАЦИИ ===== */
.versions-list {
    display: grid;
    gap: 10px;
}

.version-item {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    transition: all 0.2s ease;
}

.version-item.active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.version-item:hover {
    border-color: #d1d5db;
}

.version-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.version-meta {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 4px;
}

.version-quality {
    font-size: 0.8rem;
    color: #059669;
    font-weight: 500;
}

/* ===== СРАВНЕНИЕ СЕГМЕНТОВ ===== */
.segments-comparison {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.segments-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    font-weight: bold;
    border: 1px solid #e9ecef;
}

.column-title {
    text-align: center;
    padding: 10px;
}

.segment-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background: white;
}

.segment-original, .segment-edited {
    padding: 15px;
    border-radius: 5px;
    min-height: 120px;
}

.segment-original {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

.segment-edited {
    background: white;
    border: 1px solid #e9ecef;
}

.segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: #6c757d;
}

.segment-time {
    font-family: monospace;
    font-weight: bold;
}

.segment-speaker {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.speaker-original {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.segment-text {
    margin-bottom: 12px;
    line-height: 1.5;
}

.segment-edit {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.speaker-select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8em;
}

.manual-segment {
    background: #e8f5e8 !important;
    border-left: 4px solid #4caf50;
}

.empty-segment {
    background: #fff3e0 !important;
    border-left: 4px solid #ff9800;
}

.manual-badge {
    background: #4caf50;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    margin-left: 10px;
    font-weight: bold;
}

.speaker-warning {
    color: #f44336;
    font-size: 0.8em;
    margin: 8px 0;
    padding: 5px;
    background: #ffebee;
    border-radius: 3px;
}

.segment-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.segment-btn {
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.segment-btn:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
}

.segment-btn-copy {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1976d2;
}

.segment-btn-reset {
    background: #fff3e0;
    border-color: #ff9800;
    color: #f57c00;
}

.segment-btn-delete {
    background: #ffebee;
    border-color: #f44336;
    color: #d32f2f;
}

.segment-diff {
    margin-top: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9em;
    border-left: 3px solid #6c757d;
}

.diff-content {
    margin-top: 5px;
    line-height: 1.5;
}

.diff-content del {
    background: #ffebee;
    color: #c62828;
    text-decoration: line-through;
    padding: 1px 2px;
}

.diff-content ins {
    background: #e8f5e8;
    color: #2e7d32;
    text-decoration: none;
    padding: 1px 2px;
}

.add-segment-row {
    background: #f8f9fa !important;
    border: 2px dashed #dee2e6 !important;
    padding: 10px !important;
}

.segment-placeholder {
    /* Пустая ячейка слева */
}

.segment-actions-single {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-add-btn {
    padding: 12px 20px;
    background: #e3f2fd;
    border: 2px dashed #2196f3;
    border-radius: 6px;
    cursor: pointer;
    color: #1976d2;
    font-weight: bold;
    transition: all 0.2s;
}

.gap-add-btn:hover {
    background: #bbdefb;
    transform: translateY(-1px);
}

.new-segment-form {
    grid-column: 1 / -1;
    padding: 20px;
    background: #e8f5e8;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #4caf50;
}

/* ===== СТАТИСТИКА КАЧЕСТВА ===== */
.quality-breakdown {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.quality-metric {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.quality-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.quality-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.quality-text { 
    background: #2196f3; 
}

.quality-speaker { 
    background: #ff9800; 
}

.quality-total { 
    background: #4caf50; 
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn {
        width: 100%;
        justify-content: center;
    }
    
    .segments-comparison {
        grid-template-columns: 1fr;
    }
    
    .segments-header {
        grid-template-columns: 1fr;
    }
    
    .segment-row {
        grid-template-columns: 1fr;
    }
    
    .segment-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .segment-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 16px;
    }
    
    .upload-zone {
        padding: 20px;
    }
    
    .file-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .segment-actions {
        flex-direction: column;
    }
    
    .segment-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===== УТИЛИТЫ ===== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.hidden {
    display: none;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}