/* Coin packs page — matches shop aesthetic */

.page-shop-coins .shop-page {
    max-width: 1100px;
    padding-top: clamp(0.25rem, 1vw, 0.5rem);
}

/* En-tête : retour + titre + bulle coins (grille locale, n'affecte pas les packs) */
.shop-coins-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "back wallet"
        "hero hero";
    align-items: start;
    margin-top: 0;
    margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
}

.shop-coins-topbar {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    grid-area: back;
}

.shop-coins-header__wallet {
    grid-area: wallet;
    align-self: center;
    justify-self: end;
    z-index: 25;
}

.shop-coins-hero {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    text-align: center;
    pointer-events: none;
    grid-area: hero;
}

.shop-coins-hero .shop-page__tagline {
    pointer-events: auto;
}

.page-shop-coins .shop-coins-hero .shop-page__tagline {
    margin: 0.75rem auto 0;
    max-width: 32rem;
}

.shop-coins-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-ink);
    text-decoration: none;
    flex-shrink: 0;
    opacity: 0.85;
}

.shop-coins-back:hover {
    opacity: 1;
    text-decoration: underline;
    color: var(--text-ink);
}

.shop-coins-packs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1rem, 2.5vw, 1.5rem);
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.shop-coin-pack {
    --pack-violet: #2C123B;
    position: relative;
    z-index: 0;
    background: var(--bg-surface);
    border-radius: 20px;
    box-shadow: 0 8px 28px rgba(44, 18, 59, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
    border: 2px solid rgba(44, 18, 59, 0.08);
}

.shop-coin-pack:hover {
    z-index: 2;
    transform: translateY(-6px);
    border-color: var(--pack-violet);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--pack-violet) 28%, transparent),
        0 10px 28px color-mix(in srgb, var(--pack-violet) 16%, transparent),
        0 0 22px color-mix(in srgb, var(--pack-violet) 34%, transparent),
        0 0 48px color-mix(in srgb, var(--pack-violet) 20%, transparent),
        0 0 84px color-mix(in srgb, var(--pack-violet) 12%, transparent);
}

.shop-coin-pack__visual {
    background: linear-gradient(160deg, #f8f4ff 0%, #fff5f8 50%, #fff8ee 100%);
    padding: 1.5rem 1rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

html[data-theme="dark"] .shop-coin-pack {
    background: transparent;
    box-shadow: none;
    border-color: var(--border-soft);
}

html[data-theme="dark"] .shop-coin-pack:hover {
    border-color: color-mix(in srgb, var(--pack-violet) 42%, #e8dcf6);
    box-shadow:
        0 0 0 1px color-mix(in srgb, #e8dcf6 45%, transparent),
        0 10px 28px rgba(44, 18, 59, 0.45),
        0 0 26px color-mix(in srgb, #cbb3e6 50%, transparent),
        0 0 52px color-mix(in srgb, #bf91ff 32%, transparent),
        0 0 90px color-mix(in srgb, var(--pack-violet) 55%, transparent);
}

html[data-theme="dark"] .shop-coin-pack__visual {
    background: transparent;
}

.shop-coin-pack__visual img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.shop-coin-pack__body {
    padding: 1.1rem 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.shop-coin-pack__name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-ink);
}

.shop-coin-pack__coins {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-ink);
}

.shop-coin-pack__coins img {
    width: 28px;
    height: 28px;
}

.shop-coin-pack__usd {
    margin: 0;
    font-size: 0.95rem;
    color: #685C8F;
}

.shop-coin-pack__buy {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, #A030FF 0%, #FF30A0 48%, #FFB030 100%);
    box-shadow: 0 4px 16px rgba(160, 48, 255, 0.3);
    transition: filter 0.2s ease, transform 0.15s ease;
}

.shop-coin-pack__buy:hover {
    filter: brightness(1.06);
    transform: scale(1.02);
    color: #fff;
}

.shop-coin-pack--locked {
    opacity: 0.92;
}

.shop-coin-pack__buy--disabled {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: #9E9E9E;
    box-shadow: none;
    cursor: not-allowed;
    user-select: none;
}

.shop-coins-limit-notice {
    margin: 1rem auto 0;
    max-width: 36rem;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: center;
    background: rgba(255, 152, 0, 0.12);
    border: 1px solid rgba(255, 152, 0, 0.35);
    border-radius: 12px;
}

.shop-coins-license__form--locked .license_input,
.shop-coins-license__form--locked .license_button {
    opacity: 0.55;
    cursor: not-allowed;
}

.shop-coins-license {
    width: 100%;
    max-width: none;
    margin: 0;
}

.shop-coins-license__title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
}

.shop-coins-license__hint {
    margin: 0 0 1.25rem;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.45;
}

/* Bulle code licence — pleine largeur, champ mis en avant */
.page-shop-coins .shop_header_license {
    max-width: none;
    width: 100%;
    gap: 0.75rem;
}

.page-shop-coins .license_section {
    max-width: none;
    width: 100%;
    border-radius: 20px;
    padding: clamp(1.15rem, 2.5vw, 1.65rem) clamp(1.35rem, 3vw, 2rem);
    background: linear-gradient(155deg, #0a0a0a 0%, #12121a 55%, #0f0f14 100%);
    border: 2px solid rgba(160, 48, 255, 0.22);
    box-shadow:
        0 10px 36px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.page-shop-coins .license_input_row {
    gap: clamp(0.85rem, 2vw, 1.35rem);
}

.page-shop-coins .license_input_row label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    opacity: 0.8;
}

.page-shop-coins .license_input {
    flex: 1;
    min-width: 0;
    padding: clamp(0.9rem, 2.2vw, 1.15rem) clamp(1.25rem, 3vw, 1.75rem);
    border-radius: 14px;
    border: 2px solid #333;
    font-size: clamp(1.3rem, 2.8vw, 1.7rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.25;
}

.page-shop-coins .license_input:focus {
    border-color: rgba(160, 48, 255, 0.65);
    background: #16161f;
    box-shadow: 0 0 0 4px rgba(160, 48, 255, 0.14);
}

.page-shop-coins .license_input::placeholder {
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 500;
    letter-spacing: 0.03em;
    opacity: 0.55;
}

.page-shop-coins .license_button {
    padding: clamp(0.9rem, 2.2vw, 1.15rem) clamp(1.5rem, 3.5vw, 2.25rem);
    border-radius: 14px;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    min-width: clamp(110px, 14vw, 140px);
}

.page-shop-coins .license_result {
    border-radius: 14px;
    padding: clamp(0.75rem, 1.8vw, 0.95rem) clamp(1.1rem, 2.5vw, 1.5rem);
    font-size: clamp(0.95rem, 1.6vw, 1.05rem);
}

@media (max-width: 900px) {
    .shop-coins-packs {
        grid-template-columns: 1fr;
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Colonne mobile : description → code licence → packs → solde
       display:contents sur le header pour réordonner sans toucher aux largeurs desktop */
    .shop-page--coins {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .shop-coins-header {
        display: contents;
        margin-bottom: 0;
    }

    .shop-coins-topbar {
        order: 1;
        margin-bottom: 0.35rem;
    }

    .shop-coins-hero {
        order: 2;
        width: 100%;
        text-align: center;
    }

    .page-shop-coins .shop-coins-hero .shop-page__tagline {
        margin: var(--shop-mobile-tagline-margin-top, 0.25rem) auto 0;
        margin-bottom: 0;
        max-width: none;
        text-align: center;
        line-height: 1.25;
    }

    .shop-coins-license {
        order: 3;
        margin-top: var(--shop-mobile-desc-wallet-gap, 1.75rem);
        margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
    }

    .shop-coins-license__title,
    .shop-coins-license__hint {
        display: none;
    }

    .shop-coins-packs {
        order: 4;
        margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
    }

    .shop-coins-header__wallet {
        order: 5;
        width: 100%;
        box-sizing: border-box;
        align-self: stretch;
    }
}

@media (max-width: 768px) {
    .shop-coin-pack__visual {
        min-height: 160px;
    }

    .page-shop-coins .license_section {
        border-radius: 16px;
        padding: 1.15rem 1.1rem;
    }

    .page-shop-coins .license_input_row {
        gap: 0.85rem;
    }

    .page-shop-coins .license_input {
        font-size: 1.35rem;
        padding: 0.95rem 1.15rem;
        border-radius: 12px;
    }

    .page-shop-coins .license_button {
        padding: 0.95rem 1.25rem;
        font-size: 1.05rem;
        border-radius: 12px;
    }

    .page-shop-coins .license_result {
        border-radius: 12px;
    }
}

/* ----- Coin rain (license redeemed) ----- */
.coin-rain-layer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
}

.coin-rain-layer.is-active {
    animation: coin-rain-layer-fade 3.8s ease forwards;
}

@keyframes coin-rain-layer-fade {
    0%, 75% { opacity: 1; }
    100% { opacity: 0; }
}

.coin-rain-coin {
    position: absolute;
    top: -12vh;
    width: var(--coin-size, 36px);
    height: var(--coin-size, 36px);
    object-fit: contain;
    will-change: transform, opacity, filter;
    filter: drop-shadow(0 2px 6px rgba(160, 48, 255, 0.35));
    animation:
        coin-rain-fall var(--fall-duration, 2.2s) var(--fall-delay, 0s) cubic-bezier(0.45, 0.05, 0.55, 0.95) forwards,
        coin-rain-shimmer 0.9s var(--fall-delay, 0s) ease-in-out 3;
}

@keyframes coin-rain-fall {
    0% {
        transform: translate3d(0, 0, 0) rotate(var(--rot-start, 0deg)) scale(0.5);
        opacity: 0;
    }
    6% {
        opacity: 1;
        transform: translate3d(calc(var(--drift-x, 0) * 0.1), 8vh, 0) rotate(calc(var(--rot-start, 0deg) + 40deg)) scale(0.85);
    }
    55% {
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--drift-x, 0), 112vh, 0) rotate(var(--rot-end, 420deg)) scale(1);
        opacity: 0.7;
    }
}

@keyframes coin-rain-shimmer {
    0%, 100% {
        filter: drop-shadow(0 2px 6px rgba(160, 48, 255, 0.35)) brightness(1);
    }
    50% {
        filter: drop-shadow(0 0 14px rgba(255, 176, 48, 0.75)) brightness(1.2);
    }
}

.shop-coin-wallet--pulse {
    animation: coin-wallet-pulse 0.65s cubic-bezier(0.34, 1.4, 0.64, 1) 2;
}

@keyframes coin-wallet-pulse {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
    .coin-rain-layer {
        display: none !important;
    }
    .shop-coin-wallet--pulse {
        animation: none;
    }
    .shop-coin-pack:hover {
        transform: none;
    }
}
