:root {
    --primary-color: #6a5acd;
    --primary-color-light: #8a7cef;
    --primary-color-dark: #4a3aad;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --text-light: #777;
    --background-color: #f9f9f9;
    --card-color: #ffffff;
    --error-color: #e53935;
    --success-color: #43a047;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1000px;
    width: 90%;
    margin: 0 auto;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

main {
    flex: 1;
}

.card {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.input-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.2);
}

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    appearance: none;
    font-family: inherit;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.2);
}

select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

optgroup {
    font-weight: 600;
    color: var(--primary-color);
}

option {
    font-weight: normal;
    color: var(--text-color);
    padding: 8px;
}

.select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--text-light);
    pointer-events: none;
}

.primary-btn, .secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-color-dark);
}

.primary-btn:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.secondary-btn:hover {
    background-color: #e9e9e9;
}

#reset-btn {
    background-color: var(--error-color);
    color: white;
}

#reset-btn:hover {
    background-color: #c62828;
}

.icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    fill: currentColor;
}

.audio-player {
    margin: 1.5rem 0;
}

audio {
    width: 100%;
    border-radius: var(--border-radius);
}

.download-options {
    margin-top: 1rem;
}

.download-options p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.download-buttons {
    display: flex;
    gap: 1rem;
}

.button-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.button-row button {
    flex: 1;
}

.hidden {
    display: none;
}

#loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

#loader.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(106, 90, 205, 0.2);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

#error-message {
    display: none;
    align-items: center;
    padding: 1rem;
    background-color: rgba(229, 57, 53, 0.1);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--error-color);
    margin: 1rem 0;
}

.error-icon {
    fill: var(--error-color);
    margin-right: 0.5rem;
}

footer {
    text-align: center;
    margin-top: auto;
    padding: 1.5rem 0;
    color: var(--text-light);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.speed-control, .pitch-control {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.speed-control label, .pitch-control label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.speed-value, .pitch-value {
    font-weight: bold;
    color: var(--primary-color);
}

.speed-slider, .pitch-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    border-radius: 4px;
}

.speed-slider::-webkit-slider-thumb, .pitch-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.speed-slider::-moz-range-thumb, .pitch-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

/* Responsive styles */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 1rem 0;
    }

    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .download-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .button-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 1rem;
    }
}

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