/**
 * Frontend CSS for Spot Bot
 * File: assets/css/frontend.css
 */

/* Container */
.spotbot-container {
    max-width: 900px;
    margin: 40px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}
div#cartesia-scripts-container {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
}

button.spotbot-btn.spotbot-btn-primary.cartesia-select-script-btn {
    width: 100%;
}
.spotbot-form-wrapper {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 40px;
    position: relative;
}

.spotbot-title {
    text-align: center;
    color: #1a1a1a;
    font-size: 32px;
    margin: 0 0 30px 0;
    font-weight: 700;
}

/* Step Indicator */
.spotbot-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.spotbot-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.spotbot-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    background: #e0e0e0;
    color: #666;
    border-radius: 50%;
    font-weight: 600;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.spotbot-step.active .step-number {
    background: #2271b1;
    color: #ffffff;
    transform: scale(1.1);
}

.spotbot-step.completed .step-number {
    background: #00a32a;
    color: #ffffff;
}

.step-label {
    display: block;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.spotbot-step.active .step-label {
    color: #2271b1;
    font-weight: 600;
}

/* Form Fields */
.spotbot-form-section {
    animation: fadeIn 0.4s ease;
}

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

.spotbot-field {
    margin-bottom: 25px;
}

.spotbot-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-size: 15px;
}

.spotbot-field label.required::after {
    content: ' *';
    color: #d63638;
}

.spotbot-field input[type="text"],
.spotbot-field textarea,
.spotbot-field select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.spotbot-field input[type="text"]:focus,
.spotbot-field textarea:focus,
.spotbot-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.spotbot-field textarea {
    resize: vertical;
    min-height: 100px;
}

.spotbot-help {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 13px;
    font-style: italic;
}

/* Buttons */
.spotbot-actions {
    text-align: center;
    margin-top: 30px;
}

.spotbot-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.spotbot-btn-primary {
    background: #2271b1;
    color: #ffffff;
}

.spotbot-btn-primary:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.spotbot-btn-secondary {
    background: #f0f0f1;
    color: #1a1a1a;
}

.spotbot-btn-secondary:hover {
    background: #dcdcde;
}

.spotbot-btn-link {
    background: transparent;
    color: #2271b1;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
}

.spotbot-btn-link:hover {
    color: #135e96;
    text-decoration: underline;
}

.spotbot-btn:disabled,
.spotbot-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Step 2: Script Selection */
#scripts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.script-option {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    position: relative;
}

.script-option:hover {
    border-color: #c0c0c0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.script-option.selected {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
    background: #f7faff;
}
div#cartesia-final-audio-player {
    width: 100%;
}
.script-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
}

.script-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.script-length {
    font-size: 14px;
    color: #666;
    background: #f0f0f1;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.script-text {
    font-size: 15px;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.6;
    white-space: pre-wrap; /* Preserve formatting from script text */
}

.select-script-btn {
    padding: 8px 20px;
    font-size: 14px;
}

/* Step 3: Audio Generation */
.voice-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.audio-version {
    flex: 1;
    min-width: 250px;
    max-width: calc(50% - 10px);
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.audio-version:hover {
    border-color: #c0c0c0;
}

.audio-version.selected {
    border-color: #00a32a;
    box-shadow: 0 0 0 3px rgba(0, 163, 42, 0.2);
    background: #fafff7;
}

.voice-info {
    margin-bottom: 10px;
}

.voice-icon {
    font-size: 36px;
    color: #2271b1;
    display: block;
    margin-bottom: 5px;
}

.voice-name {
    font-weight: 600;
    font-size: 17px;
    color: #1a1a1a;
}

.voice-gender-age {
    font-size: 13px;
    color: #666;
}

.audio-preview-player {
    width: 100%;
    margin-top: 15px;
}

.audio-preview-player audio {
    width: 100%;
    height: 30px;
}

.audio-actions {
    text-align: center;
    margin-top: 30px;
}

/* Step 4: Download/Final */
.spotbot-success-message {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: #e6ffed;
    border: 1px solid #00a32a;
    border-radius: 8px;
}

.spotbot-success-message h3 {
    color: #00a32a;
    font-size: 28px;
    margin: 0 0 10px 0;
}

.spotbot-final-script {
    border: 1px dashed #e0e0e0;
    padding: 20px;
    border-radius: 8px;
    background: #f9f9f9;
    margin-bottom: 30px;
    white-space: pre-wrap;
    font-style: italic;
    color: #444;
    font-size: 15px;
    line-height: 1.6;
}

.spotbot-final-player {
    margin-bottom: 30px;
}

.spotbot-final-player audio {
    width: 100%;
}

.final-spot-title {
    text-align: center;
    color: #1a1a1a;
    font-size: 28px;
    margin: 0 0 20px 0;
}

.final-client-name {
    margin-top: 20px;
    color: #666;
    font-size: 16px;
    text-align: center;
}

.spotbot-download-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.spotbot-download-actions .spotbot-btn {
    min-width: 250px;
}

/* Loading Overlay */
.spotbot-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
}

.spotbot-loading-content {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.spotbot-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f0f0f1;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

.loading-message {
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* General Messages */
#spotbot-messages {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
}

.spotbot-message {
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 250px;
}

.spotbot-success {
    background: #e6ffed;
    color: #00a32a;
    border: 1px solid #00a32a;
}

.spotbot-error {
    background: #ffe6e6;
    color: #d63638;
    border: 1px solid #d63638;
}
.spotbot-field select#voice_gender,
.spotbot-field select#voice_age {
    padding: 10px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: border-color 0.3s;
}

.spotbot-field select#voice_gender:focus,
.spotbot-field select#voice_age:focus {
    border-color: #2271b1;
    outline: none;
}
/* Media Queries */
@media (max-width: 768px) {
    .spotbot-form-wrapper {
        padding: 20px;
        margin: 0 10px;
    }
    
    .spotbot-steps::before {
        left: 10%;
        right: 10%;
    }
    
    .audio-version {
        max-width: 100%;
    }

    .spotbot-download-actions .spotbot-btn {
        min-width: 100%;
    }
    
    .spotbot-steps {
        flex-wrap: wrap;
    }
    
    .spotbot-step {
        flex-basis: 50%;
        margin-bottom: 20px;
    }
    
    .spotbot-steps::before {
        display: none;
    }
}