/**
 * Recent Games/Spins Component
 * Sleek trading terminal aesthetic for game history
 *
 * Used by: Blackjack (recent-games), Slots (recent-spins)
 */

/* IBM Plex Mono for that financial data feel */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ============================================
   CONTAINER
   ============================================ */

.recent-spins {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;

    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(247, 147, 26, 0.3) transparent;
}

.recent-spins::-webkit-scrollbar {
    width: 4px;
}

.recent-spins::-webkit-scrollbar-track {
    background: transparent;
}

.recent-spins::-webkit-scrollbar-thumb {
    background: rgba(247, 147, 26, 0.3);
    border-radius: 2px;
}

.recent-spins::-webkit-scrollbar-thumb:hover {
    background: rgba(247, 147, 26, 0.5);
}

/* ============================================
   INDIVIDUAL GAME ITEM
   ============================================ */

.spin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.875rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.01) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;

    /* Entry animation */
    animation: slideInGame 0.3s ease-out backwards;
}

/* Staggered animation delays for items */
.spin-item:nth-child(1) { animation-delay: 0s; }
.spin-item:nth-child(2) { animation-delay: 0.05s; }
.spin-item:nth-child(3) { animation-delay: 0.1s; }
.spin-item:nth-child(4) { animation-delay: 0.15s; }
.spin-item:nth-child(5) { animation-delay: 0.2s; }
.spin-item:nth-child(6) { animation-delay: 0.25s; }
.spin-item:nth-child(7) { animation-delay: 0.3s; }
.spin-item:nth-child(8) { animation-delay: 0.35s; }
.spin-item:nth-child(9) { animation-delay: 0.4s; }
.spin-item:nth-child(10) { animation-delay: 0.45s; }

@keyframes slideInGame {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.spin-item:last-child {
    margin-bottom: 0;
}

.spin-item:hover {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

/* Win state - subtle green glow */
.spin-item.win-item {
    border-color: rgba(34, 197, 94, 0.15);
    background: linear-gradient(
        135deg,
        rgba(34, 197, 94, 0.06) 0%,
        rgba(34, 197, 94, 0.02) 100%
    );
}

.spin-item.win-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border-radius: 3px 0 0 3px;
}

/* Loss state - muted */
.spin-item.loss-item {
    opacity: 0.7;
}

.spin-item.loss-item:hover {
    opacity: 0.85;
}

/* Push/tie state */
.spin-item.push-item {
    border-color: rgba(255, 255, 255, 0.06);
}

.spin-item.push-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px 0 0 3px;
}

/* ============================================
   SLOTS: SYMBOL DISPLAY
   ============================================ */

.spin-symbols {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 1.125rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Individual symbol styling */
.spin-symbols span,
.spin-symbols .symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 1rem;
    transition: transform 0.15s ease;
}

.spin-item:hover .spin-symbols span,
.spin-item:hover .spin-symbols .symbol {
    transform: scale(1.05);
}

/* ============================================
   BLACKJACK: INFO DISPLAY
   ============================================ */

.spin-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.7);
}

.spin-bet {
    font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    padding: 0.125rem 0.375rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.spin-separator {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.625rem;
}

.spin-result {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.spin-result.win {
    color: #22c55e;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.spin-result.lose {
    color: rgba(255, 255, 255, 0.4);
}

.spin-result.push {
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   AMOUNT DISPLAY (Both games)
   ============================================ */

.spin-amount {
    font-family: 'IBM Plex Mono', 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.spin-amount.positive,
.spin-result.win {
    color: #22c55e;
}

.spin-amount.positive {
    background: rgba(34, 197, 94, 0.1);
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.spin-item:hover .spin-amount.positive {
    background: rgba(34, 197, 94, 0.15);
    text-shadow: 0 0 14px rgba(34, 197, 94, 0.5);
}

.spin-amount.negative {
    color: rgba(239, 68, 68, 0.8);
    background: rgba(239, 68, 68, 0.08);
}

.spin-amount.zero,
.spin-amount.neutral {
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   EMPTY STATE
   ============================================ */

.recent-spins .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8125rem;
    min-height: 120px;
}

.recent-spins .empty-state::before {
    content: '🎰';
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
    filter: grayscale(0.5);
}

/* Blackjack empty state icon */
#recent-games .empty-state::before {
    content: '🃏';
}

/* ============================================
   GAME HISTORY (Provably Fair Panel)
   ============================================ */

.game-history-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(247, 147, 26, 0.3) transparent;
}

.game-history-container::-webkit-scrollbar {
    width: 4px;
}

.game-history-container::-webkit-scrollbar-thumb {
    background: rgba(247, 147, 26, 0.3);
    border-radius: 2px;
}

.game-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.375rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideInGame 0.25s ease-out backwards;
}

.game-history-item:nth-child(1) { animation-delay: 0s; }
.game-history-item:nth-child(2) { animation-delay: 0.04s; }
.game-history-item:nth-child(3) { animation-delay: 0.08s; }
.game-history-item:nth-child(4) { animation-delay: 0.12s; }
.game-history-item:nth-child(5) { animation-delay: 0.16s; }

.game-history-item:last-child {
    margin-bottom: 0;
}

.game-history-item:hover {
    background: rgba(247, 147, 26, 0.1);
    border-color: rgba(247, 147, 26, 0.2);
    transform: translateX(3px);
}

.game-history-result {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.game-history-result.win {
    color: #22c55e;
}

.game-history-result.loss {
    color: rgba(239, 68, 68, 0.7);
}

.game-history-result.push {
    color: rgba(255, 255, 255, 0.5);
}

.game-history-seed {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6875rem;
    color: rgba(247, 147, 26, 0.7);
    background: rgba(247, 147, 26, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.game-history-nonce {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 0.25rem;
}

.game-history-loading,
.game-history-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8125rem;
    padding: 1rem;
}

/* ============================================
   CARD HEADER STYLING
   ============================================ */

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.03) 0%,
        transparent 100%
    );
}

.card-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
}

/* Live indicator dot */
.card-header::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .spin-item {
        padding: 0.625rem 0.75rem;
    }

    .spin-symbols {
        font-size: 1rem;
        gap: 0.25rem;
    }

    .spin-symbols span,
    .spin-symbols .symbol {
        width: 24px;
        height: 24px;
        font-size: 0.875rem;
    }

    .spin-info {
        font-size: 0.75rem;
    }

    .spin-amount {
        font-size: 0.8125rem;
        padding: 0.1875rem 0.5rem;
    }

    .spin-bet {
        font-size: 0.6875rem;
    }

    .recent-spins {
        max-height: 280px;
    }

    .card-header {
        padding: 0.625rem 0.875rem;
    }

    .card-title {
        font-size: 0.6875rem;
    }
}
