/**
 * Live Playing Widget Styles
 * Floating widget displaying "Games Played Right Now"
 */

/* Widget Container */
#live-playing-widget {
    position: fixed;
    bottom: 20px;
    right: 80px;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    font-family: 'Poppins', sans-serif;
    z-index: 9999;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
    contain: layout style;
}

#live-playing-widget:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Collapsed State */
#live-playing-widget[collapsed] {
    width: auto;
    min-width: 180px;
}

#live-playing-widget[collapsed] .lpw-content {
    display: none;
}

#live-playing-widget[collapsed] .lpw-toggle svg {
    transform: rotate(180deg);
}

#live-playing-widget[collapsed] .lpw-header {
    border-radius: 16px;
}

/* Header */
.lpw-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #4f6af0 0%, #3d5ce8 100%);
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.lpw-live-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Pulsing Live Dot */
.lpw-pulse {
    position: relative;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.6);
    animation: lpw-pulse 2s infinite;
}

.lpw-pulse::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: rgba(34, 197, 94, 0.3);
    border-radius: 50%;
    animation: lpw-pulse-ring 2s infinite;
}

@keyframes lpw-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes lpw-pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.lpw-live-text {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.lpw-title {
    font-size: 12px;
    font-weight: 500;
    flex: 1;
}

.lpw-total {
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.18);
    padding: 3px 8px;
    border-radius: 12px;
    min-width: 36px;
    text-align: center;
}

.lpw-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
}

.lpw-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lpw-toggle svg {
    width: 14px;
    height: 14px;
    color: #ffffff;
    transition: transform 0.3s ease;
}

/* Content */
.lpw-content {
    max-height: 400px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Loading State */
.lpw-loading {
    padding: 24px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* Games List */
.lpw-games {
    display: flex;
    flex-direction: column;
}

/* Game Item */
.lpw-game {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.lpw-game:last-child {
    border-bottom: none;
}

.lpw-game:hover {
    background: #f9fafb;
}

.lpw-game:active {
    background: #f3f4f6;
}

/* Game Rank */
.lpw-game-rank {
    width: 20px;
    height: 20px;
    background: #f3f4f6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    flex-shrink: 0;
}

.lpw-game:nth-child(1) .lpw-game-rank {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #ffffff;
}

.lpw-game:nth-child(2) .lpw-game-rank {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: #ffffff;
}

.lpw-game:nth-child(3) .lpw-game-rank {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #ffffff;
}

/* Game Image */
.lpw-game-image {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}

/* Game Info */
.lpw-game-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lpw-game-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lpw-game-developer {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Player Count */
.lpw-game-players {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.lpw-player-count {
    font-size: 15px;
    font-weight: 700;
    color: #183DFF;
    transition: color 0.3s ease;
    min-width: 30px;
    text-align: right;
}

.lpw-player-count.lpw-increasing {
    color: #22c55e;
}

.lpw-player-count.lpw-decreasing {
    color: #ef4444;
}

.lpw-player-label {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    #live-playing-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }

    #live-playing-widget[collapsed] {
        left: auto;
        right: 10px;
        width: auto;
    }

    .lpw-header {
        padding: 10px 14px;
    }

    .lpw-game {
        padding: 10px 14px;
        gap: 10px;
    }

    .lpw-game-image {
        width: 36px;
        height: 36px;
    }

    .lpw-game-name {
        font-size: 12px;
    }

    .lpw-player-count {
        font-size: 14px;
    }
}

/* Hide on very small screens or when print */
@media (max-width: 360px), print {
    #live-playing-widget {
        display: none;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    #live-playing-widget,
    .lpw-toggle svg,
    .lpw-pulse,
    .lpw-pulse::before {
        animation: none;
        transition: none;
    }
}

/* Dark mode support (optional - uncomment if needed) */
/*
@media (prefers-color-scheme: dark) {
    #live-playing-widget {
        background: #1f2937;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .lpw-game:hover {
        background: #374151;
    }

    .lpw-game-rank {
        background: #374151;
        color: #9ca3af;
    }

    .lpw-game-name {
        color: #f9fafb;
    }

    .lpw-game {
        border-bottom-color: #374151;
    }
}
*/
