/* 烘焙店配色方案 - 明亮温馨风格 */
:root {
    /* 主色调 */
    --primary-color: #d4a574;  /* 暖木色 */
    --secondary-color: #e8f5e9;  /* 浅薄荷绿 */
    --accent-color: #ffd54f;  /* 暖杏色 */
    --wall-mint: #b2dfdb;  /* 墙面薄荷绿 */
    --wall-apricot: #fff3e0;  /* 背板暖杏色 */
    --wall-wood: #d7ccc8;  /* 护墙板浅原木色 */
    --ceiling-gray: #cfd8dc;  /* 天花板浅灰 */
    --floor-cement: #e0e0e0;  /* 地砖浅灰 */
    --floor-wood: #efebe9;  /* 木纹暖色 */
    --light-warm: #fff9c4;  /* 暖黄灯光 */
    --metal-gray: #90a4ae;  /* 细灰色金属 */
    --metal-copper: #bcaaa4;  /* 铜色金属 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow: hidden;
    background: linear-gradient(180deg, var(--ceiling-gray) 0%, var(--wall-mint) 100%);
    color: #333;
    touch-action: none;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
}

#scene-container:active {
    cursor: grabbing;
}

/* 加载界面 - 温馨烘焙风格 */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--wall-apricot) 0%, var(--wall-mint) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 165, 116, 0.3);  /* 暖木色半透明 */
    border-top-color: var(--primary-color);  /* 暖木色 */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #fff;
    font-size: 1.2rem;
    margin-top: 20px;
}

.loading-progress {
    color: #fff;
    font-size: 0.9rem;
    margin-top: 10px;
    opacity: 0.8;
}

/* 控制按钮 */
.control-btn {
    position: fixed;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 100;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    color: #333;
}

.back-btn {
    top: 20px;
    left: 20px;
}

.favorites-btn {
    top: 20px;
    right: 20px;
    position: relative;
}

.cart-btn {
    top: 80px;
    right: 20px;
    position: relative;
}

.help-btn {
    top: 140px;
    right: 20px;
}

.config-btn {
    top: 200px;
    right: 20px;
}

.favorites-btn .badge,
.cart-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: #fff;
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.favorites-btn .badge.show,
.cart-btn .badge.show {
    opacity: 1;
}

/* 移动端方向控制按钮 - 游戏十字键 */
.direction-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn {
    position: absolute;
    width: 45px;
    height: 45px;
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(240,240,240,0.95));
    border: 2px solid rgba(180,180,180,0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3),
                inset 0 1px 0 rgba(255,255,255,0.8);
    transition: all 0.1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.dpad-btn:active {
    transform: scale(0.92);
    background: linear-gradient(145deg, rgba(102,126,234,0.9), rgba(82,106,214,0.9));
    box-shadow: 0 2px 6px rgba(0,0,0,0.2),
                inset 0 1px 0 rgba(255,255,255,0.3);
    border-color: rgba(102,126,234,0.8);
}

.dpad-btn:active svg {
    stroke: white;
}

.dpad-btn svg {
    width: 22px;
    height: 22px;
    color: #333;
    stroke: #333;
}

.dpad-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(255,255,255,0.6), rgba(200,200,200,0.3));
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}


/* 隐藏非移动端的方向按钮 */
@media (min-width: 768px) {
    .direction-controls {
        display: none !important;
    }
}

/* 虚拟摇杆 - 移动端居中显示 */
#joystick-zone {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 120px !important;
    height: 120px !important;
    z-index: 100 !important;
    margin: 0 !important;
    right: auto !important;
}

.joystick-base {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
}

.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: none;
}

/* 桌面端隐藏摇杆 */
@media (min-width: 769px) {
    .joystick-zone {
        display: none;
    }
}


/* 产品详情弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 380px;
    width: 100%;
    max-height: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    z-index: 1000;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 1);
    color: #333;
    transform: scale(1.1);
}

.product-image-container {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--wall-apricot) 0%, var(--secondary-color) 100%);
    overflow: hidden;
    border-radius: 16px 16px 0 0;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.product-name {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 6px;
    color: #333;
    line-height: 1.3;
}

.product-price {
    font-size: 1.5rem;
    color: #ff4757;
    font-weight: bold;
    margin-bottom: 10px;
}

.product-price::before {
    content: '¥';
    font-size: 1.1rem;
    margin-right: 2px;
}

.product-description {
    color: #666;
    line-height: 1.4;
    margin-bottom: 16px;
    font-size: 0.85rem;
    flex: 1;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.product-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.action-btn {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.favorite-btn {
    background: #f0f0f0;
    color: #333;
}

.favorite-btn:hover {
    background: #e0e0e0;
}

.favorite-btn.active {
    background: #ff4757;
    color: #fff;
}

.buy-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c9a66c 100%);  /* 暖木色渐变 */
    color: #fff;
}

.buy-btn:hover {
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.4);  /* 暖木色阴影 */
    transform: translateY(-2px);
}

/* 收藏列表侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 150;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

/* 移动端侧边栏全屏 */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        right: -100%;
    }
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    color: #333;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.favorites-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.favorites-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #f9f9f9;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.favorites-item:hover {
    background: #f0f0f0;
    transform: translateX(-5px);
}

.favorites-item img,
.favorites-item-placeholder {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.favorites-item-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #c9a66c 100%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.favorites-item-info {
    flex: 1;
}

.favorites-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.favorites-item-price {
    color: #ff4757;
    font-weight: bold;
}

.favorites-item-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.favorites-item-remove:hover {
    color: #ff4757;
}

.sidebar-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* 购物车侧边栏 */
.cart-sidebar {
    padding-bottom: 0;
}

.cart-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: #f9f9f9;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.cart-item-price {
    color: #ff4757;
    font-weight: bold;
    font-size: 0.85rem;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.quantity-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.cart-item-quantity span {
    font-size: 14px;
    min-width: 20px;
    text-align: center;
}

.cart-item-total {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    font-weight: bold;
    color: #ff4757;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.cart-item-remove:hover {
    color: #ff4757;
}

.cart-footer {
    border-top: 1px solid #eee;
    padding: 15px;
    background: #fff;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.cart-total span:last-child {
    color: #ff4757;
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.cart-btn-secondary,
.cart-btn-primary {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cart-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.cart-btn-secondary:hover {
    background: #e0e0e0;
}

.cart-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c9a66c 100%);
    color: #fff;
}

.cart-btn-primary:hover {
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.4);
    transform: translateY(-2px);
}

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 25px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-content svg {
    color: #4CAF50;
}

/* 新手引导 */
.guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 300;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.guide-content {
    text-align: center;
    color: #fff;
    max-width: 400px;
}

.guide-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.guide-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.guide-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.guide-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.guide-btn {
    margin-top: 40px;
    padding: 14px 40px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #c9a66c 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.guide-btn:hover {
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.4);
    transform: translateY(-2px);
}

.guide-skip {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin-left: 10px;
}

.guide-skip:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 预定码弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--metal-gray);
    background: linear-gradient(135deg, var(--primary-color) 0%, #c9a66c 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

.reservation-info {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--secondary-color);  /* 浅薄荷绿背景 */
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);  /* 暖木色左边框 */
}

.reservation-id, .reservation-time {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.reservation-items {
    margin-bottom: 20px;
}

.reservation-items h4 {
    margin-bottom: 10px;
    color: #333;
}

.reservation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.reservation-item:last-child {
    border-bottom: none;
}

.item-name {
    flex: 1;
    font-weight: 500;
}

.item-quantity {
    color: #666;
    margin: 0 10px;
}

.item-price {
    color: #ff4757;
    font-weight: 600;
}

.reservation-total {
    text-align: right;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ff4757;
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.qr-code-section {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--wall-apricot);  /* 暖杏色背景 */
    border-radius: 8px;
    border: 1px solid var(--metal-gray);  /* 细灰色金属线条 */
}

.qr-code-section h4 {
    margin-bottom: 15px;
    color: #333;
}

#qr-code-container {
    display: inline-block;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.reservation-instructions {
    background: var(--wall-apricot);  /* 暖杏色背景 */
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);  /* 暖黄左边框 */
}

.reservation-instructions p {
    margin: 0 0 10px 0;
    font-weight: 600;
}

.reservation-instructions ul {
    margin: 0;
    padding-left: 20px;
}

.reservation-instructions li {
    margin-bottom: 5px;
    line-height: 1.4;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #c9a66c 100%);
    color: #fff;
}

.modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 响应式适配 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .joystick-zone {
        bottom: 30px;
        left: 30px;
        width: 100px;
        height: 100px;
    }

    .joystick-knob {
        width: 40px;
        height: 40px;
    }

    .control-btn {
        width: 45px;
        height: 45px;
    }

}

