/* 全局样式 */
* {
    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;
    line-height: 1.6;
}

/* 应用容器 */
#app {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 导航栏 */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background-color: #4A90E2;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 主内容区 */
.main-content {
    padding: 2rem;
    min-height: calc(100vh - 70px);
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 图片上传区 */
.upload-area {
    margin-bottom: 3rem;
}

.image-preview {
    width: 100%;
    max-width: 400px;
    height: 400px;
    margin: 0 auto;
    border: 2px dashed #ddd;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
}

.upload-placeholder {
    text-align: center;
    cursor: pointer;
    padding: 2rem;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-placeholder p {
    color: #999;
    margin-bottom: 1rem;
}

#imageUpload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: white;
}

/* 下一步按钮 */
.next-section {
    text-align: center;
    margin-top: 3rem;
}

.next-btn {
    padding: 1.5rem 3rem;
    background-color: #4A90E2;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 200px;
}

.next-btn:hover {
    background-color: #357ABD;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.3);
}

/* 分类导航 */
.category-nav {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid #eee;
}

.nav-category-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.nav-category-btn.active {
    border-bottom-color: #4A90E2;
    color: #4A90E2;
    font-weight: 600;
}

/* 发型列表 */
.hairstyle-list h2 {
    margin-bottom: 2rem;
    color: #333;
}

.hairstyle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.hairstyle-item {
    border: 2px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.hairstyle-item:hover {
    border-color: #4A90E2;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.hairstyle-item.selected {
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.hairstyle-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.hairstyle-item p {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* 确认按钮 */
.confirm-section {
    margin-top: 3rem;
    text-align: center;
}

.confirm-btn {
    padding: 1rem 3rem;
    background-color: #50E3C2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.confirm-btn:hover:not(:disabled) {
    background-color: #38D1B0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(80, 227, 194, 0.3);
}

.confirm-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 结果预览 */
.result-section {
    margin-bottom: 3rem;
}

.result-section h2 {
    margin-bottom: 2rem;
    color: #333;
}

.result-preview {
    width: 100%;
    max-width: 400px;
    height: 400px;
    margin: 0 auto;
    border: 2px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: white;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 2px solid #4A90E2;
    border-radius: 8px;
    background-color: white;
    color: #4A90E2;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    background-color: #4A90E2;
    color: white;
}

.action-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* 加载指示器 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4A90E2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .navbar {
        padding: 1rem;
    }

    .navbar h1 {
        font-size: 1.2rem;
    }

    .image-preview {
        height: 300px;
    }

    .category-buttons {
        flex-direction: column;
        align-items: center;
    }

    .category-btn {
        width: 200px;
    }

    .hairstyle-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }

    .hairstyle-item img {
        height: 120px;
    }

    .result-preview {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .image-preview {
        height: 250px;
    }

    .hairstyle-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-preview {
        height: 300px;
    }
}