/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --secondary-color: #06B6D4;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 40px 0;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* Main Content */
main {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-section h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.upload-card {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-card h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.upload-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    background: #4338CA;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-name {
    margin-top: 15px;
    color: var(--success-color);
    font-weight: 500;
    min-height: 24px;
}

/* Upload Tabs */
.upload-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

#speechText {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
}

/* AI Settings Section */
.ai-settings-section {
    margin-bottom: 40px;
}

.ai-settings-section h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.ai-settings {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 15px;
    color: white;
    text-align: center;
}

.help-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    margin-top: 8px;
    display: block;
    text-align: center;
}

.ai-settings .form-group {
    max-width: 300px;
    margin: 0 auto;
}

.ai-settings .form-group label {
    color: white;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    font-size: 1.1rem;
}

.ai-settings .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.ai-settings .form-group select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.ai-settings .form-group select option {
    background: var(--text-primary);
    color: white;
    padding: 10px;
}

/* Audience Section */
.audience-section {
    margin-bottom: 40px;
}

.audience-section h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.audience-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Action Section */
.action-section {
    text-align: center;
    margin: 40px 0;
}

.analyze-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.analyze-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.analyze-btn:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1.4rem;
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 60px 0;
}

.loading-section.hidden {
    display: none;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.progress-steps {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.step {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-radius: 20px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.step.active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease;
}

.results-section.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 2rem;
    text-align: center;
}

/* Report Summary */
.report-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 40px;
    color: white;
}

.score-card {
    text-align: center;
    margin-bottom: 40px;
}

.score-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.score-circle span {
    font-size: 3rem;
    font-weight: bold;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metric-label {
    font-size: 1rem;
    opacity: 0.95;
}

.metric-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #34D399);
    border-radius: 4px;
    transition: width 1s ease;
}

/* Report Details */
.report-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.report-section {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    border-left: 4px solid;
}

.report-section.strengths {
    border-left-color: var(--success-color);
}

.report-section.weaknesses {
    border-left-color: var(--warning-color);
}

.report-section.suggestions {
    border-left-color: var(--primary-color);
}

.report-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.report-section ul {
    list-style: none;
}

.report-section li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.6;
}

.report-section li:last-child {
    border-bottom: none;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.primary-btn, .secondary-btn {
    padding: 14px 35px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background: #4338CA;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    color: white;
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .upload-grid {
        grid-template-columns: 1fr;
    }
    
    main {
        padding: 20px;
    }
    
    .report-details {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* Advanced Actions */
.advanced-actions {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.advanced-actions h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.advanced-actions p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.enhancement-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.option-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.option-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.option-card h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.option-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.option-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: #4338CA;
    transform: scale(1.05);
}

/* Large Modal Styles */
.large-modal {
    max-width: 900px;
    max-height: 90vh;
    width: 90%;
}

.step-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.step-header h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin: 0;
}

.form-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-section .form-group {
    display: flex;
    flex-direction: column;
}

.form-section .form-group:last-child {
    grid-column: 1 / -1;
}

.form-section label {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-section select,
.form-section textarea {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-section select:focus,
.form-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-section textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* Optimization Results */
.optimization-result,
.script-result {
    margin-top: 30px;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border-left: 4px solid var(--success-color);
}

.optimization-result h3,
.script-result h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
}

#slideContent,
#scriptContent {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Georgia', serif;
    line-height: 1.6;
}

.slide-item {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.slide-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.slide-content {
    color: var(--text-secondary);
    line-height: 1.5;
}

.slide-notes {
    margin-top: 10px;
    padding: 10px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 0.9rem;
    font-style: italic;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Loading Animation for Generation */
.generation-loading {
    text-align: center;
    padding: 40px;
}

.generation-loading .loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.generation-loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Script Content Styling */
.script-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.script-section h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.script-timing {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
}

.script-text {
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 10px;
}

.script-notes {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1976d2;
    border-left: 3px solid #2196f3;
}

/* Responsive Design for Modals */
@media (max-width: 768px) {
    .large-modal {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .enhancement-options {
        grid-template-columns: 1fr;
    }
    
    .form-section {
        grid-template-columns: 1fr;
    }
    
    .modal-actions,
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-actions button,
    .result-actions button {
        width: 100%;
        max-width: 200px;
    }
}

/* Slide Preview */
.slide-preview {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.slide-preview h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.preview-content {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.slide-thumbnail {
    display: inline-block;
    margin: 5px;
    padding: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    max-width: 200px;
}

/* Original Slides Summary */
.original-slides-summary {
    margin-bottom: 25px;
    padding: 20px;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.original-slides-summary h4 {
    color: #1976d2;
    margin-bottom: 15px;
}

/* Comparison Tabs */
.comparison-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    padding: 5px;
    border-radius: 8px;
}

.comparison-tabs .tab-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.comparison-tabs .tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.comparison-tabs .tab-btn:hover:not(.active) {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

/* Slide Content Areas */
.slide-content-area {
    margin-bottom: 20px;
}

/* Side by Side Comparison */
.side-by-side-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.comparison-panel {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.comparison-panel h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* Improvement Summary */
.improvement-summary {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--success-color);
}

.improvement-summary h4 {
    color: #2e7d32;
    margin-bottom: 15px;
}

.improvement-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.improvement-icon {
    color: var(--success-color);
    margin-right: 10px;
    font-size: 1.2rem;
    margin-top: 2px;
}

.improvement-text {
    color: var(--text-primary);
    line-height: 1.5;
}

/* Enhanced Slide Items */
.slide-item.enhanced {
    position: relative;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.slide-item.enhanced::before {
    content: attr(data-slide-number);
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
}

.slide-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 15px;
}

.slide-main-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.slide-design-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.design-element {
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.design-element .element-type {
    font-weight: bold;
    color: var(--primary-color);
}

/* Additional Button Styles */
.tertiary-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tertiary-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* File Processing Indicator */
.processing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #e3f2fd;
    border-radius: 8px;
    margin-top: 15px;
}

.processing-indicator .loader {
    width: 20px;
    height: 20px;
    border: 2px solid #90caf9;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.processing-text {
    color: #1976d2;
    font-weight: 500;
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
    .side-by-side-comparison {
        grid-template-columns: 1fr;
    }
    
    .slide-layout {
        grid-template-columns: 1fr;
    }
    
    .comparison-tabs {
        flex-direction: column;
    }
    
    .comparison-tabs .tab-btn {
        margin-bottom: 5px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}
