/* 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;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 20px;
}

.model-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.model-badge, .status-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
}

.status-badge {
    font-weight: 600;
}

.status-badge.active {
    background: rgba(76, 175, 80, 0.3);
}

.status-badge.inactive {
    background: rgba(244, 67, 54, 0.3);
}

/* Main Content */
main {
    padding: 40px;
}

.task-section {
    margin-bottom: 40px;
}

.task-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

#task-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#task-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#task-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Workflow Steps */
.workflow-steps {
    margin: 40px 0;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 15px;
}

.workflow-steps h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border-left: 4px solid #e0e0e0;
    transition: all 0.3s;
}

.step.active {
    border-left-color: #667eea;
    background: #f0f4ff;
}

.step.completed {
    border-left-color: #4caf50;
    background: #f1f8f4;
}

.step.error {
    border-left-color: #f44336;
    background: #ffebee;
}

.step-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #666;
    flex-shrink: 0;
}

.step.active .step-icon {
    background: #667eea;
    color: white;
}

.step.completed .step-icon {
    background: #4caf50;
    color: white;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    margin-bottom: 5px;
    color: #333;
}

.step-status {
    color: #666;
    font-size: 0.9em;
}

/* Results Section */
.results-section {
    margin-top: 40px;
}

.results-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.results-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-pane.active {
    display: block;
}

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

.formatted-content {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 10px;
    line-height: 1.8;
    font-size: 1.05em;
    max-height: none;
    overflow-y: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.final-document {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.final-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.formatted-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    background: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
}

.formatted-content h1,
.formatted-content h2,
.formatted-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
}

.formatted-content h1 { font-size: 1.8em; }
.formatted-content h2 { font-size: 1.5em; }
.formatted-content h3 { font-size: 1.3em; }

.formatted-content ul,
.formatted-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.formatted-content li {
    margin-bottom: 8px;
}

.formatted-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.formatted-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

.formatted-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.formatted-content table th,
.formatted-content table td {
    border: 1px solid #e0e0e0;
    padding: 10px;
    text-align: left;
}

.formatted-content table th {
    background: #667eea;
    color: white;
}

/* Error Section */
.error-section {
    margin-top: 30px;
    padding: 20px;
    background: #ffebee;
    border-left: 4px solid #f44336;
    border-radius: 8px;
}

.error-message h3 {
    color: #f44336;
    margin-bottom: 10px;
}

.error-message p {
    color: #c62828;
    line-height: 1.6;
}

/* Status Message */
.status-message {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    color: #1976d2;
    display: none;
}

/* Footer */
footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    main {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .results-tabs {
        overflow-x: auto;
    }
    
    .tab-btn {
        white-space: nowrap;
    }
}
