﻿/* =========================================
   Inventory Overlay
   ========================================= */

#inventory-overlay.modal-overlay {
    background: linear-gradient( 180deg, var(--cb-bg-gradient-top, #5CE65C), var(--cb-bg, #2E9E2E) ) !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 16px 16px calc(64px + env(safe-area-inset-bottom, 0px) + 12px) !important;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(4px);
}

#inventory-overlay .inventory-sheet {
    width: min(100%, 760px);
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #fbfbfb, #f2f2f2) !important;
    border-radius: 24px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18) !important;
    display: flex;
    flex-direction: column;
    padding: 18px !important;
    gap: 18px;
    color: #1f2330 !important;
}

#inventory-overlay .settings-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 12px;
}

#inventory-overlay .settings-title {
    margin: 0;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    color: #1f2330 !important;
}

#inventory-overlay .settings-header-spacer {
    width: 44px;
    height: 44px;
}

#inventory-overlay .settings-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.inventory-meta-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #8d4fff, #6f35f0);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(124, 77, 255, 0.18);
}

.inventory-dye-row {
    min-height: 72px;
}

.inventory-dye-icon {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f7f4ef, #ede9e2);
    border: 1px solid #d7d1c6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.inventory-dye-swatch {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.14);
}

.inventory-dye-swatch--light {
    border: 1px solid #d2d2d2;
}

.inventory-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #ece3ff;
    color: #6f35f0;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 640px) {
    #inventory-overlay .inventory-sheet {
        padding: 16px !important;
    }

    #inventory-overlay .settings-title {
        font-size: 24px;
    }
}

.coupon-right {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.coupon-expiry-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
    text-align: right;
}

.coupon-expiry-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #8a857d;
    letter-spacing: 0.04em;
}

.coupon-expiry-countdown {
    font-size: 12px;
    font-weight: 800;
    color: #7C4DFF;
    white-space: nowrap;
}

.coupon-list-item.is-expired .coupon-expiry-countdown {
    color: #b34747;
}

.coupon-list-item.is-expired {
    opacity: 0.7;
}

.inventory-empty-item {
    cursor: default;
    justify-content: flex-start;
    opacity: 0.9;
}

    .inventory-empty-item .pf-list-title {
        color: #1f2330;
    }

    .inventory-empty-item .pf-list-subtitle {
        color: #5f6675;
    }


/* =========================================
   Inventory Gift Boxes
   ========================================= */

.inventory-gift-item {
    cursor: pointer;
    position: relative;
}

    .inventory-gift-item.is-opening {
        opacity: 0.68;
        pointer-events: none;
    }

.inventory-gift-icon-wrap {
    background: radial-gradient(circle at 35% 25%, #fff7ed, #fde68a 42%, #f97316 100%) !important;
    border: 1px solid rgba(249, 115, 22, 0.28);
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.18);
}

.inventory-gift-icon {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.16));
}

#avatar-inventory-fab.has-gift-boxes::after {
    content: attr(data-gift-count);
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f97316;
    color: #ffffff;
    font-size: 11px;
    font-weight: 950;
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.32);
    border: 2px solid #ffffff;
}

.inventory-gift-item:hover .inventory-gift-icon {
    transform: scale(1.05) rotate(-2deg);
}

.inventory-gift-icon {
    transition: transform 0.14s ease;
}

/* =========================================
   Inventory Empty States
   Text-only centered, not button-looking
   ========================================= */

#inventory-overlay .inventory-empty-item {
    width: 100% !important;
    min-height: 76px !important;
    padding: 12px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    cursor: default !important;
    pointer-events: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

    #inventory-overlay .inventory-empty-item .pf-list-copy {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        text-align: center !important;
    }

    #inventory-overlay .inventory-empty-item .pf-list-title {
        display: block !important;
        width: 100% !important;
        color: #1f2330 !important;
        font-size: 15px !important;
        font-weight: 900 !important;
        text-align: center !important;
    }

    #inventory-overlay .inventory-empty-item .pf-list-subtitle {
        display: block !important;
        width: 100% !important;
        max-width: 260px !important;
        color: #5f6675 !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        line-height: 1.35 !important;
        text-align: center !important;
    }

/* =========================================
   Gift Box Opening Animation
   ========================================= */



.gift-box-open-overlay {
    position: fixed;
    inset: 0;
    z-index: 14000;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
    overflow: hidden;
    animation: cb-gift-overlay-in 0.18s ease-out both;
}

.gift-box-open-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 26px) 18px calc(env(safe-area-inset-bottom, 0px) + 26px);
    box-sizing: border-box;
    background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.34), rgba(255, 247, 237, 0.18) 30%, rgba(249, 115, 22, 0.08) 54%, transparent 72%), radial-gradient(circle at 50% 50%, rgba(124, 77, 255, 0.13), transparent 66%);
    overflow: visible;
    animation: cb-gift-stage-pop 0.56s cubic-bezier(.16, 1.2, .34, 1) both, cb-gift-stage-wiggle 0.68s ease-in-out 0.58s 2;
}

.gift-box-open-close {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 18px);
    right: 18px;
    z-index: 6;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-size: 30px;
    line-height: 1;
    font-weight: 950;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.24);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

    .gift-box-open-close:active,
    .gift-box-open-done:active {
        transform: scale(0.96);
    }

.gift-box-open-burst {
    position: absolute;
    width: min(110vmin, 760px);
    height: min(110vmin, 760px);
    border-radius: 999px;
    background: conic-gradient( from 0deg, rgba(249, 115, 22, 0), rgba(249, 115, 22, 0.52), rgba(250, 204, 21, 0.18), rgba(124, 77, 255, 0.42), rgba(92, 230, 92, 0.22), rgba(249, 115, 22, 0) );
    filter: blur(2px);
    opacity: 0;
    transform: scale(0.25) rotate(0deg);
    animation: cb-gift-burst 1.35s ease-out 0.62s both;
}

.gift-box-open-img {
    position: relative;
    z-index: 2;
    width: min(76vmin, 540px);
    height: min(76vmin, 540px);
    max-width: calc(100vw - 28px);
    max-height: 58dvh;
    object-fit: contain;
    filter: drop-shadow(0 26px 34px rgba(15, 23, 42, 0.36));
    transform-origin: center bottom;
    animation: cb-gift-img-pop 0.5s cubic-bezier(.16, 1.25, .34, 1) both, cb-gift-img-open 0.9s ease-in-out 0.58s both;
}

.gift-box-open-copy {
    position: relative;
    z-index: 3;
    width: min(92vw, 520px);
    margin-top: clamp(-18px, -2vh, -4px);
    padding: 18px 18px 16px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.10);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
    text-align: center;
    opacity: 0;
    transform: translateY(16px) scale(0.94);
    animation: cb-gift-copy-in 0.34s ease-out 1.42s both;
}

.gift-box-open-title {
    color: #7c2d12;
    font-size: 13px;
    line-height: 1.1;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gift-box-open-name {
    margin-top: 8px;
    color: #111827;
    font-size: clamp(26px, 8vw, 44px);
    line-height: 1.02;
    font-weight: 950;
    letter-spacing: -0.04em;
    overflow-wrap: anywhere;
}

.gift-box-open-done {
    margin-top: 16px;
    min-height: 46px;
    min-width: 120px;
    padding: 0 22px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #38B64A, #16822D);
    color: #ffffff;
    font-size: 16px;
    font-weight: 950;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14), 0 12px 24px rgba(22, 130, 45, 0.24);
    cursor: pointer;
}

.gift-box-open-overlay.is-leaving {
    animation: cb-gift-overlay-out 0.38s ease-in both;
}

    .gift-box-open-overlay.is-leaving .gift-box-open-stage {
        animation: cb-gift-stage-out 0.38s ease-in both;
    }

@keyframes cb-gift-overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes cb-gift-overlay-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes cb-gift-stage-pop {
    0% {
        opacity: 0;
        transform: scale(0.08) translateY(24px);
    }

    64% {
        opacity: 1;
        transform: scale(1.04) translateY(0);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes cb-gift-stage-wiggle {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(-1.2deg) scale(1.01);
    }

    75% {
        transform: rotate(1.2deg) scale(1.01);
    }
}

@keyframes cb-gift-stage-out {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.86) translateY(18px);
    }
}

@keyframes cb-gift-img-pop {
    0% {
        opacity: 0;
        transform: scale(0.1);
    }

    72% {
        opacity: 1;
        transform: scale(1.12);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes cb-gift-img-open {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }

    14% {
        transform: rotate(-8deg) scale(1.05);
    }

    28% {
        transform: rotate(8deg) scale(1.08);
    }

    42% {
        transform: rotate(-6deg) scale(1.12);
    }

    56% {
        transform: rotate(6deg) scale(1.16);
    }

    72% {
        transform: rotate(0deg) scale(1.22);
    }

    86% {
        transform: rotate(0deg) scale(1.08);
    }
}

@keyframes cb-gift-burst {
    0% {
        opacity: 0;
        transform: scale(0.2) rotate(0deg);
    }

    34% {
        opacity: 0.95;
    }

    100% {
        opacity: 0;
        transform: scale(1.55) rotate(160deg);
    }
}

@keyframes cb-gift-copy-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 420px) {
    .gift-box-open-img {
        width: min(86vw, 430px);
        height: min(86vw, 430px);
        max-height: 54dvh;
    }

    .gift-box-open-copy {
        width: calc(100vw - 28px);
        padding: 16px 14px 14px;
        border-radius: 24px;
    }

    .gift-box-open-name {
        font-size: clamp(24px, 9vw, 38px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gift-box-open-overlay,
    .gift-box-open-stage,
    .gift-box-open-burst,
    .gift-box-open-img,
    .gift-box-open-copy {
        animation: none !important;
    }

    .gift-box-open-copy {
        opacity: 1;
        transform: none;
    }
}
