/* Generator Page Styles - Enhanced */
.generator-page {
    padding: 40px 20px 80px;
    min-height: calc(100vh - 70px);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.page-header {
    text-align: center;
    margin-bottom: 50px;
}

.page-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Generator Layout */
.generator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 60px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.input-panel,
.result-panel {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    border: 1px solid var(--border-color);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.panel-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-advanced {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.toggle-advanced:hover {
    background: var(--bg-light);
}

.toggle-icon {
    transition: transform 0.3s;
}

.toggle-advanced.active .toggle-icon {
    transform: rotate(180deg);
}

/* Form Styles */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 600;
    color: var(--text-primary);
}

.label-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.2s;
    font-family: inherit;
    background: var(--bg-white);
}

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

.prompt-input {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Advanced Options */
.advanced-options {
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.slider-value {
    text-align: right;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Prompt Templates */
.prompt-templates {
    margin-top: 10px;
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    text-decoration: underline;
}

.templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.template-item {
    padding: 10px 15px;
    background: var(--bg-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    border: 1px solid transparent;
}

.template-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
}

.btn-generate {
    margin-top: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-icon {
    font-size: 18px;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Result Panel */
.result-panel {
    min-height: 600px;
}

.result-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-item {
    padding: 4px 8px;
    background: var(--bg-light);
    border-radius: 4px;
}

.result-content {
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.feature-tips {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
}

.tip-icon {
    font-size: 20px;
}

.result-image-container {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-light);
    margin-bottom: 20px;
    position: relative;
}

.result-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.result-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.result-actions .btn {
    width: 100%;
}

/* Tips Section */
.tips-section {
    margin-top: 60px;
    padding: 40px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.tips-section h3 {
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.tip-card {
    padding: 25px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s;
}

.tip-card:hover {
    transform: translateY(-3px);
}

.tip-number {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 15px;
}

.tip-card h4 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.tip-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--bg-light);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: var(--text-primary);
}

/* Compare Container */
.compare-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.compare-item {
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
}

.compare-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.compare-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.compare-text.original {
    border-left: 3px solid #e5e7eb;
    padding-left: 15px;
}

.compare-text.polished {
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
}

/* Code Input */
.code-input {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* Result Text Container */
.result-text-container {
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
    min-height: 200px;
}

.result-text-container .translated-text,
.result-text-container .summary-text,
.result-text-container .polished-text,
.result-text-container .explanation-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.result-text-container code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.result-text-container pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 15px 0;
}

.result-text-container pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* Examples Section */
.examples-section {
    margin-top: 40px;
    padding: 40px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.examples-section h3 {
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.example-item {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.example-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.example-image {
    width: 100%;
    height: 200px;
    background: var(--bg-light);
    overflow: hidden;
    position: relative;
}

.example-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.example-item:hover .example-image img {
    transform: scale(1.1);
}

.example-info {
    padding: 20px;
    background: var(--bg-white);
}

.example-info h4 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.example-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error/Success Messages */
.error-message,
.success-message {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

/* Text Result Styles */
.result-text-container {
    background: var(--bg-light);
    padding: 30px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.generated-text {
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    font-size: 16px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Code Result Styles */
.result-code-container {
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
}

.result-code-container pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 25px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    max-height: 600px;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.result-code-container code {
    color: inherit;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Example Icon */
.example-icon {
    font-size: 48px;
    text-align: center;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius) var(--radius) 0 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .generator-layout {
        grid-template-columns: 1fr;
    }
    
    .result-panel {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .generator-page {
        padding: 20px 15px 60px;
    }
    
    .page-title {
        font-size: 32px;
    }
    
    .page-subtitle {
        font-size: 16px;
    }
    
    .input-panel,
    .result-panel {
        padding: 20px;
    }
    
    .panel-header h2 {
        font-size: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        grid-template-columns: 1fr;
    }
    
    .tips-section,
    .examples-section {
        padding: 25px 20px;
    }
    
    .tips-grid,
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    /* 移动端结果文本优化 */
    .result-text-container {
        padding: 20px 15px;
        max-height: none;
        overflow-y: visible;
    }
    
    .generated-text {
        font-size: 15px;
        line-height: 1.7;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .result-content {
        min-height: auto;
    }
}

@media (max-width: 480px) {
    .generator-page {
        padding: 15px 12px 50px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .page-subtitle {
        font-size: 14px;
    }
    
    .input-panel,
    .result-panel {
        padding: 16px;
    }
    
    .panel-header h2 {
        font-size: 18px;
    }
    
    .form-section {
        gap: 16px;
    }
    
    .tips-section,
    .examples-section {
        padding: 20px 16px;
    }
    
    .example-image {
        height: 150px;
    }
    
    /* 小屏幕结果文本优化 */
    .result-text-container {
        padding: 16px 12px;
        margin-bottom: 15px;
    }
    
    .generated-text {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .result-stats {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
    }
    
    .stat-item {
        padding: 3px 6px;
    }
    
    /* 代码结果移动端优化 */
    .result-code-container pre {
        padding: 15px 12px;
        font-size: 12px;
        line-height: 1.5;
        max-height: 400px;
    }
    
    .result-text-container pre {
        padding: 15px 12px;
        font-size: 12px;
        overflow-x: auto;
    }
}
