* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部导航栏 */
.top-nav {
    background-color: #1e88e5;
    color: white;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-left {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
}

.logo-icon {
    margin-right: 10px;
    font-size: 20px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-back,
.btn-help {
    background-color: white;
    color: #1e88e5;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover,
.btn-help:hover {
    background-color: #f5f5f5;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* 左侧操作栏 */
.left-panel {
    width: 350px;
    background-color: white;
    border-right: 1px solid #e0e0e0;
    padding: 20px;
    overflow-y: auto;
}

.left-panel h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.left-panel h4 {
    font-size: 14px;
    font-weight: bold;
    margin: 15px 0 10px 0;
    color: #555;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-area:hover {
    border-color: #1e88e5;
    background-color: #f0f7ff;
}

.file-input {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    width: 100%;
}

.upload-icon {
    font-size: 32px;
}

.upload-text {
    font-size: 14px;
    color: #666;
}

.upload-tip {
    font-size: 12px;
    color: #999;
}

.file-name {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: #1890ff;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 0;
    z-index: 1;
}

/* 上传进度条样式 */
.upload-progress {
    margin-top: 20px;
    height: 20px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    display: none;
    position: relative;
}

.upload-progress.active {
    display: block;
}

.progress-bar {
    height: 100%;
    background-color: #1890ff;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

/* 处理状态样式 */
.process-status {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    text-align: center;
    display: none;
}

.process-status.active {
    display: block;
}

/* 图片列表 */
.image-list {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.image-item {
    position: relative;
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-item img:hover {
    transform: scale(0.95);
}

/* 大图模式样式 */
.large-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}



.large-image-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    min-height: 80vh;
}

.large-image-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
}

.large-image {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    object-fit: contain;
    transform: scale(0.92);
    transform-origin: center center;
}

.large-image-info {
    margin-top: 20px;
    font-size: 14px;
    color: #666;
    text-align: center;
}



/* 设置区域 */
.setting-section {
    margin-bottom: 20px;
}

.setting-item {
    margin-bottom: 15px;
    width: 100%;
    min-height: 40px;
}

.setting-item label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.setting-select,
.setting-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.setting-select:focus,
.setting-input:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.2);
}

.setting-color {
    width: 100%;
    height: 40px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-color:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.2);
}

.setting-range {
    width: 80%;
    margin-right: 10px;
}

/* 导出按钮 */
.btn-export {
    width: 100%;
    background-color: #1e88e5;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-export:hover {
    background-color: #1976d2;
}

.btn-export:disabled {
    background-color: #d9d9d9;
    cursor: not-allowed;
}

.btn-upload-template {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-upload-template:hover {
    background-color: #388e3c;
}

.btn-bg-upload {
    background-color: #2196f3 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: normal !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    line-height: 1.4 !important;
    height: auto !important;
}

.btn-bg-upload:hover {
    background-color: #1976d2;
}

.bg-image-tip {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
}

/* 右侧预览区 */
.right-panel {
    flex: 1;
    background-color: #fafafa;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-panel h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.preview-area {
    flex: 1;
    max-width: 1242px;
    height: 1660px;
    background-color: #f5f5f5 !important;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
    min-height: 600px;
}

#canvas {
    position: relative;
    z-index: 2;
    max-width: calc(100% - 40px);
    max-height: calc(100% - 40px);
    width: auto;
    height: auto;
    background-color: transparent;
    border: none;
    cursor: grab;
}

#canvas:active {
    cursor: grabbing;
}

.preview-placeholder {
    display: none;
}

.placeholder-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.placeholder-text {
    font-size: 14px;
}

.puzzle-container {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    gap: 10px;
    background-color: #ffffff;
    padding: 10px;
    border-radius: 4px;
    height: 100%;
}

.puzzle-container.template-horizontal {
    flex-direction: row;
}

/* 3D拼贴效果 */
.puzzle-container-3d {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    overflow: hidden;
}

/* 后面的图片墙层 */
.3d-back-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: translateZ(-50px);
    z-index: 1;
}

.puzzle-item-3d-back {
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.puzzle-item-3d-back:hover {
    transform: rotate(0deg) scale(1.05) !important;
    z-index: 10 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.puzzle-item-3d-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    backface-visibility: hidden;
}

/* 前面的主图片层 */
.3d-front-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(50px);
    z-index: 2;
    transition: all 0.5s ease;
}

.3d-front-layer:hover {
    transform: translate(-50%, -50%) translateZ(80px) scale(1.1);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.puzzle-item {
    flex: 1;
    min-width: 100px;
    min-height: 100px;
    overflow: hidden;
    border-radius: 4px;
}

.puzzle-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    padding: 0 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .right-panel {
        flex: 1;
    }

    .image-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .left-panel {
        padding: 15px;
    }

    .upload-area {
        padding: 20px;
    }

    .preview-area {
        padding: 10px;
    }

    .image-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
}