/* 1. Global Styles & Font */
:root {
    --primary-color: #007bff;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --border-radius: 12px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

#app-container {
    width: 100%;
    max-width: 1200px;
}

/* 2. Page Transitions */
.app-page {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.app-page.active {
    display: flex;
    opacity: 1;
}

/* 3. Header Styles */
.page-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.title {
    font-weight: 700;
    font-size: 2.5rem;
}
.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* 4. Upload Box Styles */
.upload-box {
    width: 100%;
    max-width: 600px;
    background: var(--card-background);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.upload-box:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
}
.upload-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.upload-box p {
    margin-bottom: 0.5rem;
}

/* 5. Custom Button Styles */
.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.btn-primary {
    background-color: var(--primary-color);
    border: none;
}
.btn-primary:hover, .btn-primary:disabled {
    background-color: #0056b3;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* 6. Results Page Styles */
.results-page {
    align-items: flex-start !important; /* Override center alignment */
}
.image-list {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.image-list-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.image-list-item:hover {
    background-color: #f1f3f5;
}
.image-list-item.active {
    background-color: #e9ecef;
    font-weight: 500;
}
.image-list-item img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    margin-right: 1rem;
    object-fit: cover;
}
.results-content {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.main-image-wrapper {
    width: 100%;
    margin-bottom: 2rem;
    display: flex; /* 新增: 使用flex布局 */
    justify-content: center; /* 新增: 水平居中 */
    align-items: center; /* 新增: 垂直居中 (可选) */
}
.main-image {
    width: 100%; /* 保留: 确保在小屏幕上能正确缩放 */
    max-height: 400px; /* 新增: 限制图片最大高度为400像素 */
    border-radius: var(--border-radius);
    object-fit: contain; /* 保留: 确保图片内容完整显示不被裁剪 */
}
.results-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.result-card {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: var(--border-radius);
}
.card-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Helper class */
.hidden {
    display: none !important;
}

/* 4. Upload Box Styles (修改和新增) */
.upload-box {
    width: 100%;
    max-width: 600px;
    min-height: 300px; /* 给予一个最小高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--card-background);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem; /* 内边距 */
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative; /* 相对定位，为了预览图 */
    overflow: hidden; /* 防止图片溢出边框 */
}
.upload-box.active { /* 用于拖拽时的高亮效果 */
    border-color: var(--primary-color);
    background-color: #f0f7ff;
}
.upload-box:hover {
    border-color: var(--primary-color);
}
.upload-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}
#upload-prompt button { /* 让“浏览文件”按钮看起来不像主操作 */
    pointer-events: none; /* 防止按钮拦截点击事件 */
}

/* 预览容器样式 */
#image-preview-container {
    width: 100%;
    height: 100%;
    position: relative;
}
#image-preview {
    max-width: 100%;
    max-height: 260px; /* 限制预览图最大高度 */
    border-radius: 8px;
    object-fit: contain;
}

/* 移除按钮样式 */
.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-remove:hover {
    background-color: rgba(0, 0, 0, 0.8);
}