/* 心願清單側欄 */
.cart-page {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s ease;
}

.cart-page.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.cart-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 33, 40, 0.28);
    backdrop-filter: blur(2px);
}

.cart-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    box-shadow: -24px 0 60px rgba(26, 33, 40, 0.18);
    transform: translateX(100%);
    transition: transform 0.32s ease;
}

.cart-page.is-visible .cart-panel {
    transform: translateX(0);
}

.cart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.75rem 1.25rem 0.65rem;
    border-bottom: 1px solid #E6EBF2;
}

.cart-title {
    margin: 0;
    color: #1A2128;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.cart-title-count {
    color: #9AA4B2;
    font-size: 0.8em;
    font-weight: 500;
}

.cart-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #9AA4B2;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cart-close-btn:hover {
    background: #F3F6FA;
    color: #1A2128;
}

.cart-loading,
.cart-content {
    flex: 1;
    min-height: 0;
}

.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: #6B7280;
}

.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 4px solid #E5E7EB;
    border-top-color: #00BE5A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.cart-loading p {
    margin: 0;
    font-size: 0.875rem;
}

.cart-content {
    overflow-y: auto;
    background: #FFFFFF;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-icon {
    margin-bottom: 1.25rem;
    color: #D6DCE5;
    font-size: 4rem;
}

.empty-text {
    margin: 0 0 1.5rem;
    color: #6B7280;
    font-size: 0.9rem;
}

.empty-btn {
    min-width: 10rem;
    padding: 0.9rem 1.5rem;
    border: 0;
    border-radius: 1rem;
    background: #00BE5A;
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.empty-btn:hover {
    background: #00A34D;
    transform: translateY(-1px);
}

.cart-items {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 2rem 1.5rem;
}

.cart-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem 0;
    border-bottom: 1px solid #E6EBF2;
}

.cart-item:first-child {
    padding-top: 1rem;
}

.item-select-wrap {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0.2rem;
    cursor: pointer;
}

.item-select-checkbox {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    accent-color: #00BE5A;
    cursor: pointer;
}

.item-media {
    position: relative;
    flex: 0 0 4rem;
    width: 4rem;
    height: 4rem;
    border-radius: 1rem;
    background: linear-gradient(180deg, #F7F8FA 0%, #EEF2F6 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #B6BFCC;
    font-size: 1.25rem;
}

.item-placeholder-fallback {
    display: none;
    position: absolute;
    inset: 0;
}

.item-media.is-image-error .item-placeholder-fallback {
    display: flex;
}

.item-body {
    flex: 1;
    min-width: 0;
}

.item-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.item-copy {
    min-width: 0;
}

.item-name {
    margin: 0;
    color: #1A2128;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.35rem;
}

.item-price {
    color: #00BE5A;
    font-size: 0.9rem;
    font-weight: 800;
}

.item-footer {
    margin-top: 0.75rem;
}

.item-quantity-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid #E2E8F0;
    border-radius: 999px;
    background: #F8FAFC;
    overflow: hidden;
}

.item-quantity {
    color: #6B7280;
    min-width: 2rem;
    padding: 0 0.4rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.btn-delete {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #9AA4B2;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-delete:hover {
    background: #F3F6FA;
    color: #1A2128;
}

.btn-qty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.95rem;
    height: 1.95rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: #4B5563;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-qty:hover:not(:disabled) {
    background: #EAF1F7;
    color: #1A2128;
}

.btn-qty:disabled {
    color: #C5CED8;
    cursor: not-allowed;
}

.btn-qty i {
    font-size: 0.75rem;
}

.cart-footer {
    flex: 0 0 auto;
    padding: 0.85rem 1.25rem 0.95rem;
    border-top: 1px solid #E6EBF2;
    background: #FFFFFF;
}

.cart-summary {
    display: grid;
    gap: 0.45rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #E6EBF2;
}

.summary-row,
.cart-goal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.summary-label,
.summary-value {
    color: #4B5563;
    font-size: 0.83rem;
}

.summary-value {
    font-weight: 500;
}

.cart-goal {
    margin-top: 0.8rem;
}

.goal-label {
    color: #1A2128;
    font-size: 0.88rem;
    font-weight: 700;
}

.goal-amount {
    color: #00BE5A;
    font-size: clamp(1.45rem, 2.8vw, 1.75rem);
    font-weight: 800;
    line-height: 1;
}

.cart-note {
    margin: 0.6rem 0 0.85rem;
    color: #C8C8C8;
    font-size: 0.76rem;
    line-height: 1.65;
}

.cart-actions {
    display: flex;
}

.btn-confirm {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.82rem 1rem;
    border: 0;
    border-radius: 0.95rem;
    background: #00BE5A;
    color: #FFFFFF;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-confirm:hover:not(:disabled) {
    background: #00A34D;
    transform: translateY(-1px);
}

.btn-confirm:disabled {
    background: #A7E4BF;
    cursor: not-allowed;
}

.btn-confirm i {
    font-size: 0.82rem;
}

@media (min-width: 992px) {
    .cart-panel {
        width: min(25vw, 26rem);
    }
}

@media (max-width: 991.98px) {
    .cart-backdrop {
        background: rgba(26, 33, 40, 0.18);
        backdrop-filter: none;
    }

    .cart-panel-header {
        padding: 0.65rem 0.85rem 0.6rem;
    }

    .cart-items {
        padding: 0.5rem 1.25rem 1.25rem;
    }

    .cart-footer {
        padding: 0.8rem 0.85rem 0.9rem;
    }

    .goal-amount {
        font-size: 1.55rem;
    }
}

@media (max-width: 575.98px) {
    .cart-title {
        font-size: 0.95rem;
    }

    .cart-item {
        gap: 0.75rem;
        padding: 1rem 0;
    }

    .item-media {
        flex-basis: 3.75rem;
        width: 3.75rem;
        height: 3.75rem;
        border-radius: 0.9rem;
    }

    .item-name {
        font-size: 0.9rem;
    }

    .summary-label,
    .summary-value,
    .cart-note {
        font-size: 0.78rem;
    }

    .goal-label {
        font-size: 0.9rem;
    }

    .goal-amount {
        font-size: 1.4rem;
    }

    .btn-confirm {
        padding: 0.78rem 0.95rem;
        font-size: 0.84rem;
    }
}
