/* ===== 计算机视觉页面样式 ===== */

/* ===== 导航栏汉堡菜单 ===== */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger-line {
    width: 22px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 移动端导航样式 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #1e3a8a 0%, #4c1d95 100%);
        flex-direction: column;
        padding: 1.5rem;
        gap: 0;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 99;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 1rem 1.5rem;
        border-radius: 10px;
        transition: background 0.3s ease;
    }
    
    .nav-menu a:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .lang-toggle {
        position: static !important;
        transform: none !important;
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .nav-right {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
    }
    
    .hamburger {
        width: 38px;
        height: 38px;
        padding: 8px;
    }
    
    .hamburger-line {
        width: 18px;
    }
}

.cv-main {
    min-height: calc(100vh - 80px);
    padding: 120px 2rem 4rem;
    background: var(--bg-light);
}

.cv-container {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
}

/* 标题区域 */
.cv-header {
    text-align: center;
    margin-bottom: 3rem;
}

.cv-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cv-header p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* 上传区域 */
.cv-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    width: 100%;
    padding: 3rem 2rem;
    border: 2px dashed rgba(6, 182, 212, 0.4);
    border-radius: 16px;
    background: var(--white);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--accent-cyan);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.upload-area.dragover {
    border-color: var(--accent-cyan);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    transform: scale(1.02);
}

.upload-icon {
    color: var(--accent-cyan);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* 图片预览 */
.preview-area {
    width: 100%;
    max-width: 500px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.preview-area img {
    width: 100%;
    display: block;
}

.remove-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

/* 识别按钮 */
.recognize-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: var(--gradient-btn);
    border: none;
    border-radius: 50px;
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.recognize-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

.recognize-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 结果区域 */
.cv-result-section {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cv-result-section h2 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.result-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.result-icon {
    font-size: 3rem;
}

.result-info {
    display: flex;
    flex-direction: column;
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.result-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-transform: capitalize;
}

.result-confidence {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.confidence-label {
    font-size: 0.9rem;
    color: var(--text-light);
    min-width: 60px;
}

.confidence-bar {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-btn);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.confidence-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-cyan);
    min-width: 50px;
}

/* Top 5 结果 */
.top5-results h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.top5-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.top5-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--bg-light);
}

.top5-list li:first-child {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
}

.top5-list .food-name {
    font-weight: 500;
    color: var(--text-dark);
    text-transform: capitalize;
}

.top5-list .food-prob {
    font-weight: 600;
    color: var(--accent-cyan);
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--white);
    font-size: 1.1rem;
}

/* 模型信息 */
.model-info {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: 12px;
    border-left: 4px solid var(--accent-cyan);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.model-info h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.model-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.model-info li {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 0.25rem 0;
}

/* ===== 训练曲线图表 ===== */
.training-charts {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.charts-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 2rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.chart-card {
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.charts-grid .chart-card:nth-child(1) { animation-delay: 0.1s; }
.charts-grid .chart-card:nth-child(2) { animation-delay: 0.2s; }
.charts-grid .chart-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 1rem;
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.legend-color {
    width: 20px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.train {
    background: #3b82f6;
}

.legend-color.val {
    background: #ef4444;
}

.legend-color.lr {
    background: #22c55e;
}

.legend-color.avg-line {
    background: #ef4444;
    border-style: dashed;
}

/* 两列布局 */
.charts-grid.two-col {
    grid-template-columns: repeat(2, 1fr);
}

.chart-card.wide {
    min-width: 0;
}

.chart-container.tall {
    height: 420px;
}

/* 页脚 */
.cv-footer {
    padding: 2rem;
    text-align: center;
    background: var(--bg-light);
}

.cv-footer p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 响应式 */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .charts-grid.two-col {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .chart-container.tall {
        height: 380px;
    }
}

@media (max-width: 768px) {
    .cv-main {
        padding: 100px 1rem 3rem;
    }
    
    .cv-header h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .result-main {
        flex-direction: column;
        text-align: center;
    }
    
    .result-confidence {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .confidence-bar {
        width: 100%;
    }
    
    .charts-title {
        font-size: 1.5rem;
    }
}

/* ===== 营养分析区域 ===== */
.nutrition-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.nutrition-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nutrition-section h3::before {
    content: '🤖';
    font-size: 1.5rem;
}

.nutrition-container {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(6, 182, 212, 0.15);
}

/* 营养分析加载状态 */
.nutrition-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.nutrition-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(6, 182, 212, 0.2);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.nutrition-loading p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* 营养分析内容 */
.nutrition-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
}

.nutrition-icon {
    font-size: 1.75rem;
}

.nutrition-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin: 0;
}

.nutrition-content {
    color: var(--text-dark);
    line-height: 1.7;
    font-size: 0.95rem;
}

.nutrition-content h3,
.nutrition-content h4,
.nutrition-content h5 {
    color: var(--text-dark);
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}

.nutrition-content h3 { font-size: 1.1rem; }
.nutrition-content h4 { font-size: 1rem; }
.nutrition-content h5 { font-size: 0.95rem; }

.nutrition-content strong {
    color: var(--accent-cyan);
    font-weight: 600;
}

.nutrition-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.nutrition-content li {
    margin-bottom: 0.4rem;
    position: relative;
}

.nutrition-content li::marker {
    color: var(--accent-cyan);
}

.nutrition-content p {
    margin: 0.5rem 0;
}

/* 流式输出光标 */
.nutrition-content .streaming-cursor {
    display: inline-block;
    color: var(--accent-cyan);
    animation: blink 0.8s infinite;
    font-weight: normal;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 营养分析错误状态 */
.nutrition-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.nutrition-error .error-icon {
    font-size: 1.5rem;
}

.nutrition-error p {
    color: #dc2626;
    margin: 0;
    font-size: 0.9rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .nutrition-container {
        padding: 1rem;
    }
    
    .nutrition-content {
        font-size: 0.9rem;
    }
}