/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    color: #666;
}

/* API配置面板样式 */
.api-config-panel {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #667eea;
}

.api-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.api-config-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 1.1rem;
}

.toggle-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.test-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.test-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.test-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.api-key-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-key-container input {
    flex: 1;
}

.api-config-content {
    border-top: 1px solid #e1e5e9;
    padding-top: 15px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.status-indicator {
    font-size: 1.2rem;
}

.status-indicator.offline {
    color: #e74c3c;
}

.status-indicator.online {
    color: #27ae60;
}

.status-indicator.loading {
    color: #f39c12;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.status-text {
    font-weight: 500;
}

/* 加载状态样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #c3e6cb;
}

/* 表单验证样式 */
.form-group input.error,
.form-group select.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.field-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: 500;
}

/* Claude分析结果样式 */
.claude-analysis {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
}

/* 代理服务器状态样式 */
.proxy-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
}

.proxy-indicator {
    font-size: 1rem;
}

.proxy-indicator.online {
    color: #27ae60;
}

.proxy-indicator.offline {
    color: #e74c3c;
}

/* 设置帮助样式 */
.setup-help {
    margin-top: 15px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.setup-help h4 {
    margin: 0 0 10px 0;
    color: #1976d2;
    font-size: 1rem;
}

.setup-help ol {
    margin: 10px 0 0 20px;
    color: #424242;
}

.setup-help li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.setup-help code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: #d32f2f;
}

/* 连接状态指示器 */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 10px;
}

.connection-status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.connection-status.checking {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 输入部分样式 */
.input-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid #667eea;
    padding-left: 12px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.required {
    color: #e74c3c;
    font-weight: bold;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    width: auto;
    margin-right: 5px;
}

/* 按钮样式 */
.buttons {
    text-align: center;
    margin: 30px 0;
}

.primary-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(102, 126, 234, 0.4);
}

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

/* 结果部分样式 */
.results-section {
    margin-top: 40px;
}

.results-section h2 {
    text-align: center;
    color: white;
    font-size: 2rem;
    margin-bottom: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.result-card {
    background: rgba(255, 255, 255, 0.95);
    margin-bottom: 25px;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.result-card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.result-summary {
    margin-bottom: 20px;
}

.result-summary p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.highlight {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 600;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.highlight-text {
    background: #ffeaa7;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: #2d3436;
    display: inline-block;
    margin: 2px 0;
}

.note {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}

.note p {
    margin-bottom: 8px;
}

.note p:last-child {
    margin-bottom: 0;
}

/* 表格样式 */
.payment-table,
.duration-table,
.selection-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.payment-table th,
.duration-table th,
.selection-table th,
.payment-table td,
.duration-table td,
.selection-table td {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #e1e5e9;
}

.payment-table th,
.duration-table th,
.selection-table th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.payment-table td,
.duration-table td,
.selection-table td {
    font-size: 0.9rem;
}

.payment-table tr:nth-child(even),
.duration-table tr:nth-child(even),
.selection-table tr:nth-child(even) {
    background: #f8f9fa;
}

.payment-table tr:hover,
.duration-table tr:hover,
.selection-table tr:hover {
    background: #e3f2fd;
}

.summary-box {
    background: #f1f3f4;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #4caf50;
}

.summary-box p {
    margin-bottom: 10px;
}

/* 图表样式 */
canvas {
    margin: 20px 0;
    max-height: 400px;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 推荐建议样式 */
.recommendation {
    border: 3px solid #4caf50;
    background: linear-gradient(135deg, #a8e6cf, #88d8a3);
}

.recommendation h3 {
    color: #2e7d32;
    border-bottom-color: #4caf50;
}

.recommendations p {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
    line-height: 1.6;
}

.recommendations strong {
    color: #2e7d32;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .input-sections {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .section {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .primary-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .payment-table,
    .duration-table,
    .selection-table {
        font-size: 0.8rem;
    }
    
    .payment-table th,
    .duration-table th,
    .selection-table th,
    .payment-table td,
    .duration-table td,
    .selection-table td {
        padding: 8px 4px;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .section {
        padding: 15px;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .payment-table,
    .duration-table,
    .selection-table {
        font-size: 0.7rem;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    .payment-table tbody,
    .duration-table tbody,
    .selection-table tbody {
        display: table;
        width: 100%;
    }
}