/*
 * ContentFlow - 专业级 AI 智能改写引擎
 * 现代化、响应式、用户友好的界面设计
 */

:root {
    --primary-color: #6366F1;
    --primary-hover: #4F46E5;
    --primary-light: #E0E7FF;
    --secondary-color: #10B981;
    --secondary-hover: #059669;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --success-color: #10B981;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --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), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo h1 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.tagline {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav {
    display: flex;
    gap: 8px;
}

/* Main */
.main {
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

/* Quick Config Cards */
.quick-config {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.config-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.config-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.config-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.config-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.config-card-body {
    padding: 20px;
}

.form-group-inline {
    display: flex;
    gap: 8px;
}

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.editor-panel {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-actions .stats {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
}

.editor {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 24px;
    border: none;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.editor:focus {
    outline: none;
}

.result-area {
    background: var(--bg-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

/* Custom Requirement Section */
.custom-requirement-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.custom-requirement-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.requirement-selector {
    margin-bottom: 20px;
}

.requirement-selector label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.requirement-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.tag-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.tag-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.requirement-input {
    margin-top: 16px;
}

.requirement-input label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Form Elements */
.input,
.select,
.textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.textarea {
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.help-text a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-icon,
.btn-icon-small,
.btn-link,
.btn-test {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 700;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-icon,
.btn-icon-small {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.btn-icon:hover,
.btn-icon-small:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.panel-header .btn-icon-small {
    color: rgba(255, 255, 255, 0.9);
}

.panel-header .btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-link {
    padding: 8px 16px;
    background: transparent;
    color: var(--primary-color);
    font-size: 14px;
}

.btn-link:hover {
    background: var(--primary-light);
}

.btn-test {
    padding: 10px 16px;
    font-size: 13px;
    background: var(--secondary-color);
    color: white;
    flex-shrink: 0;
}

.btn-test:hover {
    background: var(--secondary-hover);
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* Advanced Params */
.advanced-params {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.advanced-params h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.param-value {
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.param-desc {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* Slider */
.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.stat-item {
    text-align: center;
    padding: 20px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.stat-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

/* Prompt Viewer */
.prompt-viewer {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.prompt-toggle {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.prompt-toggle:hover {
    background: var(--border-color);
}

.prompt-content {
    padding: 20px;
}

.prompt-editor {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    margin-top: 48px;
    text-align: center;
}

.footer p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.footer-note {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 12px;
}

.footer-links {
    font-size: 12px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 14px 24px;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .quick-config {
        grid-template-columns: 1fr;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .params-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .logo h1 {
        font-size: 20px;
    }

    .tagline {
        font-size: 12px;
    }

    .quick-config {
        gap: 16px;
    }

    .action-bar {
        flex-direction: column;
        width: 100%;
    }

    .action-bar button {
        width: 100%;
    }

    .stats-panel {
        grid-template-columns: 1fr;
    }

    .requirement-tags {
        flex-direction: column;
    }

    .tag-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .editor {
        min-height: 300px;
        padding: 16px;
        font-size: 14px;
    }

    .config-card-body {
        padding: 16px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

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

.editor-panel,
.config-card,
.custom-requirement-section,
.advanced-params,
.stats-panel,
.prompt-viewer {
    animation: fadeIn 0.3s ease-out;
}