/* Reset and Base Styles */
* {
    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: #f5f5f7;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.header-text {
    text-align: center;
    flex: 1;
}

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

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.header-auth {
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

/* Input Section */
.input-section {
    direction: rtl;
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d1d1f;
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: #007aff;
}

.character-count {
    text-align: right;
    margin-top: 5px;
    font-size: 14px;
    color: #6e6e73;
}

.options-group {
    margin-bottom: 20px;
}

select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #007aff;
}

/* Buttons */
.generate-button {
    width: 100%;
    padding: 16px 24px;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
    min-height: 56px;
}

.generate-button:hover:not(:disabled) {
    background: #0056cc;
}

.generate-button:disabled {
    background: #c7c7cc;
    cursor: not-allowed;
}

.secondary-button {
    padding: 12px 20px;
    background: #f2f2f7;
    color: #007aff;
    border: 2px solid #007aff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-button:hover {
    background: #007aff;
    color: white;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Audio Section */
.audio-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.audio-section h3 {
    margin-bottom: 15px;
    color: #1d1d1f;
}

.audio-player-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#audio-player {
    width: 100%;
    height: 40px;
}

.audio-controls {
    display: flex;
    justify-content: center;
}

/* Error Section */
.error-section {
    margin-bottom: 20px;
}

.error-message {
    padding: 16px;
    background: #ffebee;
    border: 2px solid #ffcdd2;
    border-radius: 8px;
    color: #c62828;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-text {
        margin-bottom: 1rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header {
        padding: 15px;
    }
    
    .main-content {
        padding: 15px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.loading {
    pointer-events: none;
}
