/* AI客服配置系统样式 */
:root {
    --primary-color: #2563eb;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    color: var(--gray-600);
}

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 表单样式 */
.config-section, 
.status-section, 
.preview-section, 
.edit-section, 
.applied-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.config-section h2,
.status-section h3,
.preview-section h3,
.edit-section h3,
.applied-section h3 {
    color: var(--gray-900);
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--gray-600);
    font-size: 14px;
}

/* 按钮样式 */
.btn-primary,
.btn-success,
.btn-secondary,
.btn-outline {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #15803d;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray-600);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-700);
    transform: translateY(-2px);
}

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

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

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

/* 状态日志 */
.status-log {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 1.4;
}

.status-log .log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
}

.status-log .log-info {
    color: var(--primary-color);
}

.status-log .log-success {
    color: var(--success-color);
}

.status-log .log-warning {
    color: var(--warning-color);
}

.status-log .log-error {
    color: var(--danger-color);
}

/* 指令预览 */
.instruction-preview {
    background: var(--gray-50);
    border-radius: 8px;
    overflow: hidden;
}

.instruction-preview pre {
    padding: 20px;
    margin: 0;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

/* 编辑器 */
#instructionEditor {
    width: 100%;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

#instructionEditor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 预览和编辑操作按钮 */
.preview-actions,
.edit-actions,
.applied-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* 成功应用状态 */
.success-info {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.phone-info {
    text-align: center;
    margin-bottom: 24px;
}

.phone-info h4 {
    color: var(--success-color);
    margin-bottom: 12px;
}

.phone-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

.phone-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    background: white;
    padding: 16px;
    border-radius: 8px;
    display: inline-block;
    letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.call-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--success-color);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.call-button:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
    text-decoration: none;
    color: white;
}

.call-button:active {
    transform: translateY(0);
}

.features h4 {
    color: var(--gray-800);
    margin-bottom: 12px;
}

.features ul {
    list-style: none;
    padding: 0;
}

.features li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

.features li:before {
    content: "✓ ";
    color: var(--success-color);
    font-weight: bold;
    margin-right: 8px;
}

.features li:last-child {
    border-bottom: none;
}


/* 模态框样式 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: var(--gray-600);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--gray-900);
}

#fullInstructionContent {
    background: var(--gray-50);
    padding: 20px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 60vh;
    overflow-y: auto;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

footer p {
    margin-bottom: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .phone-display {
        gap: 12px;
    }
    
    .phone-number {
        font-size: 1.5rem;
        letter-spacing: 1px;
        padding: 12px;
    }
    
    .call-button {
        font-size: 1.2rem;
        padding: 14px 28px;
        width: auto;
        min-width: 160px;
    }
    
    .preview-actions,
    .edit-actions,
    .applied-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-success,
    .btn-secondary,
    .btn-outline {
        justify-content: center;
        text-align: center;
    }
}

/* 加载文本样式 */
.loading-text {
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
}

/* 过渡动画 */
.config-section,
.status-section,
.preview-section,
.edit-section,
.applied-section {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

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

/* 显示/隐藏状态 */
.hidden {
    display: none !important;
}

.show {
    display: block !important;
}