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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* 登录页面样式 - 科幻离子风格 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #0a0e27;
    position: relative;
    overflow: hidden;
}

/* 动态背景 */
.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at top, rgba(75, 0, 130, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(0, 150, 255, 0.3) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    100% {
        opacity: 0.9;
        transform: scale(1.1);
    }
}

/* 粒子背景效果 */
.login-page::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(100, 200, 255, 0.4), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(200, 100, 255, 0.3), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 90% 60%, rgba(100, 200, 255, 0.3), transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    animation: stars 20s linear infinite;
}

@keyframes stars {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow:
        0 8px 32px 0 rgba(0, 150, 255, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(100, 200, 255, 0.05);
    position: relative;
    overflow: hidden;
}

/* 登录框发光效果 */
.login-box::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        #00d4ff, #7b2cbf, #00d4ff, #7b2cbf);
    border-radius: 20px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
    animation: rotate 4s linear infinite;
}

.login-box:hover::before {
    opacity: 0.3;
}

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

.login-box h1 {
    text-align: center;
    background: linear-gradient(135deg, #00d4ff 0%, #7b2cbf 50%, #00d4ff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 2px;
    animation: shine 3s linear infinite;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 40px;
    font-size: 14px;
    letter-spacing: 1px;
}

.error-message {
    background: rgba(255, 50, 100, 0.1);
    border: 1px solid rgba(255, 50, 100, 0.3);
    color: #ff6b9d;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 25px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-group input {
    width: 100%;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(100, 200, 255, 0.2);
    border-radius: 10px;
    font-size: 15px;
    color: #fff;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

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

.form-group input:focus {
    outline: none;
    border-color: #00d4ff;
    background: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 0 20px rgba(0, 212, 255, 0.3),
        inset 0 0 20px rgba(0, 212, 255, 0.05);
}

.btn {
    padding: 15px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff 0%, #7b2cbf 100%);
    color: white;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    position: relative;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    box-shadow:
        0 0 30px rgba(0, 212, 255, 0.6),
        0 0 60px rgba(123, 44, 191, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.login-hint {
    margin-top: 20px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* 后台布局样式 */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 30px 20px;
    background: #1a252f;
}

.sidebar-header h2 {
    font-size: 20px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background 0.3s;
}

.menu-item:hover {
    background: #34495e;
}

.menu-item.active {
    background: #667eea;
}

.menu-item .icon {
    margin-right: 12px;
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: #ecf0f1;
}

.user-info .icon {
    margin-right: 10px;
}

.logout-btn {
    display: block;
    text-align: center;
    padding: 10px;
    background: #e74c3c;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #c0392b;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    background: #f5f5f5;
    min-height: 100vh;
}

.content-header {
    margin-bottom: 30px;
}

.content-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.content-header p {
    color: #7f8c8d;
}

.content-body {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Dashboard卡片 */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.card p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.card-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.card-link:hover {
    text-decoration: underline;
}

.info-section {
    margin-top: 30px;
}

.info-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.info-section ul {
    list-style: none;
}

.info-section li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
}

.info-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* 工具页面样式 */
.tool-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
}

.input-section label, .output-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.model-select, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.model-select:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.result-area {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    min-height: 300px;
    overflow-y: auto;
}

.result-area .placeholder {
    color: #999;
    text-align: center;
    padding-top: 100px;
}

.result-area img {
    max-width: 100%;
    border-radius: 5px;
}

.result-area pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #333;
}

#copyBtn {
    margin-top: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .tool-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .main-content {
        margin-left: 0;
    }
}

/* 多轮对话页面样式 */
.conversation-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    height: calc(100vh - 180px);
}

.model-selection-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.model-selection-panel h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 16px;
}

.model-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #e9ecef;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: #333;
}

.conversation-area {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.welcome-message h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.welcome-message ul {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.welcome-message li {
    padding: 8px 0;
    color: #667eea;
}

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

.user-message-group {
    display: flex;
    justify-content: flex-end;
}

.user-message {
    background: #667eea;
    color: white;
    border-radius: 10px;
    padding: 15px;
    max-width: 70%;
}

.user-message .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    opacity: 0.9;
}

.user-message .message-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.assistant-message-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-response-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
}

.model-response-card.loading {
    background: #f8f9fa;
}

.model-response-card.error {
    border-color: #ff4444;
    background: #fff5f5;
}

.model-response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.model-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.message-time {
    font-size: 12px;
    color: #999;
}

.model-response-content {
    color: #333;
}

.model-response-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    font-family: inherit;
    line-height: 1.6;
}

.error-message {
    color: #ff4444;
    margin: 0;
}

.loading-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    justify-content: center;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

.input-area {
    border-top: 1px solid #e9ecef;
    padding: 20px;
    background: white;
}

.input-area textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    margin-bottom: 10px;
}

.input-area textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-controls {
    display: flex;
    justify-content: flex-end;
}

/* 响应式设计 - 对话页面 */
@media (max-width: 768px) {
    .conversation-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .model-selection-panel {
        order: 2;
    }

    .conversation-area {
        order: 1;
        min-height: 500px;
    }

    .user-message {
        max-width: 85%;
    }
}

/* ==================== 图文对话样式 ==================== */

.image-chat-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.upload-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 60px 40px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: #e8edff;
    transform: scale(1.02);
}

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

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 14px;
    color: #888;
}

.image-preview {
    text-align: center;
    margin-bottom: 25px;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-bottom: 15px;
}

.remove-image-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.remove-image-btn:hover {
    background: #c82333;
}

.text-input-section {
    margin-top: 25px;
}

.text-input-section label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
}

.text-input-section textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
}

.text-input-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#sendBtn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
}

#sendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.response-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.response-section h3 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    font-size: 20px;
}

.response-content {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 20px;
    border-radius: 5px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.response-content strong {
    color: #667eea;
}

.response-content em {
    color: #764ba2;
}

#newAnalysisBtn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loading-overlay .loading-spinner {
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay p {
    font-size: 18px;
    font-weight: 600;
}

/* 响应式设计 - 图文对话 */
@media (max-width: 768px) {
    .upload-section {
        padding: 20px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-icon {
        font-size: 36px;
    }

    .image-preview img {
        max-height: 300px;
    }

    .response-section {
        padding: 20px;
    }
}
