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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    width: 100%;
    max-width: 550px;
}

.form-wrapper {
    background: white;
    border-radius: 24px;
    padding: 45px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease;
}

.form-wrapper:hover {
    transform: translateY(-5px);
}

h1 {
    font-size: 32px;
    color: #333;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 35px;
    font-size: 15px;
    font-weight: 400;
}

/* Форма */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

input[type="text"],
select,
textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #fafafa;
}

input[type="text"]:hover,
select:hover,
textarea:hover {
    border-color: #d0d0d0;
    background: white;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 90px;
}

small {
    display: block;
    margin-top: 6px;
    color: #999;
    font-size: 13px;
}

/* Кнопка */
.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Лоадер */
.loader {
    text-align: center;
    margin-top: 40px;
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 25px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loader-title {
    color: #333;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.loader-subtext {
    color: #999;
    font-size: 15px;
    font-weight: 400;
    margin-bottom: 20px;
}

.loader-status {
    color: #667eea;
    font-size: 14px;
    font-weight: 600;
    margin-top: 15px;
    font-style: italic;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    margin-top: 25px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* Результаты */
.result-container {
    margin-top: 35px;
}

.result-container h2 {
    font-size: 26px;
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

.track-item {
    background: linear-gradient(135deg, #f9f9f9 0%, #f3f3f3 100%);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
}

.track-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.track-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
}

.track-audio {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
}

.btn-download {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* Адаптивность */
@media (max-width: 600px) {
    .form-wrapper {
        padding: 35px 25px;
    }

    h1 {
        font-size: 26px;
    }

    .subtitle {
        font-size: 14px;
    }

    input[type="text"],
    select,
    textarea {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
}

@media (max-width: 400px) {
    body {
        padding: 10px;
    }

    .form-wrapper {
        padding: 25px 20px;
    }
}

/* ===== DEBUG PANEL ===== */
.debug-panel {
    margin-top: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #16162a;
    border-bottom: 1px solid #2a2a4a;
    font-family: 'Segoe UI', sans-serif;
    font-size: 13px;
    color: #7a7aff;
    font-weight: 600;
}

.debug-clear {
    background: none;
    border: 1px solid #3a3a5a;
    color: #8888aa;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.debug-clear:hover {
    background: #2a2a4a;
    color: #fff;
}

.debug-log {
    width: 100%;
    min-height: 150px;
    max-height: 350px;
    padding: 10px 14px;
    margin: 0;
    background: #0d0d1a;
    color: #c8c8e8;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    box-sizing: border-box;
}

.debug-log::-webkit-scrollbar {
    width: 6px;
}
.debug-log::-webkit-scrollbar-track {
    background: #1a1a2e;
}
.debug-log::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 3px;
}
