/* Import Poppins Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.9;
}

.api-info {
    margin-top: 15px;
}

.api-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Poppins', inherit;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.rate-limit-info {
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.rate-limit-info small {
    color: #fff3cd;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Main Content */
main {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 100%;
    word-wrap: break-word;
}

/* Upload Section */
.upload-section {
    padding: 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.upload-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 1.1rem;
    font-family: 'Poppins', inherit;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    font-family: 'Poppins', inherit;
    transition: border-color 0.3s ease;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', inherit;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select:hover {
    border-color: #667eea;
}

.form-group select option {
    padding: 8px;
    font-family: 'Poppins', inherit;
    color: #495057;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 0.9rem;
    font-family: 'Poppins', inherit;
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: none;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    border-left: 4px solid #dc3545;
}

.error-message h3 {
    margin-bottom: 10px;
}

/* Results Section */
.results-section {
    padding: 40px;
}

.results-section h2 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Poppins', inherit;
    text-align: center;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
    border-left: 4px solid #28a745;
}

/* Scenes Container */
.scenes-container {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
    max-width: 100%;
    overflow: hidden;
}

.scene-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

.scene-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.scene-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.scene-header h3 {
    color: #667eea;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
    margin: 0;
}

.duration {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
}

.scene-content {
    display: grid;
    gap: 20px;
}

.scene-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

.scene-section h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
}

.scene-section p {
    margin-bottom: 8px;
    color: #6c757d;
    font-family: 'Poppins', inherit;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.dialogue {
    font-style: italic;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    font-size: 1.1rem;
    color: #495057;
    font-family: 'Poppins', inherit;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.scene-section ul {
    margin-left: 20px;
    color: #6c757d;
    font-family: 'Poppins', inherit;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.scene-section li {
    margin-bottom: 5px;
    font-family: 'Poppins', inherit;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* JSON Section */
.scene-json {
    margin-top: 20px;
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
}

.scene-json h4 {
    color: #e2e8f0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
}

.scene-json pre {
    background: #1a202c;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.scene-json code {
    color: #e2e8f0;
    font-family: 'Courier New', monospace;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.btn-copy {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Poppins', inherit;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn-copy:hover {
    background: #5a67d8;
}

/* Download Section */
.download-section {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.btn-download {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(40, 167, 69, 0.3);
}

/* Back to Home Section */
.back-to-home-section {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    margin-top: 20px;
}

.btn-back-home {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Poppins', inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.btn-back-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(108, 117, 125, 0.3);
    background: linear-gradient(135deg, #5a6268 0%, #343a40 100%);
}

.back-to-home-text {
    color: #6c757d;
    font-family: 'Poppins', inherit;
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-section,
    .results-section {
        padding: 20px;
    }
    
    .scene-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .scene-content {
        grid-template-columns: 1fr;
    }
    
    .scene-json pre {
        font-size: 0.8rem;
        white-space: pre-wrap;
        word-wrap: break-word;
        word-break: break-word;
    }
    
    .scene-section p,
    .dialogue,
    .scene-section li {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Progress bar mobile styles */
    .progress-container {
        padding: 20px;
        margin-top: 15px;
    }
    
    .progress-header h3 {
        font-size: 1.5rem;
    }
    
    .progress-steps {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .step {
        flex: 1;
        min-width: 80px;
    }
    
    .step-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .step-text {
        font-size: 0.8rem;
    }
    
    .tip {
        padding: 12px 15px;
        font-size: 0.85rem;
    }
    
    /* Back to home mobile styles */
    .back-to-home-section {
        padding: 20px;
        margin-top: 15px;
    }
    
    .btn-back-home {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .back-to-home-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .upload-section,
    .results-section {
        padding: 15px;
    }
    
    .scene-card {
        padding: 15px;
    }
    
    .scene-section {
        padding: 15px;
    }
}

/* Loading Animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: var(--progress-width, 0%); }
}

@keyframes stepPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    animation: pulse 1.5s infinite;
}

/* Progress Container */
.progress-container {
    background: white;
    border-radius: 15px;
    padding: 40px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.5s ease-out;
}

.progress-header {
    text-align: center;
    margin-bottom: 30px;
}

.progress-header h3 {
    color: #495057;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Poppins', inherit;
    margin-bottom: 10px;
}

.progress-subtitle {
    color: #6c757d;
    font-size: 1rem;
    font-family: 'Poppins', inherit;
    margin: 0;
}

/* Progress Bar */
.progress-bar-wrapper {
    margin-bottom: 40px;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease-in-out;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-percentage {
    position: absolute;
    right: 0;
    top: -30px;
    color: #667eea;
    font-weight: 600;
    font-family: 'Poppins', inherit;
    font-size: 0.9rem;
}

/* Progress Steps */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.step-icon {
    width: 50px;
    height: 50px;
    background: #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 3px solid #e9ecef;
}

.step-text {
    font-size: 0.9rem;
    color: #6c757d;
    font-family: 'Poppins', inherit;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.step.active .step-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    animation: stepPulse 1.5s infinite;
}

.step.active .step-text {
    color: #667eea;
    font-weight: 600;
}

.step.completed .step-icon {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.step.completed .step-text {
    color: #28a745;
    font-weight: 600;
}

/* Progress Tips */
.progress-tips {
    text-align: center;
}

.tip {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    color: #495057;
    font-family: 'Poppins', inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: fadeInUp 0.5s ease-out;
}

.tip strong {
    color: #667eea;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}
