/* ==============================================
   COMPONENTS - CREDIT ECONOMY UI
   ============================================== */

/* ── Credit Badge (Top Bar) ─────────────────── */
.credit-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border: 1px solid rgba(255, 193, 7, 0.25);
    border-radius: 20px;
    color: #ffc107;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.credit-badge i {
    font-size: 0.8rem;
    animation: coin-glow 2s ease-in-out infinite alternate;
}

.credit-badge:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25), rgba(255, 152, 0, 0.2));
    border-color: rgba(255, 193, 7, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
}

@keyframes coin-glow {
    from {
        filter: drop-shadow(0 0 2px rgba(255, 193, 7, 0.3));
    }

    to {
        filter: drop-shadow(0 0 6px rgba(255, 193, 7, 0.6));
    }
}

/* ── Credit Cost Indicator (Creation Modal Footer) ─ */
.credit-cost-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.06));
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 16px;
    color: #ffc107;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.credit-cost-indicator i {
    font-size: 0.75rem;
}

.credit-cost-indicator strong {
    font-weight: 700;
    font-size: 0.95rem;
}

.credit-cost-indicator.cost-updated {
    animation: cost-pulse 0.4s ease;
}

@keyframes cost-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
        border-color: rgba(255, 193, 7, 0.5);
    }

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

/* ── Modal Footer Layout Fix ───────────────── */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.modal-footer-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ── Credit Error (In-Modal) ───────────────── */
.credit-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.12), rgba(255, 68, 68, 0.06));
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 12px;
    color: #ff6b6b;
    font-size: 0.88rem;
    animation: shake-error 0.4s ease;
}

.credit-error i {
    font-size: 1.1rem;
    color: #ffc107;
}

.credit-error strong {
    color: #fff;
    font-weight: 700;
}

@keyframes shake-error {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(2px);
    }
}

/* ── User Profile Zone — flex layout for badge + user ─ */
.user-profile-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

/* ==================================================
   CREDIT STORE MODAL
   ================================================== */

.credit-store-modal {
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(15, 15, 20, 0.96);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 0;
    animation: modal-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.credit-store-modal::-webkit-scrollbar {
    width: 4px;
}

.credit-store-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.credit-store-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.credit-store-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.credit-store-header h2 i {
    color: #ffc107;
}

/* ── Balance Card ────────────────────────────── */
.credit-store-balance {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 28px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.12), rgba(255, 152, 0, 0.06));
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 20px;
}

.store-balance-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #000;
}

.store-balance-info {
    display: flex;
    flex-direction: column;
}

.store-balance-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
}

.store-balance-value {
    font-size: 2rem;
    font-weight: 800;
    color: #ffc107;
    line-height: 1.1;
}

/* ── Section ─────────────────────────────────── */
.credit-store-section {
    padding: 0 28px 20px;
}

.credit-store-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin: 16px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.credit-store-section h3 i {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.35);
}

/* ── Credit Packs Grid ───────────────────────── */
.credit-packs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.credit-pack {
    position: relative;
    padding: 18px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.credit-pack:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.credit-pack.popular {
    border-color: rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.06);
}

.credit-pack.popular:hover {
    border-color: rgba(255, 193, 7, 0.5);
    box-shadow: 0 4px 20px rgba(255, 193, 7, 0.1);
}

.pack-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: 10px;
}

.pack-coins {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffc107;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pack-coins i {
    font-size: 1rem;
}

.pack-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
}

.pack-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 10px;
}

.pack-buy-btn {
    width: 100%;
    padding: 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.2s;
}

/* ── Promo Code Form ─────────────────────────── */
.promo-code-form {
    display: flex;
    gap: 10px;
}

.promo-code-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    outline: none;
    transition: all 0.2s;
}

.promo-code-form input:focus {
    border-color: rgba(255, 193, 7, 0.4);
    background: rgba(255, 193, 7, 0.04);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.08);
}

.promo-code-form input::placeholder {
    color: rgba(255, 255, 255, 0.25);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.promo-redeem-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.promo-redeem-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.promo-redeem-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Promo Result ────────────────────────────── */
.promo-result {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.promo-result.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.promo-result.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff6b6b;
}

/* ── Transaction List ────────────────────────── */
.txn-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.txn-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.2s;
}

.txn-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.txn-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.txn-desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.txn-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 2px;
}

.txn-amount {
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    padding-left: 12px;
}

.txn-amount.positive {
    color: #22c55e;
}

.txn-amount.negative {
    color: #ff6b6b;
}

.txn-empty {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .credit-badge {
        padding: 4px 10px;
        font-size: 0.78rem;
    }

    .credit-cost-indicator {
        font-size: 0.8rem;
        padding: 4px 10px;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-footer-actions {
        margin-left: 0;
        justify-content: flex-end;
    }

    .credit-store-modal {
        width: 96%;
        max-height: 90vh;
        border-radius: 20px;
    }

    .credit-packs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .credit-store-header {
        padding: 18px 20px 12px;
    }

    .credit-store-balance {
        margin: 14px 20px;
        padding: 16px 18px;
    }

    .credit-store-section {
        padding: 0 20px 16px;
    }
}