/* Сброс стилей и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

/* Лоадер библиотеки */
.library-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin: 20px;
}

.loader-content {
    text-align: center;
    width: 100%;
    max-width: 600px;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-content h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.loading-progress {
    margin-top: 20px;
}

.loading-progress .progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.loading-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.loading-progress p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.language-select {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 8px 15px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.language-select:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.language-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Заголовок */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Основная секция конвертера */
.converter-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

/* Drag & Drop зона */
.drop-zone {
    border: 3px dashed #007bff;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #0056b3;
    background: #e3f2fd;
    transform: scale(1.02);
}

.drop-zone-content {
    position: relative;
    z-index: 2;
}

.upload-icon {
    width: 80px;
    height: 80px;
    fill: #007bff;
    margin-bottom: 20px;
}

.drop-zone h3 {
    font-size: 1.8rem;
    color: #007bff;
    margin-bottom: 15px;
    font-weight: 600;
}

.drop-zone p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.select-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.3s ease;
}

.select-btn:hover {
    background: #0056b3;
}

.file-info {
    font-size: 0.9rem;
    color: #999;
    margin-top: 10px;
}

/* Настройки конвертации */
.conversion-settings {
    margin-top: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 15px;
}

.conversion-settings h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
}

.setting-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.setting-group select,
.setting-group input[type="range"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.setting-group select:focus {
    outline: none;
    border-color: #007bff;
}

.setting-group input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: #ddd;
    outline: none;
    border-radius: 3px;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #007bff;
    cursor: pointer;
    border-radius: 50%;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #007bff;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

#qualityValue {
    margin-top: 5px;
    font-weight: 600;
    color: #007bff;
}

/* Прогресс */
.progress-section {
    margin-top: 30px;
    padding: 30px;
    background: #fff3cd;
    border-radius: 15px;
    border-left: 5px solid #ffc107;
}

.progress-section h3 {
    color: #856404;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    color: #856404;
    font-weight: 500;
}

/* Результаты */
.results-section {
    margin-top: 30px;
    padding: 30px;
    background: #d4edda;
    border-radius: 15px;
    border-left: 5px solid #28a745;
}

.results-section h3 {
    color: #155724;
    margin-bottom: 20px;
}

.results-list {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.result-preview {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.result-details h4 {
    color: #333;
    margin-bottom: 5px;
}

.result-details p {
    color: #666;
    font-size: 0.9rem;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #218838;
}

.download-all-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    transition: background 0.3s ease;
}

.download-all-btn:hover {
    background: #0056b3;
}

/* Информационная секция */
.info-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.info-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2rem;
}

.info-section h3 {
    color: #007bff;
    margin: 30px 0 15px 0;
    font-size: 1.4rem;
}

.info-section p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.8;
}

.info-section ul {
    list-style: none;
    margin: 20px 0;
}

.info-section li {
    color: #666;
    margin-bottom: 8px;
    padding-left: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* Утилитарные классы */
.hidden {
    display: none !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .language-switcher {
        top: 10px;
        right: 10px;
    }
    
    .language-select {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .converter-section {
        padding: 20px;
    }
    
    .drop-zone {
        padding: 40px 15px;
    }
    
    .upload-icon {
        width: 60px;
        height: 60px;
    }
    
    .drop-zone h3 {
        font-size: 1.4rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .result-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .result-info {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .language-switcher {
        position: relative;
        top: 0;
        right: 0;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .converter-section,
    .info-section {
        padding: 15px;
    }
    
    .drop-zone h3 {
        font-size: 1.2rem;
    }
}

/* RTL Support для арабского языка */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .language-switcher {
    left: 20px;
    right: auto;
}

[dir="rtl"] .result-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .result-info {
    flex-direction: row-reverse;
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.converter-section,
.info-section {
    animation: fadeInUp 0.6s ease-out;
}

/* Состояния загрузки */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}