/* ========== 全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(145deg, #f0f7fa 0%, #e6f0f4 100%);
    min-height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px;
    box-shadow: 0 20px 40px -10px rgba(0, 32, 48, 0.2);
    padding: 2.2rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2.2rem;
    font-weight: 650;
    color: #0e3b4a;
    margin-bottom: 0.4rem;
}

h1 span {
    background: #1e5a6a;
    color: white;
    font-size: 1rem;
    padding: 0.2rem 1rem;
    border-radius: 40px;
    font-weight: 450;
}

.sub {
    font-size: 1.1rem;
    color: #3c6e7a;
    margin-bottom: 2rem;
    border-left: 6px solid #2f95a8;
    padding-left: 1.3rem;
    background: linear-gradient(to right, transparent, rgba(47, 149, 168, 0.04));
    line-height: 1.5;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.8rem;
    margin-bottom: 1.8rem;
}

@media (max-width: 800px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .container {
        padding: 1.5rem;
    }
}

.card {
    background: white;
    border-radius: 28px;
    padding: 1.8rem 1.6rem;
    box-shadow: 0 6px 16px rgba(0, 32, 48, 0.04);
    border: 1px solid rgba(100, 164, 176, 0.2);
    transition: transform 0.2s;
}

.card:hover {
    box-shadow: 0 12px 24px rgba(47, 149, 168, 0.08);
}

.card h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #0e5a67;
    margin-bottom: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #cbe9ef;
    padding-bottom: 0.7rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f6875;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
    margin-bottom: 0.4rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.9rem 1.3rem;
    border: 1.8px solid #ddeef2;
    border-radius: 24px;
    font-size: 0.98rem;
    background: #f9fdfe;
    transition: 0.18s;
    color: #103f4b;
    margin-bottom: 1.2rem;
}

input:focus, select:focus, textarea:focus {
    border-color: #2f95a8;
    background: white;
    box-shadow: 0 0 0 4px rgba(47, 149, 168, 0.08);
    outline: none;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.btn {
    background: #1d6a7a;
    color: white;
    border: none;
    padding: 0.9rem 1.8rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.15s;
    width: 100%;
    border: 1px solid #0f525f;
    box-shadow: 0 6px 0 #0a404b;
}

.btn:hover {
    background: #258396;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #0a404b;
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #0a404b;
}

.btn:disabled {
    opacity: 0.5;
    transform: none;
    box-shadow: 0 6px 0 #0a404b;
    pointer-events: none;
}

.status-badge {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1e6570;
    font-size: 0.85rem;
    font-weight: 500;
}

.secure-badge {
    background: #1e5a6a;
    color: white;
    padding: 0.25rem 1.1rem;
    border-radius: 30px;
    font-size: 0.75rem;
}

.feed-result {
    margin-top: 1rem;
    padding: 0.7rem 1.2rem;
    border-radius: 40px;
    font-size: 0.9rem;
    background: #edf5f7;
    color: #16616e;
}

.feed-success {
    background: #e1f0e8;
    color: #0f6e4a;
    border-left: 6px solid #2e9c6b;
}

.feed-error {
    background: #ffe8e6;
    color: #b13b2e;
    border-left: 6px solid #c63b2e;
}

hr {
    margin: 1.8rem 0 1.2rem;
    border: none;
    border-top: 2px dashed #cbe1e6;
}

.footer-note {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: #5f8691;
}

/* ===== 输出区域样式 ===== */
.output-area {
    background: #f2f9fb;
    border-radius: 22px;
    padding: 1.5rem;
    min-height: 500px;
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.96rem;
    line-height: 1.65;
    color: #0a3842;
    border: 1px solid #b7d9e0;
    font-family: 'Inter', 'SF Mono', monospace;
    text-align: left;
}

/* ===== 对话消息样式 ===== */
.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 1.2rem;
    animation: fadeIn 0.3s;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: #1d6a7a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: #2f95a8;
}

.message-content {
    background: white;
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    border-top-left-radius: 4px;
    max-width: 80%;
    line-height: 1.5;
    color: #0a3842;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.user-message .message-content {
    background: #e1f0f4;
    border-top-right-radius: 4px;
    border-top-left-radius: 20px;
}

.ai-message {
    flex-direction: row;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    margin-left: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-dots:after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* ===== 系统提示区域样式 ===== */
.system-prompt-area {
    background: #f0f9fc;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #1d6a7a;
}

/* ===== 文件状态样式（保留以备将来使用） ===== */
.file-status-success {
    color: #0f6e4a;
    background: #e1f0e8;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    display: inline-block;
    font-size: 0.8rem;
}

.file-status-error {
    color: #b13b2e;
    background: #ffe8e6;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    display: inline-block;
    font-size: 0.8rem;
}

.file-status-waiting {
    color: #5f8691;
    background: #e9f0f2;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    display: inline-block;
    font-size: 0.8rem;
}

.file-status-loading {
    color: #1e5a6a;
    background: #d5eef2;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    display: inline-block;
    font-size: 0.8rem;
    position: relative;
    padding-left: 1.8rem;
}

.file-status-loading:before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0.4rem;
    width: 0.8rem;
    height: 0.8rem;
    border: 2px solid #1e5a6a;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== 脚本项样式（保留以备将来使用） ===== */
.script-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px dashed #cbe1e6;
}

.script-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.script-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
}

.script-badge {
    background: #1e5a6a;
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    font-size: 0.8rem;
    margin-right: 0.8rem;
    display: inline-block;
}

.script-temp {
    font-size: 0.8rem;
    color: #2a6877;
}