:root {
    --primary: #ec4899;
    --primary-dark: #db2777;
    --primary-light: #f472b6;
    --secondary: #6366f1;
    --accent: #06b6d4;
    --success: #5fb878;
    --warning: #ffb800;
    --error: #ff5722;
    --bg-dark: #1a1a2e;
    --bg-card: #252542;
    --bg-card-hover: #2d2d4a;
    --text-primary: #f8fafc;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c7c;
    --border: #3d3d5c;
    --gradient-1: linear-gradient(135deg, #ec4899 0%, #6366f1 100%);
    --gradient-2: linear-gradient(135deg, #06b6d4 0%, #ec4899 100%);
    --gradient-success: linear-gradient(135deg, #5fb878 0%, #06b6d4 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* 背景动画 */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.bg-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(6, 182, 212, 0.05) 0%, transparent 40%);
    animation: bgMove 20s ease-in-out infinite;
}

@keyframes bgMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2%, 2%) rotate(1deg); }
    50% { transform: translate(0, 4%) rotate(0deg); }
    75% { transform: translate(-2%, 2%) rotate(-1deg); }
}

/* 头部样式 */
.header {
    background: rgba(37, 37, 66, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 15px 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 45px;
    height: 45px;
    background: var(--gradient-1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.3);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(236, 72, 153, 0.2);
}

.nav-item.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.header-badge {
    background: var(--gradient-2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: white;
}

/* 容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Hero区域 */
.hero {
    text-align: center;
    padding: 40px 0;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin-bottom: 15px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* 主网格布局 */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* 卡片样式 - 覆盖layui默认样式 */
.layui-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: none;
    transition: all 0.3s ease;
}

.layui-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 40px rgba(236, 72, 153, 0.2);
}

.layui-card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.layui-card-header i {
    color: var(--primary-light);
    font-size: 18px;
}

.layui-card-body {
    padding: 20px;
    color: var(--text-primary);
}

/* 上传区域 */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(236, 72, 153, 0.02);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(236, 72, 153, 0.08);
}

.upload-zone.has-file {
    border-color: var(--success);
    background: rgba(95, 184, 120, 0.08);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
}

.upload-zone h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-zone .size-limit {
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 8px;
}

.upload-formats {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.format-tag {
    background: rgba(236, 72, 153, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--primary-light);
}

/* 进度条 - 覆盖layui样式 */
.layui-progress {
    background: var(--border);
    border-radius: 6px;
    height: 10px;
}

.layui-progress-bar {
    background: var(--gradient-1);
    border-radius: 6px;
}

.progress-container {
    display: none;
    margin-top: 20px;
}

.progress-container.show {
    display: block;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-text {
    color: var(--text-secondary);
}

.progress-percent {
    font-weight: 600;
    color: var(--primary-light);
}

/* 图片预览 */
.image-preview {
    display: none;
    margin-top: 20px;
}

.image-preview.show {
    display: block;
}

.image-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.image-container img {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 8px;
}

.image-info {
    margin-top: 15px;
    padding: 15px;
    background: rgba(236, 72, 153, 0.1);
    border-radius: 12px;
}

.image-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.image-info-row:last-child {
    border-bottom: none;
}

.image-info-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.image-info-value {
    font-weight: 500;
    color: var(--text-primary);
}

.image-info-value.success {
    color: var(--success);
}

/* URL显示 */
.url-display {
    display: none;
    margin-top: 20px;
}

.url-display.show {
    display: block;
}

.url-box {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* 覆盖layui输入框样式 */
.layui-input,
.layui-textarea {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
}

.layui-input:focus,
.layui-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

.url-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    color: var(--text-primary) !important;
    font-family: monospace;
    font-size: 13px;
}

/* 按钮样式 - 覆盖layui */
.layui-btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.layui-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.layui-btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.layui-btn-normal {
    background: var(--accent);
    border-color: var(--accent);
}

.layui-btn-warm {
    background: var(--warning);
    border-color: var(--warning);
}

.layui-btn-danger {
    background: var(--error);
    border-color: var(--error);
}

.analyze-btn {
    width: 100%;
    padding: 15px 30px;
    margin-top: 20px;
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4);
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.analyze-btn.loading {
    background: var(--gradient-2);
}

.analyze-btn.completed {
    background: var(--gradient-success);
}

.reupload-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reupload-btn:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

/* 结果区域 */
.result-card {
    min-height: 500px;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--text-muted);
}

.result-placeholder i {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.result-placeholder p {
    font-size: 16px;
}

.result-content {
    display: none;
    max-height: 600px;
    overflow-y: auto;
}

.result-content.show {
    display: block;
}

.result-content::-webkit-scrollbar {
    width: 8px;
}

.result-content::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 4px;
}

.result-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.result-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Markdown样式 */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.8;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.markdown-body h1 { font-size: 1.8rem; }
.markdown-body h2 { font-size: 1.5rem; color: var(--primary-light); }
.markdown-body h3 { font-size: 1.25rem; }
.markdown-body p { margin-bottom: 16px; }
.markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}
.markdown-body li { margin-bottom: 8px; }
.markdown-body code {
    background: rgba(236, 72, 153, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.9em;
}
.markdown-body pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border);
}
.markdown-body pre code {
    background: transparent;
    padding: 0;
    font-size: 13px;
}
.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
}
.markdown-body strong {
    color: var(--primary-light);
}

/* 错误提示样式 */
.error-display {
    padding: 24px;
    border: 1px solid var(--error);
    border-radius: 12px;
    background: rgba(255, 87, 34, 0.1);
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-display .error-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: rgba(255, 87, 34, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--error);
}

.error-display .error-title {
    color: var(--error);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

.error-display .error-message {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 16px;
}

.error-display .error-hint {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.error-display .error-hint i {
    margin-right: 6px;
}

/* 状态指示器 */
.status-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(236, 72, 153, 0.1);
    border-radius: 12px;
    margin-bottom: 15px;
}

.status-indicator.show {
    display: flex;
}

.status-indicator.success {
    background: rgba(95, 184, 120, 0.1);
    border: 1px solid rgba(95, 184, 120, 0.3);
}

.status-indicator.error {
    background: rgba(255, 87, 34, 0.1);
    border: 1px solid rgba(255, 87, 34, 0.3);
}

.status-dot {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.success .status-dot {
    background: var(--success);
    animation: none;
}

.status-indicator.error .status-dot {
    background: var(--error);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.status-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-indicator.success .status-text {
    color: var(--success);
    font-weight: 500;
}

.status-indicator.error .status-text {
    color: var(--error);
    font-weight: 500;
}

/* 工具栏 */
.result-toolbar {
    display: none;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.result-toolbar.show {
    display: flex;
    flex-wrap: wrap;
}

.toolbar-btn {
    background: rgba(236, 72, 153, 0.2);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.toolbar-btn:hover {
    background: var(--primary);
}

.toolbar-btn.success-btn {
    background: rgba(95, 184, 120, 0.2);
}

.toolbar-btn.success-btn:hover {
    background: var(--success);
}

/* 完成弹窗 */
.completion-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.completion-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.completion-content {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    border: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(95, 184, 120, 0.3);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.completion-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    animation: bounceIn 0.5s ease 0.2s both;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.completion-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--success);
}

.completion-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.completion-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(95, 184, 120, 0.1);
    border-radius: 12px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.completion-btn {
    background: var(--gradient-success);
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.completion-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(95, 184, 120, 0.4);
}

/* 加载动画 */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.cursor-blink::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--primary);
}

@keyframes blink {
    50% { opacity: 0; }
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 14px;
}

.footer a {
    color: var(--primary-light);
    text-decoration: none;
}

/* 响应式 */
@media (max-width: 768px) {
    .header {
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .nav-menu {
        width: 100%;
        justify-content: center;
    }

    .header-badge {
        display: none;
    }

    .container {
        padding: 15px;
    }

    .hero {
        padding: 30px 0;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .upload-zone {
        padding: 30px 15px;
    }

    .upload-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .completion-stats {
        flex-direction: column;
        gap: 15px;
    }

    .result-toolbar {
        justify-content: center;
    }
}

/* 隐藏文件输入 */
#fileInput {
    display: none;
}

/* Layui Layer 弹窗黑色主题 */
.layui-layer {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

.layui-layer-title {
    background: var(--bg-dark) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: 12px 12px 0 0 !important;
}

.layui-layer-content {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.layui-layer-btn {
    background: var(--bg-dark) !important;
    border-top: 1px solid var(--border) !important;
    border-radius: 0 0 12px 12px !important;
}

.layui-layer-btn a {
    background: var(--primary) !important;
    border: none !important;
    color: white !important;
    border-radius: 6px !important;
    margin: 5px !important;
}

.layui-layer-btn a:hover {
    background: var(--primary-dark) !important;
}

.layui-layer-btn .layui-layer-btn1 {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
}

.layui-layer-btn .layui-layer-btn1:hover {
    border-color: var(--primary) !important;
    color: var(--primary-light) !important;
    background: transparent !important;
}

.layui-layer-close {
    color: var(--text-secondary) !important;
}

.layui-layer-close:hover {
    color: var(--text-primary) !important;
}

.layui-layer-msg {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4) !important;
}

.layui-layer-input {
    background: var(--bg-dark) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: 6px !important;
}

.layui-layer-input:focus {
    border-color: var(--primary) !important;
}

.layui-layer-shade {
    background-color: rgba(0, 0, 0, 0.7) !important;
}

.layui-layer-loading {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
}

.layui-layer-ico {
    filter: brightness(1.2);
}