body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1,
h2,
h3 {
    color: #333;
    text-align: center;
}

h1 {
    margin: 2rem 0;
    text-align: center;
    color: #212529;
}

.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.format-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    text-decoration: none;
    color: inherit;
}

.format-card:hover {
    transform: translateY(-5px);
    border-color: #007bff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.converter-section {
    max-width: 800px;
    margin: 0 auto;
}

.upload-section {
    text-align: center;
    padding: 40px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
    transition: background-color 0.3s ease;
}

.upload-section.drag-over {
    background-color: #e9ecef;
    border-color: #007bff;
}

.upload-button {
    background: #007bff;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.upload-button:hover {
    background: #0056b3;
}

.settings-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.quality-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.original-image,
.converted-image {
    text-align: center;
}

.original-image img,
.converted-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.download-button {
    display: block;
    width: 200px;
    margin: 20px auto;
    padding: 12px 24px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

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

.seo-text {
    margin-top: 60px;
    color: #6c757d;
}

.faq-section {
    margin-top: 40px;
}

details {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

summary {
    cursor: pointer;
    font-weight: bold;
    color: #495057;
}

details[open] summary {
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .preview-section {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 15px;
    }
    .format-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 10px;
    }
}

.controls-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.control-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.action-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    background: #1a73e8;
    color: white;
}

.action-button:hover {
    background: #1557b0;
}

.action-button.remove {
    background: #dc3545;
}

.action-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Индикатор конвертации */
.converting {
    position: relative;
}

.converted {
    position: relative;
}

.converting::after {
    content: 'Конвертация...';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 3;
}

.converted::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 40px;
    width: 24px;
    height: 24px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
}

.image-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    z-index: 2;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.image-checkbox:hover {
    opacity: 1;
}

/* Информация о размере */
.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    font-size: 11px;
    line-height: 1.4;
    z-index: 1;
}

.size-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.current-size,
.predicted-size {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Кнопка удаления */
.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.remove-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

/* КРИТИЧЕСКОЕ ИСПРАВЛЕНИЕ: Сетка изображений */
.image-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.image-grid:not(:empty) {
    display: grid;
}

/* КРИТИЧЕСКОЕ ИСПРАВЛЕНИЕ: Контейнер изображения с правильным масштабированием */
.image-container {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1/1; /* Квадратные превью */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-container::before {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    opacity: 0;
    z-index: 2;
    background: rgba(0, 0, 0, 0.7);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.image-container:hover::before {
    opacity: 1;
}

/* КРИТИЧЕСКОЕ ИСПРАВЛЕНИЕ: Превью изображения с правильным масштабированием */
.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Заполняет контейнер, обрезая лишнее */
    display: block;
}

/* Модальное окно */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.show {
    opacity: 1;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: transparent;
}

#modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.close-modal {
    position: absolute;
    top: -30px;
    right: -30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.close-modal:hover {
    color: #bbb;
}

.modal-info {
    margin-top: 20px;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.predicted-size {
    color: #8eff9d;
    font-weight: 500;
}

.converted-size {
    color: #8eff9d;
    font-weight: 500;
}

.site-footer {
    margin-top: 40px;
    padding: 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #007bff;
}

.footer-copyright {
    color: #6c757d;
    font-size: 0.9em;
}

.reset-button {
    background-color: #6c757d;
}

.reset-button:hover {
    background-color: #5a6268;
}

/* Страницы Privacy и ToS */
.legal-page {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legal-page h1 {
    color: #333;
    margin-bottom: 30px;
}

.legal-page h2 {
    color: #555;
    margin-top: 30px;
    margin-bottom: 20px;
}

.legal-page ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 20px;
}

.legal-page li {
    margin-bottom: 10px;
    color: #666;
}

.image-container.converting {
    opacity: 0.7;
    position: relative;
}

.image-container.error {
    border-color: #dc3545;
    opacity: 0.5;
}

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

/* Улучшенные уведомления */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 300px;
}

.notification {
    background: #fff;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 4px;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    border-left-color: #28a745;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.fade-out {
    animation: slideOut 0.3s ease-in;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.download-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 14px;
}

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

.file-count {
    font-weight: 600;
    color: #495057;
}

.total-size {
    color: #6c757d;
}

.archive-note {
    color: #007bff;
    font-size: 12px;
}

/* Подсказки */
.quality-help,
.format-help {
    margin-top: 8px;
    color: #6c757d;
}

.quality-help small,
.format-help small {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Прогресс-бар */
.progress-container {
    margin: 15px 0;
}

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

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

.progress-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    text-align: center;
}

/* Улучшенные кнопки */
.action-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.action-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.action-button:disabled {
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .preview-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .action-button {
        width: 100%;
        margin: 5px 0;
    }
    .control-buttons {
        flex-direction: column;
    }
    .image-container::before {
        font-size: 20px;
        width: 40px;
        height: 40px;
    }
}

/* Header Styles */
.site-header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 2rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    box-sizing: border-box;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: bold;
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-logo:hover {
    color: #0056b3;
}

.logo-icon {
    vertical-align: middle;
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    color: #495057;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9375rem;
    white-space: nowrap;
}

.nav-link:hover {
    background: #f8f9fa;
    color: #007bff;
}

.nav-link[data-active="true"] {
    background: #e7f1ff;
    color: #007bff;
}

/* Мобильная оптимизация */
@media (max-width: 767px) {
    .site-header {
        position: static;
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }
    .nav-links {
        display: none;
    }
    .main-nav {
        justify-content: center;
        gap: 0;
    }
    .nav-logo {
        font-size: 1.1rem;
    }
    .header-content {
        padding: 0 1rem;
    }
    .format-description {
        display: none;
    }
    .image-modal {
        display: none !important;
    }
    .image-container {
        cursor: default;
    }
}

/* Планшеты */
@media (min-width: 768px) and (max-width: 1024px) {
    .main-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .nav-links {
        justify-content: center;
        gap: 0.5rem;
    }
    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.875rem;
    }
    .header-content {
        padding: 0 1rem;
    }
}

.modal-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 20px 0;
}

/* Стили для features блока */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.feature-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.feature-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: #333;
}

.feature-card p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #6c757d;
}

@media (max-width: 768px) {
    .features {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Additional styles for audio converter */

.audio-list {
    margin: 30px 0;
}

.audio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.audio-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.audio-card:hover {
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.audio-select {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.audio-info {
    flex: 1;
    min-width: 0;
}

.audio-name {
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.audio-size {
    font-size: 0.85em;
    color: #666;
}

.upload-section {
    background: #E3F2FD;
    border: 2px dashed #2196F3;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 30px 0;
}

.upload-section:hover {
    background: #BBDEFB;
    border-color: #1976D2;
}

.upload-section.dragover {
    background: #90CAF9;
    border-color: #1565C0;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.upload-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 15px;
    transition: background 0.3s ease;
}

.upload-button:hover {
    background: #1976D2;
}

.controls-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin: 30px 0;
}

.quality-slider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.quality-slider span {
    font-weight: 500;
    color: #333;
}

.quality-slider select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.control-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.action-button:hover {
    background: #1976D2;
}

.action-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.reset-button {
    background: #757575;
}

.reset-button:hover {
    background: #616161;
}

#conversion-progress {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 30px 0;
}

.progress-header h3 {
    margin: 0 0 20px 0;
    color: #333;
}

.progress-section {
    margin: 20px 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-track-name {
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 10px;
}

.progress-bar-container {
    width: 100%;
}

progress {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background-color: #f0f0f0;
}

progress::-webkit-progress-bar {
    background-color: #f0f0f0;
    border-radius: 6px;
}

progress::-webkit-progress-value {
    background-color: #2196F3;
    border-radius: 6px;
    transition: width 0.3s ease;
}

progress::-moz-progress-bar {
    background-color: #2196F3;
    border-radius: 6px;
}

#total-progress-bar::-webkit-progress-value {
    background-color: #4CAF50;
}

#total-progress-bar::-moz-progress-bar {
    background-color: #4CAF50;
}

@media (max-width: 768px) {
    .audio-grid {
        grid-template-columns: 1fr;
    }
    
    .control-buttons {
        flex-direction: column;
    }
    
    .action-button {
        width: 100%;
    }
}
