﻿
/* ===== CSS 變數 ===== */
:root {
    --color-green: #00ab96;
    --color-red: #db0808;
}

/* ===== layout右上角購物車icon 開始 ===== */
.header-cart-wrap {
    position: relative;
}

.cart-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s;
    position: relative;
}

    .cart-trigger:hover {
        background: #f5f5f5;
    }

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(35%, -35%);
    background: var(--color-red);
    color: #fff;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Cart dropdown */
.cart-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
    border: 1px solid #eee;
    z-index: 300;
    overflow: hidden;
}

.cart-drop-empty {
    padding: 2rem;
    text-align: center;
    color: #aaa;
    font-size: 0.9rem;
}

.cart-drop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f3f3;
}

    .cart-drop-item img {
        width: 52px;
        height: 52px;
        object-fit: cover;
        border-radius: 6px;
        flex-shrink: 0;
        border: 1px solid #eee;
    }

.cart-drop-info {
    flex: 1;
    min-width: 0;
}

.cart-drop-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-drop-spec {
    font-size: 0.78rem;
    color: #999;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-drop-price {
    color: #e54623;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-drop-footer {
    padding: 10px 14px;
}

.btn-view-cart {
    display: block;
    text-align: center;
    background: var(--color-green);
    color: #fff;
    border-radius: 20px;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.15s;
}

    .btn-view-cart:hover {
        background: #009384;
        color: #fff;
    }

/* ===== layout右上角購物車icon 結束 ===== */

[v-cloak] {
    display: none !important;
}

/* ===== 加入購物車 Toast ===== */
.cart-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(30, 30, 30, 0.88);
    color: #fff;
    border-radius: 16px;
    padding: 28px 36px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    pointer-events: none;
}

.cart-toast-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
}

.cart-toast-text {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Vue transition */
.cart-toast-enter-active,
.cart-toast-leave-active {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cart-toast-enter-from,
.cart-toast-leave-to {
    opacity: 0;
    transform: translate(-50%, -44%);
}

.cart-toast-enter-to,
.cart-toast-leave-from {
    opacity: 1;
    transform: translate(-50%, -50%);
}


/* ===== 購物車視圖 ===== */
.fade-in {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-back-btn {
    cursor: pointer;
    color: var(--color-green);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

    .cart-back-btn:hover {
        text-decoration: underline;
    }

.cart-store-block {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.cart-store-header {
    background-color: #f7f7f7;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-left: 4px solid var(--color-green);
    font-weight: 600;
}

.cart-item-row {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border-top: 1px solid #f0f0f0;
    gap: 0.8rem;
}

.cart-item-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-spec {
    color: #888;
    font-size: 0.82rem;
    margin-top: 2px;
    overflow-wrap: break-word;
}

.cart-item-price {
    color: #e54623;
    font-weight: 700;
    font-size: 0.95rem;
}

.cart-item-subtotal {
    color: #e54623;
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 80px;
    text-align: right;
}

/*------數量選擇器 開始------*/
.qty-ctrl {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.qty-btn {
    width: 28px;
    height: 28px;
    background: #fff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: none;
}

    .qty-btn:hover {
        background: #f0f0f0;
    }

    .qty-btn:disabled {
        background: #f0f0f0;
    }

.qty-num {
    min-width: 28px;
    text-align: center;
    font-size: 0.95rem;
}

.qty-ctrl .qty-btn:first-child {
    border-right: 1px solid #ddd;
}

.qty-ctrl .qty-btn:last-child {
    border-left: 1px solid #ddd;
}
/*------數量選擇器 結束------*/

.btn-remove {
    color: #bbb;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.1rem;
}

    .btn-remove:hover {
        color: #e54623;
    }

.cart-store-footer {
    padding: 0.5rem 1rem;
    text-align: right;
    background-color: #fafafa;
    border-top: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: #555;
}

    .cart-store-footer span {
        color: #e54623;
        font-weight: 700;
    }

.cart-bottom-bar {
    position: sticky;
    bottom: 0;
    background: #fafafa;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 100;
    flex-wrap: wrap;
}

.cart-total-label {
    font-size: 0.9rem;
    color: #555;
    margin-left: auto;
}

.cart-total-price {
    color: #e54623;
    font-weight: 700;
    font-size: 1.2rem;
}

.btn-checkout {
    background-color: var(--color-green);
    color: #fff;
    border: none;
    border-radius: 1em;
    padding: 0.5rem 1.6rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

    .btn-checkout:hover {
        background-color: #009384;
    }

    .btn-checkout:disabled {
        background-color: #ccc;
        cursor: not-allowed;
    }

.cart-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: #aaa;
}

    .cart-empty i {
        font-size: 3.5rem;
        margin-bottom: 1rem;
        display: block;
    }

    .cart-empty p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

/* 桌機版表頭 */
.cart-table-header {
    display: none;
}

@media (min-width: 768px) {
    .cart-table-header {
        display: flex;
        padding: 0.5rem 1rem;
        color: #888;
        font-size: 0.85rem;
        border-bottom: 1px solid #eee;
        align-items: center;
    }

    .cart-col-check {
        width: 36px;
        flex-shrink: 0;
    }

    .cart-col-img {
        width: 80px;
        flex-shrink: 0;
    }

    .cart-col-info {
        flex: 1;
    }

    .cart-col-price {
        width: 90px;
        text-align: center;
    }

    .cart-col-qty {
        width: 100px;
        text-align: center;
    }

    .cart-col-sub {
        width: 90px;
        text-align: right;
    }

    .cart-col-del {
        width: 40px;
        text-align: center;
    }
}


/* ===== 商品列表頁 ===== */
.store-header {
    border-bottom: 2px solid var(--color-green);
}

.store-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
    flex-shrink: 0;
}

.store-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #222;
}

.store-desc {
    font-size: 0.85rem;
    color: #888;
    margin-top: 2px;
}

.prd-card {
    display: block;
    border-radius: 10px;
    border: 1px solid #eee;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
    background: #fff;
}

    .prd-card:hover {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(-3px);
        color: inherit;
    }

.prd-card-img {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f8f8;
}

    .prd-card-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s;
    }

.prd-card:hover .prd-card-img img {
    transform: scale(1.05);
}

.prd-card-body {
    padding: 0.6rem 0.75rem 0.75rem;
}

.prd-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #333;
    min-height: 2.4em;
}

.prd-card-price {
    margin-top: 0.3rem;
    color: #e54623;
    font-weight: 700;
    font-size: 1rem;
}

@media (max-width: 992px) {
    .category {
        overflow-x: auto;
        margin: 0 -1rem;
    }

        .category p {
            display: none;
        }

        .category > div {
            background-color: unset;
            min-height: 0;
            min-width: 150px;
            display: flex;
            align-items: center;
        }

    .category-item {
        background-color: #f7f7f7;
        border-radius: 8px;
        margin-right: 1rem;
        min-width: 150px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .logo img {
        max-width: 100px;
    }
}

/*商品數量選擇器*/
.qty-ctrl .qty-btn:first-child {
    border-right: 1px solid #ddd;
}

.qty-ctrl .qty-btn:last-child {
    border-left: 1px solid #ddd;
}


.home-inner-wrapper > div,
.self-inner-wrapper > div {
    flex: 1 0 180px;
}
