* {
    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;
    background: linear-gradient(135deg, #0a1628 0%, #1a3a5c 50%, #2d5a87 100%);
    min-height: 100vh;
    color: #ffffff;
}

/* Logo 样式 */
.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* 登录页面样式 */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-header {
    margin-bottom: 40px;
}

.login-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 30px;
    color: #ffffff;
}

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

.form-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-input:focus {
    outline: none;
    border-color: #4a90d9;
    background: rgba(255, 255, 255, 0.15);
}

.login-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #4a90d9 0%, #6bb6ff 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(74, 144, 217, 0.4);
}

.back-link {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-decoration: none;
    margin-top: 20px;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #ffffff;
}

.error-msg {
    color: #ff6b6b;
    font-size: 13px;
    text-align: center;
    margin-top: 15px;
    display: none;
}

/* 顶部导航 */
.header {
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.logout-btn {
    padding: 10px 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: transparent;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 主内容区 */
.main-content {
    padding-top: 80px;
    min-height: 100vh;
}

/* 用户页面 - 聊天界面 */
.chat-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.message {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #4a90d9 0%, #6bb6ff 100%);
}

.message.ai .message-avatar {
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.ai-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
}

.message.user .message-content {
    background: rgba(74, 144, 217, 0.3);
    border: 1px solid rgba(74, 144, 217, 0.5);
    color: #ffffff;
}

.message.ai .message-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* AI 消息段落样式，提升阅读体验 */
.message.ai .message-content p {
    margin: 0 0 16px 0;
}

.message.ai .message-content p:last-child {
    margin-bottom: 0;
}

.message-image {
    max-width: 300px;
    border-radius: 12px;
    margin-top: 10px;
}

/* 消息中的图片预览样式 */
.message-image-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.uploaded-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
}

.image-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    word-break: break-all;
}

/* AI 审核结果样式 */
.review-result {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

.review-score {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.score-number {
    font-size: 48px;
    font-weight: 700;
    color: #6bb6ff;
}

.score-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.review-issues {
    margin-bottom: 15px;
}

.review-issues h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.review-issues ul {
    list-style: none;
    padding-left: 0;
}

.review-issues li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.review-issues li::before {
    content: '•';
    position: absolute;
    left: 5px;
    color: #6bb6ff;
}

.review-verdict {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.review-verdict.approved {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: #81c784;
}

.review-verdict.rejected {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.5);
    color: #ff6b6b;
}

/* 聊天输入区 */
.chat-input-area {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 15px;
    resize: none;
    min-height: 50px;
    max-height: 150px;
    font-family: inherit;
    overflow: hidden;
}

.chat-input::-webkit-scrollbar {
    display: none;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-input:focus {
    outline: none;
    border-color: #4a90d9;
}

.upload-btn {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.send-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #4a90d9 0%, #6bb6ff 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 217, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.image-preview {
    display: none;
    margin-top: 12px;
}

.preview-container {
    position: relative;
    display: inline-block;
    max-width: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.preview-image {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: cover;
    display: block;
}

.remove-preview {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 107, 107, 0.9);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-preview:hover {
    background: rgba(255, 82, 82, 1);
    transform: scale(1.1);
}

/* 管理员页面布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 70px;
}

.admin-sidebar {
    width: 260px;
    background: rgba(10, 22, 40, 0.9);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px 0;
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
}

.sidebar-menu li {
    padding: 16px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    border-left: 3px solid transparent;
}

.sidebar-menu li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.sidebar-menu li.active {
    background: rgba(74, 144, 217, 0.15);
    color: #6bb6ff;
    border-left-color: #6bb6ff;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.admin-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 25px;
    color: #ffffff;
}

/* 训练区域 */
.training-area {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 50px;
    text-align: center;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.training-area:hover {
    border-color: rgba(74, 144, 217, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.training-area.dragover {
    border-color: #6bb6ff;
    background: rgba(74, 144, 217, 0.1);
}

/* 案例类型选择器样式 */
.case-type-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.case-type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.case-type-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.case-type-option input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #4a90d9;
}

.case-type-option span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.training-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.training-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.case-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.case-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.case-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.case-info {
    padding: 12px;
}

.case-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* 规则编辑区 */
.rules-editor {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
}

.rule-item {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rule-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.rule-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    display: block;
}

.rule-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.rule-input:focus {
    outline: none;
    border-color: #4a90d9;
}

.save-rules-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #4a90d9 0%, #6bb6ff 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.save-rules-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 217, 0.4);
}

/* 隐藏文件输入 */
.hidden-input {
    display: none;
}

/* ====================== 图片预览模态框 ====================== */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
}

.image-preview-container {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-large {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* 响应式 */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .admin-content {
        margin-left: 0;
    }
    
    .admin-layout {
        flex-direction: column;
        padding-top: 70px;
    }
    
    .chat-container {
        padding: 15px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 10px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}
