/* 基础样式 */
:root {
    --bg-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --index-button-color: #4fa0ff;
    /* 8个模块按钮颜色变量 */
    --btn-mod1-color: #dfffb0;
    --btn-mod2-color: #fff98e;
    --btn-mod3-color: #94bccd;
    --btn-mod4-color: #a1f4ff;
    --btn-mod5-color: #d2b8ff;
    --btn-mod6-color: #ff8a8a;
    --btn-mod7-color: #2bff94;
    --btn-mod8-color: #4fa0ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color, var(--theme-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%)));
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(-3px);
}

/* 主导航 */
.main-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.nav-item {
    background: white;
    padding: 30px 20px;
    border-radius: 15px;
    text-decoration: none;
    color: #333;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.nav-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* 主题启用后，首页模块按钮统一色（仅在 body.themed 下生效） */
body.themed .main-nav .nav-item {
    background: var(--index-button-color) !important;
    color: #fff !important;
}

/* 默认渐变样式（未登录时显示） */
.nav-item.shuxin { background: linear-gradient(135deg, #dfffb0, #ccffdc); color: #333; }
.nav-item.featured { background: linear-gradient(135deg, #fff98e, #ffb532); color: #333; }
.nav-item.neizon { background: linear-gradient(135deg, #94bccd, #c4ffd3); color: #333; }
.nav-item.chuanjiabao { background: linear-gradient(135deg, #a1f4ff, #4fa0ff); color: #333; }
.nav-item.godface { background: linear-gradient(135deg, #d2b8ff, #ffcbb5); color: #333; }
.nav-item.mixblod { background: linear-gradient(135deg, #ff8a8a, #bfff79); color: #333; }
.nav-item.update { background: linear-gradient(135deg, #2bff94, #2dcbff); color: #333; }

/* 主题启用后，8个模块分别使用各自的颜色变量 */
body.themed .main-nav .nav-item.shuxin { background: var(--btn-mod1-color) !important; }
body.themed .main-nav .nav-item.featured { background: var(--btn-mod2-color) !important; }
body.themed .main-nav .nav-item.neizon { background: var(--btn-mod3-color) !important; }
body.themed .main-nav .nav-item.chuanjiabao { background: var(--btn-mod4-color) !important; }
body.themed .main-nav .nav-item.godface { background: var(--btn-mod5-color) !important; }
body.themed .main-nav .nav-item.mixblod { background: var(--btn-mod6-color) !important; }
body.themed .main-nav .nav-item.update { background: var(--btn-mod7-color) !important; }
body.themed .main-nav .nav-item:nth-child(8) { background: var(--btn-mod8-color) !important; }

.nav-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.nav-item span {
    display: block;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.nav-item small {
    color: #666;
    font-size: 0.9rem;
}

/* 头像显示区域与圆角样式 */
.header-user-display {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-mini,
#userAvatar,
#headerAvatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 按钮与输入统一样式 */
.btn {
    display:inline-block;
    padding:10px 16px;
    border-radius:12px;
    font-weight:600;
    color:#fff;
    text-decoration:none;
    cursor:pointer;
    transition:all 0.25s ease;
    border:none;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}
.btn-square { border-radius:6px; }
.btn-small { padding:6px 10px; font-size:0.85rem; }
.btn-gradient-og { background: linear-gradient(135deg, #ff7e5f, #2ecc71); }
.btn-gradient-og:hover { box-shadow: 0 6px 16px rgba(46, 204, 113, 0.35); }
.btn-gradient-pb { background: linear-gradient(135deg, #ff9a9e, #6dd5ed); }
.btn-gradient-pb:hover { box-shadow: 0 6px 16px rgba(109, 213, 237, 0.35); }
.btn-list { list-style:none; padding:0; margin:0; display:flex; gap:8px; flex-wrap:wrap; }
.input {
    background:#fff;
    color:#333;
    border:1px solid #ddd;
    padding:8px 10px;
    border-radius:6px;
    width:100%;
    outline:none;
    transition:border-color 0.2s ease, box-shadow 0.2s ease;
}
.input:focus {
    border-color:#4fa0ff;
    box-shadow: 0 0 0 3px rgba(79,160,255,0.15);
}
.ml-10 { margin-left:10px; }

/* Donate 特定样式 */
#donate{ width:40%; }
#创作者{ color:#ff6666; }
#欢迎反馈问题1{ color:#ff6c6c; }
#欢迎反馈问题2{ color:#ff6c6c; }

/* 上传区域 */
.upload-section {
    margin: 30px 0;
}

.upload-box {
    background: white;
    border: 3px dashed #ccc;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: #4CAF50;
    background: #f8fff8;
}

.upload-box.dragover {
    border-color: #4CAF50;
    background: #f0fff0;
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.2);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #666;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #666;
    margin-bottom: 5px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

/* 预览区域 */
.preview-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.preview-section h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.image-preview {
    text-align: center;
    margin-bottom: 20px;
}

#imagePreview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.analyze-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
    min-width: 200px;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.analyze-btn:active {
    transform: translateY(0);
}

/* 结果区域 */
.result-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.result-section h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.detailed-result {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.result-header h2 {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

/* 置信度区域 */
.confidence-section {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.confidence-section h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #333;
}

.confidence-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.confidence-fill {
    height: 100%;
    transition: width 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.confidence-text {
    text-align: center;
    font-size: 1rem;
}

.confidence-text .score {
    font-size: 1.5rem;
    margin-right: 15px;
}

.confidence-text .level {
    color: #666;
    font-size: 0.95rem;
}

/* 颜色预览 */
.color-info {
    margin-bottom: 25px;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
}

.color-label {
    font-weight: 600;
    color: #333;
    min-width: 80px;
}

.color-preview {
    width: 100px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 维度匹配度区域 */
.match-info-section {
    background: #f0f7ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 4px solid #2196F3;
}

.match-info-section h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #1976D2;
}

.match-grid {
    display: grid;
    gap: 15px;
}

.match-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
}

.match-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.match-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.match-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.5s ease-out;
}

.match-value {
    display: block;
    font-size: 0.85rem;
    color: #666;
    text-align: right;
}

/* 数值网格 */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.value-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #eee;
}

.value-card h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.value-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.value-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.value-item .label {
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.value-item .value {
    font-size: 1.3rem;
    color: #2196F3;
    font-weight: bold;
}

.value-item .range {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

/* 加载状态 */
.loading-section {
    text-align: center;
    padding: 40px;
    color: white;
}

.loading-spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    font-size: 1.1rem;
}

/* 错误样式 */
.error-result {
    text-align: center;
    padding: 20px;
}

.error-result p {
    margin-bottom: 20px;
}

/* 重新识别按钮 */
.retry-btn {
    transition: all 0.3s;
    display: block;
    margin: 20px auto 0;
}

/* 占位页面样式 */
.placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-content {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.placeholder-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.btn {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    margin-top: 20px;
    transition: all 0.3s;
}

.btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* 页脚 */
footer {
    text-align: center;
    color: white;
    margin-top: auto;
    padding-top: 40px;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    .main-nav {
        grid-template-columns: 1fr;
    }

    .upload-box {
        padding: 40px 15px;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .back-btn {
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 20px;
        display: inline-block;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .result-header h2 {
        font-size: 1.5rem;
    }

    .preview-section {
        padding: 20px;
    }

    .result-section {
        padding: 20px;
    }

    #imagePreview {
        max-height: 300px;
    }

    .analyze-btn {
        padding: 12px 24px;
        font-size: 1rem;
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }

    header p {
        font-size: 0.9rem;
    }

    .upload-box {
        padding: 30px 10px;
    }

    .upload-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    .upload-content h3 {
        font-size: 1.2rem;
    }

    .upload-content p {
        font-size: 0.9rem;
    }

    .result-header h2 {
        font-size: 1.3rem;
    }

    .confidence-bar {
        height: 25px;
    }

    .value-card {
        padding: 15px;
    }

    .value-item .value {
        font-size: 1.1rem;
    }

    .match-grid {
        gap: 10px;
    }

    .match-item {
        padding: 10px;
    }
}
