/* ===== 商城佈局 ===== */
.shop-container {
    padding: 120px 10% 60px;
    min-height: 100vh;
    background: #050505;
}

.shop-header {
    text-align: center;
    margin-bottom: 60px;
}

.shop-header h1 {
    font-size: 3rem;
    margin: 15px 0;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.shop-desc {
    color: #888;
    font-size: 1rem;
}

/* ===== 商品網格 ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.product-card {
    background: rgba(15, 15, 22, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: #00A3FF;
    box-shadow: 0 10px 30px rgba(0, 163, 255, 0.15);
}

.product-img {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #0b0b10;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-img img {
    transform: scale(1.05);
}

.product-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.prod-tag {
    font-size: 0.75rem;
    color: #00A3FF;
    border: 1px solid rgba(0, 163, 255, 0.3);
    padding: 3px 10px;
    border-radius: 999px;
    align-self: flex-start;
    margin-bottom: 15px;
}

.product-info h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
    color: #fff;
}

.prod-desc {
    color: #aaaaaa;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.prod-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
}

.price {
    font-size: 1.4rem;
    color: #fff;
    font-weight: bold;
    font-family: monospace;
}

.buy-btn {
    background: transparent;
    color: #00A3FF;
    border: 1px solid #00A3FF;
    padding: 10px 25px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s;
}

.buy-btn:hover {
    background: #00A3FF;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 163, 255, 0.5);
}

/* ===== 購物車內嵌入配送表單樣式 ===== */
.cart-shipping-zone {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 15px;
    margin-bottom: 10px;
}

.shipping-form {
    margin: 5px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.form-row {
    display: flex;
    gap: 8px;
}

.form-row input, .form-row select {
    flex: 1;
    width: 50%;
}

.shipping-form input,
.shipping-form select {
    background: #050508;
    border: 1px solid rgba(0, 163, 255, 0.2); /* 黑市商城專屬經典藍 */
    color: white;
    padding: 10px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.shipping-form input:focus,
.shipping-form select:focus {
    border-color: #00A3FF;
    box-shadow: 0 0 8px rgba(0, 163, 255, 0.3);
}

.shipping-form select option {
    background: #0d0d14;
    color: white;
}

.shipping-form input::placeholder {
    color: #555;
}

.shipping-form select:disabled {
    opacity: 0.3;
    border-color: rgba(255,255,255,0.02);
    cursor: not-allowed;
}

/* ===== 浮動購物車圖示 ===== */
.cart-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #0f0f15;
    border: 1px solid #00A3FF;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 163, 255, 0.2);
}

.cart-floating-btn:hover {
    transform: translateY(-5px) scale(1.05);
    background: #00A3FF;
    box-shadow: 0 0 25px rgba(0, 163, 255, 0.6);
}

.cart-floating-btn:hover .cart-icon {
    filter: brightness(0);
}

.cart-icon {
    font-size: 1.5rem;
    transition: filter 0.3s;
}

.cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #FF4646; /* 警戒紅 */
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: monospace;
    box-shadow: 0 0 10px rgba(255, 70, 70, 0.8);
    border: 1px solid #050505;
}

/* ===== 浮動歷史紀錄圖示 ===== */
.history-floating-btn {
    position: fixed;
    bottom: 105px; /* 剛好位於購物車(30px + 60px + 15px間距)的上方 */
    right: 30px;
    width: 60px;
    height: 60px;
    background: #0f0f15;
    border: 1px solid #FFB800; /* 歷史紀錄專屬加密黃 */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(255, 184, 0, 0.2);
}

.history-floating-btn:hover {
    transform: translateY(-5px) scale(1.05);
    background: #FFB800;
    box-shadow: 0 0 25px rgba(255, 184, 0, 0.6);
}

.history-floating-btn:hover .history-icon {
    filter: brightness(0); /* 懸停時圖示變黑 */
}

.history-icon {
    font-size: 1.5rem;
    transition: filter 0.3s;
}

/* ===== 購物車側邊欄 ===== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 100%;
    height: 100vh;
    background: #09090e;
    border-left: 1px solid rgba(0, 163, 255, 0.15);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding: 30px;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.cart-sidebar.active {
    transform: translateX(0);
    border-left-color: #00A3FF;
    box-shadow: -10px 0 40px rgba(0, 163, 255, 0.05);
}

.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 20px;
}

.cart-sidebar-header h2 {
    font-size: 1.2rem;
    color: #00A3FF;
    letter-spacing: 1px;
}

.close-cart {
    background: transparent;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: 0.2s;
}

.close-cart:hover {
    color: #FF4646;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.empty-msg {
    color: #555;
    text-align: center;
    margin-top: 40px;
    font-size: 0.9rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.cart-item-details h4 {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 5px;
}

.cart-item-details .item-price {
    color: #00A3FF;
    font-size: 0.85rem;
    font-family: monospace;
}

.cart-item-amt {
    display: flex;
    align-items: center;
    gap: 10px;
}

.amt-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}

.amt-btn:hover {
    border-color: #00A3FF;
    color: #00A3FF;
}

.item-count {
    font-family: monospace;
    font-size: 0.95rem;
    min-width: 15px;
    text-align: center;
}

.cart-sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.total-price {
    color: #fff;
    font-weight: bold;
    font-family: monospace;
}

.checkout-btn {
    width: 100%;
    background: #00A3FF;
    color: black;
    border: none;
    padding: 15px;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.3s;
}

.checkout-btn:hover {
    box-shadow: 0 0 20px rgba(0, 163, 255, 0.4);
    background: #00b0ff;
}

/* ===== 🛠️ 核心修正：確認交易彈窗外觀與全黑背景遮罩 ===== */
.purchase-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85); /* 半透明黑底遮罩 */
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none; /* 預設完全隱藏且不可點擊 */
    transition: opacity 0.4s ease;
}

/* JS 打開彈窗時激發的 Class */
.purchase-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #0b0b12;
    border: 1px solid #FF4646; /* 驚悚警戒紅線框 */
    box-shadow: 0 0 30px rgba(255, 70, 70, 0.2);
    padding: 40px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    color: #FF4646;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

#modal-msg-container {
    margin: 20px 0;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.modal-btn {
    padding: 12px 25px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.modal-btn.confirm {
    background: #FF4646;
    border: 1px solid #FF4646;
    color: white;
}

.modal-btn.confirm:hover {
    box-shadow: 0 0 15px rgba(255, 70, 70, 0.5);
    background: #ff5c5c;
}

.modal-btn.cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
}

.modal-btn.cancel:hover {
    border-color: white;
    color: white;
}

/* ===== 響應式手機微調 ===== */
@media(max-width: 480px) {
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    .form-row input {
        width: 100%;
    }
    .form-row select {
        flex: 1;
        width: 50%;
    }
    .modal-content {
        padding: 30px 20px;
    }
}