/* ==========================================================================
   Tong Portfolio Filter — Cart (Toss-style)
   ========================================================================== */

/* 플로팅 버튼 */
.tpf-cart-floating {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9990;
}

.tpf-cart-floating-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--tpf-blue, #3182F6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(49, 130, 246, 0.35);
    transition: all 0.25s ease;
    position: relative;
}

.tpf-cart-floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(49, 130, 246, 0.4);
}

.tpf-cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--tpf-red, #F04452);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--tpf-font, system-ui);
    line-height: 1;
    border: 2px solid #fff;
}

.tpf-cart-badge:empty,
.tpf-cart-badge[data-count="0"] { display: none; }

.tpf-cart-floating-btn.tpf-bounce { animation: tpf-cart-bounce 0.45s ease; }

@keyframes tpf-cart-bounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.15); }
    60% { transform: scale(0.95); }
}

/* ==========================================================================
   사이드 패널
   ========================================================================== */
.tpf-cart-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: var(--tpf-white, #fff);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0,0,0,0.1);
    transition: right 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    border-radius: 16px 0 0 16px;
}

.tpf-cart-panel.tpf-panel-open { right: 0; }

.tpf-cart-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    flex-shrink: 0;
}

.tpf-cart-panel-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--tpf-gray-900, #191F28);
    font-family: var(--tpf-font, system-ui);
    letter-spacing: -0.3px;
}

.tpf-cart-close {
    width: 36px;
    height: 36px;
    background: var(--tpf-gray-100, #F2F4F6);
    border: none;
    color: var(--tpf-gray-600, #6B7684);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.tpf-cart-close:hover {
    background: var(--tpf-gray-200, #E5E8EB);
    color: var(--tpf-gray-900, #191F28);
}

/* 아이템 영역 */
.tpf-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0 28px 16px;
}

.tpf-cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--tpf-gray-400, #B0B8C1);
}

.tpf-cart-empty svg { margin-bottom: 12px; }

.tpf-cart-empty p {
    font-size: 15px;
    color: var(--tpf-gray-500, #8B95A1);
    margin: 0;
    font-family: var(--tpf-font, system-ui);
}

/* 장바구니 아이템 */
.tpf-cart-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--tpf-gray-50, #F9FAFB);
    border-radius: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.tpf-cart-item-img {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--tpf-white, #fff);
}

.tpf-cart-item-img img { width: 100%; height: 100%; object-fit: cover; }

.tpf-cart-item-info { flex: 1; min-width: 0; }

.tpf-cart-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--tpf-gray-900, #191F28);
    margin: 0 0 2px;
    line-height: 1.4;
    letter-spacing: -0.2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tpf-cart-item-title a { color: inherit; text-decoration: none; }
.tpf-cart-item-title a:hover { color: var(--tpf-blue, #3182F6); }

.tpf-cart-item-excerpt {
    font-size: 12px;
    color: var(--tpf-gray-500, #8B95A1);
    margin: 0 0 10px;
}

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

/* 수량 컨트롤 */
.tpf-qty-control {
    display: inline-flex;
    align-items: center;
    background: var(--tpf-white, #fff);
    border-radius: 9999px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--tpf-gray-200, #E5E8EB);
}

.tpf-qty-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--tpf-gray-600, #6B7684);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tpf-qty-btn:hover { background: var(--tpf-gray-50, #F9FAFB); color: var(--tpf-gray-900, #191F28); }

.tpf-qty-input {
    width: 32px;
    height: 32px;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--tpf-gray-900, #191F28);
    background: transparent;
    font-family: var(--tpf-font, system-ui);
    -moz-appearance: textfield;
    appearance: textfield;
}

.tpf-qty-input::-webkit-inner-spin-button,
.tpf-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.tpf-cart-remove-item {
    background: none;
    border: none;
    color: var(--tpf-gray-400, #B0B8C1);
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    transition: color 0.2s;
    border-radius: 6px;
}

.tpf-cart-remove-item:hover { color: var(--tpf-red, #F04452); }

/* 패널 푸터 */
.tpf-cart-panel-footer {
    padding: 20px 28px 28px;
    border-top: 1px solid var(--tpf-gray-100, #F2F4F6);
    flex-shrink: 0;
}

.tpf-cart-summary {
    font-size: 14px;
    color: var(--tpf-gray-600, #6B7684);
    margin-bottom: 16px;
    font-family: var(--tpf-font, system-ui);
}

.tpf-cart-summary strong { color: var(--tpf-gray-900, #191F28); }

.tpf-cart-actions { display: flex; flex-direction: column; gap: 8px; }

/* 공통 버튼 */
.tpf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
    height: 52px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--tpf-font, system-ui);
    text-decoration: none;
    letter-spacing: -0.2px;
}

.tpf-btn-primary {
    background: var(--tpf-blue, #3182F6);
    color: #fff;
}

.tpf-btn-primary:hover { background: var(--tpf-blue-dark, #1B64DA); }

.tpf-btn-ghost-danger {
    background: transparent;
    color: var(--tpf-gray-500, #8B95A1);
    height: 44px;
    font-size: 14px;
}

.tpf-btn-ghost-danger:hover { color: var(--tpf-red, #F04452); background: rgba(240,68,82,0.06); }

/* 오버레이 */
.tpf-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.tpf-cart-overlay.active { display: block; }

/* ==========================================================================
   장바구니 전체 페이지
   ========================================================================== */
.tpf-cart-page-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 0;
    font-family: var(--tpf-font, system-ui);
}

.tpf-cart-page-wrap h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--tpf-gray-900, #191F28);
    letter-spacing: -0.3px;
}

.tpf-cart-list { display: flex; flex-direction: column; gap: 10px; }

.tpf-cart-list-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--tpf-white, #fff);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    align-items: center;
    border: 1px solid var(--tpf-gray-100, #F2F4F6);
}

.tpf-cart-list-img {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--tpf-gray-50, #F9FAFB);
}

.tpf-cart-list-img img { width: 100%; height: 100%; object-fit: cover; }

.tpf-cart-list-info { flex: 1; min-width: 0; }

.tpf-cart-list-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--tpf-gray-900, #191F28);
    text-decoration: none;
    margin-bottom: 10px;
    letter-spacing: -0.2px;
}

.tpf-cart-list-title:hover { color: var(--tpf-blue, #3182F6); }

.tpf-cart-list-controls { display: flex; align-items: center; gap: 12px; }

.tpf-cart-page-footer {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    justify-content: flex-end;
}

.tpf-cart-empty-page {
    text-align: center;
    padding: 80px 20px;
    color: var(--tpf-gray-400, #B0B8C1);
}

.tpf-cart-empty-page svg { margin-bottom: 12px; }

.tpf-cart-empty-page p {
    font-size: 16px;
    color: var(--tpf-gray-500, #8B95A1);
    margin: 0;
}

/* 반응형 */
@media (max-width: 767px) {
    .tpf-cart-floating { bottom: 24px; right: 24px; }
    .tpf-cart-floating-btn { width: 52px; height: 52px; }
    .tpf-cart-panel { max-width: 100vw; border-radius: 0; }
    .tpf-cart-page-footer { flex-direction: column; }
    .tpf-cart-list-item { padding: 16px; }
}

.tpf-cart-items::-webkit-scrollbar { width: 3px; }
.tpf-cart-items::-webkit-scrollbar-track { background: transparent; }
.tpf-cart-items::-webkit-scrollbar-thumb { background: var(--tpf-gray-200, #E5E8EB); border-radius: 3px; }
