/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Corporate Trust 色彩系统 */
    --primary-color: #1a56db;
    --primary-hover: #1e429f;
    --success-color: #047857;
    --warning-color: #d97706;
    --error-color: #dc2626;
    
    /* 中性色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7 eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 16px;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

/* ========== 容器与布局 ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
}

.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.main-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
}

/* ========== 输入区 ========== */
.input-section {
    margin-bottom: var(--spacing-lg);
}

.input-label {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.material-textarea {
    width: 100%;
    min-height: 300px;
    padding: var(--spacing-md);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.material-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.material-textarea::placeholder {
    color: var(--text-tertiary);
}

/* ========== 按钮样式 ========== */
.action-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.btn {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

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

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

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

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.btn-close:hover {
    color: var(--text-primary);
}

/* ========== 加载状态 ========== */
.loading-message {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: var(--spacing-lg);
}

.loading-icon {
    width: 24px;
    height: 24px;
    animation: rotate 1s linear infinite;
}

.loading-icon circle {
    stroke: var(--primary-color);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ========== 结果展示 ========== */
.result-container {
    margin-top: var(--spacing-xl);
    animation: fadeIn 0.3s ease-in;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.result-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.result-section {
    margin-bottom: var(--spacing-xl);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.section-title.success {
    color: var(--success-color);
}

.section-title.warning {
    color: var(--warning-color);
}

.section-title .icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.divider {
    height: 2px;
    background: var(--border-color);
    margin: var(--spacing-xl) 0;
}

/* ========== 列表样式 ========== */
.items-list {
    list-style: none;
}

.existing-items li {
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: #f0fdf4;
    border-left: 4px solid var(--success-color);
    border-radius: 4px;
}

.suggestions-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.suggestion-card {
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-left: 4px solid var(--warning-color);
}

.suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-sm);
}

.suggestion-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.priority-high {
    background: #fef2f2;
    color: var(--error-color);
}

.priority-medium {
    background: #fef3c7;
    color: var(--warning-color);
}

.suggestion-target {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.suggestion-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.suggestion-content {
    color: var(--text-secondary);
    line-height: 1.7;
}

.result-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--border-color);
}

/* ========== 错误提示 ========== */
.error-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--error-color);
    font-weight: 500;
    margin-bottom: var(--spacing-lg);
    animation: slideDown 0.3s ease-out;
}

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

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .title {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main-content {
        padding: var(--spacing-md);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .result-actions {
        flex-direction: column;
    }
}
