/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: visible;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: url('images/page_1.jpg') center/cover no-repeat;
}

/* 页面切换 */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    background: url('images/page_2.jpg') center/cover no-repeat;
}

.page.active {
    display: flex;
}

/* 首页背景 */
#page-home {
    background: url('images/page_1.jpg') center/cover no-repeat;
}

/* 首页图标 */
.home-icon {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    border: 2px solid rgba(255,255,255,0.3);
}

/* 页面标题 */
.page-title {
    color: white;
    font-size: 24px;
    font-weight: 500;
    margin-top: 60px;
    margin-bottom: 30px;
    text-align: center;
}

.page-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: -25px;
    margin-bottom: 20px;
}

/* ========== 首页 ========== */
#page-home {
    justify-content: center;
    padding: 0;
}

.home-content {
    position: absolute;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    bottom: 10%;
    left: 0;
    right: 0;
}

/* 当任何页面处于活动状态时，隐藏首页内容 */
.app-container:has(.page.active) .home-content {
    display: none;
}

/* 开始按钮 */
.btn-start {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 20px;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.btn-start:active {
    transform: scale(0.95);
}

.btn-start span {
    font-weight: 500;
}

.play-icon {
    width: 30px;
    height: 30px;
    background: #4A9FD4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    margin-left: 5px;
}

/* 拍照页面标题 - 深蓝色 */
.photo-title {
    color: #1a365d;
}

/* ========== 模式选择 ========== */
.mode-options {
    display: flex;
    gap: 30px;
    margin-bottom: 50px;
    justify-content: center;
}

.mode-card {
    width: 140px;
    height: 200px;
    background: white;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.mode-card:active {
    transform: scale(0.95);
}

.mode-card.selected {
    border: 3px solid #FFD700;
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
}

.mode-image {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
}

.fixed-mode {
    background: url('images/image2.jpg') center/contain no-repeat;
}

.custom-mode {
    background: url('images/image2.jpg') center/contain no-repeat;
}

.mode-label {
    font-size: 18px;
    color: #333;
    font-weight: 500;
}

.btn-confirm {
    background: linear-gradient(90deg, #FFB347 0%, white 100%);
    border: none;
    padding: 15px 60px;  /* 与重拍按钮一致 */
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,179,71,0.4);
    transition: transform 0.2s;
    margin: 0 auto;
    display: block;
}

.btn-confirm:active {
    transform: scale(0.95);
}

/* ========== 旋转按钮 ========== */
.rotate-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.btn-rotate {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px 30px;
    border-radius: 20px;
    font-size: 16px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    transition: transform 0.2s;
}

.btn-rotate:active {
    transform: scale(0.95);
}

/* ========== 选取方式 ========== */
.method-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: 320px;
}

.method-card {
    background: white;
    border-radius: 15px;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.method-card:active {
    transform: scale(0.98);
}

.method-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #87CEEB 0%, #4A9FD4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

.random-image {
    background: url('images/image_3.png') center/contain no-repeat;
}

.direct-image {
    background: url('images/image_3.png') center/contain no-repeat;
}

.method-label {
    display: block;
    text-align: center;
    padding: 15px;
    font-size: 18px;
    color: #333;
    font-weight: 500;
}

/* ========== 景点选择 ========== */
.spots-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 5px;
}

.spot-tab {
    background: rgba(255,255,255,0.3);
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.spot-tab.active {
    background: #FF8C42;
    border-color: #FF8C42;
}

/* 景点选择页面标题 - 深蓝色 */
.spots-title {
    color: #1a365d;
    margin-bottom: 15px;  /* 标题底部间距 */
}

.spots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 15px;  /* 行间距 列间距 */
    row-gap: 25px;    /* 专门设置行间距 */
    width: 100%;
    max-width: 350px;
    padding-bottom: 20px;
    margin-top: 5px;  /* 调整位置，在标题下方，不覆盖标题 */
    margin-left: auto;
    margin-right: auto;
}

.spot-item {
    aspect-ratio: 4/3;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    padding: 2px;
}

.spot-item:active {
    transform: scale(0.95);
}

.spot-item.selected {
    border: 3px solid #ff6b6b;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

.spot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.spot-item {
    aspect-ratio: 4/3;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* ========== 随机抽卡 ========== */
.draw-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    margin-bottom: 40px;
}

.draw-card {
    width: 280px;
    height: 200px;
    background: white;
    border-radius: 15px;
    overflow: visible;
    margin-bottom: 50px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

 .draw-image {
    width: 100%;
    height: 100%;
    background: url('images/image_5.png') center/contain no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.draw-image.drawing {
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.btn-draw {
    background: linear-gradient(90deg, #FFB347 0%, #FFCC99 100%);
    border: none;
    padding: 18px 60px;
    border-radius: 30px;
    font-size: 20px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,179,71,0.4);
    transition: transform 0.2s;
}

.btn-draw:active {
    transform: scale(0.95);
}

/* ========== 抽卡结果 ========== */
.result-card {
    width: 300px;
    height: 220px;
    background: white;
    border-radius: 15px;
    overflow: visible;
    margin: 30px 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.result-image {
    width: 100%;
    height: 100%;
    background: url('images/image_6.png') center/contain no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-redraw {
    background: linear-gradient(90deg, #98D8C8 0%, #B8E6D9 100%);
    border: none;
    padding: 15px 80px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(152,216,200,0.4);
    transition: transform 0.2s;
}

.btn-redraw:active {
    transform: scale(0.95);
}

/* ========== 拍照/上传 ========== */
.photo-frame {
    width: 280px;
    background: white;
    border-radius: 20px;
    padding: 15px;
    margin: 20px auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.photo-preview {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 15px;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: #999;
}

.upload-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.upload-text {
    font-size: 16px;
}

.upload-hint {
    font-size: 12px;
    color: #bbb;
    margin-top: 5px;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    align-items: center;
    width: 280px;
    margin-left: auto;
    margin-right: auto;
}

#page-photo .btn-confirm {
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
}

.btn-retake {
    background: linear-gradient(90deg, #2563eb 0%, white 100%);
    border: none;
    padding: 15px 60px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37,99,235,0.4);
    transition: transform 0.2s;
    margin: 0 auto;
    display: block;
    width: 100%;
    max-width: 280px;
    box-sizing: border-box;
}

.btn-retake:active {
    transform: scale(0.95);
}

/* ========== 自定义背景页面（横屏） ========== */
#page-custom-bg .photo-frame {
    width: 90%;
    max-width: 500px;
}

#page-custom-bg .photo-preview {
    aspect-ratio: 16/9;
}

#page-custom-bg .rotate-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    width: 90%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

#page-custom-bg .photo-buttons {
    width: 90%;
    max-width: 500px;
}

#page-custom-bg .btn-confirm,
#page-custom-bg .btn-retake {
    width: 100%;
    max-width: none;
}

#page-custom-bg .upload-text {
    font-size: 18px;
}

#page-custom-bg .upload-hint {
    font-size: 14px;
}

.custom-bg-tip {
    color: #ff0000;
    font-size: 14px;
    text-align: center;
    margin-top: 15px;
    padding: 0 20px;
    line-height: 1.6;
}

/* ========== 生成中 ========== */
#page-generating {
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

.generating-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.generating-image {
    max-width: 180px;
    height: auto;
    margin-bottom: 30px;
    flex-shrink: 0;
}

.progress-bar {
    width: 250px;
    height: 16px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: visible;
    border: 2px solid white;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: white;
    border-radius: 8px;
    transition: width 0.3s;
}

/* ========== 最终明信片 ========== */
#page-final {
    justify-content: flex-start;
    align-items: center;
    padding-top: 80px;
    padding-bottom: 20px;
    box-sizing: border-box;
    text-align: center;
}

.final-title-image {
    max-width: 260px;
    height: auto;
    margin-bottom: 25px;
    margin-top: 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.final-image {
    width: 320px;
    height: 200px;
    background: linear-gradient(135deg, #87CEEB 0%, #4A9FD4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    margin-bottom: 25px;
    position: relative;
    overflow: visible;
    border-radius: 12px;
    margin-left: auto;
    margin-right: auto;
}

.final-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.employee-info {
    position: absolute;
    right: 10px;
    bottom: 15px;
    background: rgba(0,0,0,0.6);
    padding: 8px 15px;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 25px;
}

.employee-info .name {
    font-weight: bold;
    font-size: 14px;
}

.employee-info .rank {
}

.employee-info .km {
    opacity: 0.9;
}

.qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-container {
    background: white;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    min-width: 160px;
}

.qr-container canvas {
    width: calc(100% - 30px);
    height: auto;
    max-width: 150px;
}

.qr-text {
    color: #1a365d;  /* 深蓝色 */
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

.btn-print {
    display: none;
}

/* ========== 员工工号输入弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    width: 85%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-content h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 10px;
}

.modal-content p {
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

#employee-id-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: 30px;
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#employee-id-input:focus {
    border-color: #4A9FD4;
}

#employee-id-input::placeholder {
    color: #999;
}

.btn-enter {
    background: linear-gradient(90deg, #4A9FD4 0%, #6BB8E8 100%);
    border: none;
    padding: 15px 60px;
    border-radius: 25px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(74,159,212,0.4);
    transition: transform 0.2s;
    width: 100%;
}

.btn-enter:active {
    transform: scale(0.95);
}

/* 响应式适配 */
@media (max-height: 700px) {
    .page-title {
        margin-top: 50px;
        margin-bottom: 20px;
    }
}

@media (max-height: 600px) {
    .mode-options {
        gap: 20px;
    }
    
    .mode-card {
        width: 120px;
        height: 170px;
    }
    
    .mode-image {
        height: 110px;
    }
}

/* 移动端优化 */
@media (max-width: 480px) {
    .btn-start {
        padding: 14px 35px;
        font-size: 18px;
        min-width: 160px;
    }
    
    .play-icon {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
    
    .home-content {
        padding: 15px;
    }
}

/* 小屏幕手机适配 */
@media (max-height: 500px) {
    .btn-start {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    .play-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    .btn-start:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}
