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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo i {
    font-size: 2.5rem;
    color: #ffd700;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.form-section {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.script-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group input,
.input-group textarea,
.input-group select {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 120px;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.generate-btn:active {
    transform: translateY(0);
}

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

.result-section {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: none;
}

.result-section.show {
    display: block;
    animation: slideIn 0.5s ease-out;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.result-header h2 {
    color: #374151;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: #f3f4f6;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: #e5e7eb;
    color: #374151;
    transform: translateY(-1px);
}

.edit-btn:hover {
    background: #dbeafe;
    color: #3b82f6;
}

.script-container {
    position: relative;
}

.script-output {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e5e7eb;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #374151;
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.script-editor {
    width: 100%;
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #3b82f6;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #374151;
    min-height: 300px;
    resize: vertical;
    font-size: 1rem;
}

.script-editor:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.script-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.save-btn, .cancel-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-btn {
    background: #10b981;
    color: white;
}

.save-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.cancel-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.cancel-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading p {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .form-section,
    .result-section {
        padding: 1.5rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
}
/* Integrated Audio Section Styles */
.audio-section-integrated {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: none;
}

.audio-section-integrated.show {
    display: block;
    animation: slideIn 0.5s ease-out;
}

.audio-divider {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.audio-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
    z-index: 1;
}

.audio-divider span {
    background: white;
    padding: 0 1rem;
    color: #6b7280;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-divider span::before {
    content: "🎵";
    font-size: 1.2rem;
}

.audio-controls-integrated {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.voice-selector-integrated {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.voice-selector-integrated label {
    font-weight: 500;
    color: #6b7280;
    font-size: 0.9rem;
    white-space: nowrap;
}

.voice-selector-integrated select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-selector-integrated select:focus {
    outline: none;
    border-color: #f5576c;
    box-shadow: 0 0 0 3px rgba(245, 87, 108, 0.1);
}

.generate-audio-btn-integrated {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.generate-audio-btn-integrated:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.3);
}

.generate-audio-btn-integrated:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.audio-player-container-integrated {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e5e7eb;
    margin-top: 1rem;
}

.audio-player-integrated {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.audio-player-integrated audio {
    flex: 1;
    min-width: 250px;
    height: 40px;
    border-radius: 8px;
}

.download-btn-integrated {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.download-btn-integrated:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Loading overlay for audio generation */
.audio-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border-radius: 12px;
    z-index: 10;
}

.audio-loading.show {
    display: flex;
}

.audio-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(245, 87, 108, 0.3);
    border-top: 3px solid #f5576c;
    margin-bottom: 1rem;
}

.audio-loading p {
    color: #374151;
    font-weight: 500;
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .audio-controls-integrated {
        flex-direction: column;
        align-items: stretch;
    }
    
    .voice-selector-integrated {
        min-width: auto;
        margin-bottom: 1rem;
    }
    
    .generate-audio-btn-integrated {
        width: 100%;
        justify-content: center;
    }
    
    .audio-player-integrated {
        flex-direction: column;
        align-items: stretch;
    }
    
    .audio-player-integrated audio {
        min-width: auto;
        width: 100%;
    }
    
    .download-btn-integrated {
        width: 100%;
        justify-content: center;
    }
    
    .script-actions {
        flex-direction: column;
    }
    
    .save-btn, .cancel-btn {
        width: 100%;
        justify-content: center;
    }
}/* 
Header Updates */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
}

.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.modal-header h2 {
    color: #374151;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2::before {
    content: "⚙️";
    font-size: 1.5rem;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6b7280;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.modal-content {
    padding: 2rem;
}

.api-key-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.api-key-info {
    background: #eff6ff;
    border: 2px solid #dbeafe;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #1e40af;
}

.api-key-info i {
    font-size: 1.2rem;
    color: #3b82f6;
}

.api-key-info p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input input {
    flex: 1;
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #374151;
}

.input-help {
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: block;
}

.input-help a {
    color: #3b82f6;
    text-decoration: none;
}

.input-help a:hover {
    text-decoration: underline;
}

.required {
    color: #ef4444;
    font-weight: 500;
}

.optional {
    color: #6b7280;
    font-weight: 400;
    font-size: 0.8rem;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem 2rem;
    border-top: 2px solid #f3f4f6;
    gap: 1rem;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

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

/* API Warning */
.api-warning {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-left: 4px solid #f59e0b;
    max-width: 350px;
    z-index: 1500;
    display: none;
}

.api-warning.show {
    display: block;
    animation: slideInRight 0.5s ease-out;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.warning-content i {
    color: #f59e0b;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.warning-text h3 {
    margin: 0 0 0.5rem 0;
    color: #374151;
    font-size: 1rem;
    font-weight: 600;
}

.warning-text p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.4;
}

.warning-content .btn-primary {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-content,
    .modal-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .api-warning {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
    
    .warning-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .warning-content .btn-primary {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}