/**
 * PWS — Play With Streamers
 *
 * Follows the AdriaZone dark design system established in:
 *   hltv-profile-style.css     (card system, hero, typography)
 *   hltv-matches-style.css     (row pattern, list layout)
 *   hltv-streams-style.css     (tab / grid pattern)
 *   hltv-news-style.css        (section labels, borders)
 *
 * Existing tokens reused (no overrides):
 *   --hp-bg-deep    #0d1117   deepest background
 *   --hp-bg         #161a21   card background
 *   --hp-bg-elevated #1c2333  inputs / inner
 *   --hp-bg-hover   #21262d   row hover
 *   --hp-border     #30363d   standard border
 *   --hp-border-sub #21262d   subtle border
 *   --hp-text       #e6edf3   primary text
 *   --hp-text-sec   #c9d1d9   secondary text
 *   --hp-text-muted #8fa3b3   labels
 *   --hp-accent     #e94560   red accent
 *   --hp-green      #3fb950   success
 *
 * PWS-specific tokens use --pws- prefix to avoid collisions.
 */

/* =============================================================================
   PWS Tokens
   ============================================================================= */
:root {
    --pws-gold:         #f5a623;
    --pws-gold-dim:     #c47f0a;
    --pws-gold-bg:      rgba(245, 166, 35, .10);
    --pws-silver:       #8fa3b3;
    --pws-silver-bg:    rgba(143, 163, 179, .10);
    --pws-bronze:       #cd7f32;
    --pws-bronze-bg:    rgba(205, 127, 50, .10);
    --pws-winner-glow:  rgba(233, 69, 96, .15);
    --pws-backup-glow:  rgba(88, 166, 255, .10);
    --pws-radius:       10px;
    --pws-radius-sm:    6px;
    --pws-radius-lg:    14px;
    --pws-transition:   .18s ease;
    --pws-max:          960px;
}

/* =============================================================================
   Wrapper
   ============================================================================= */
.pws-wrap {
    max-width: var(--pws-max);
    margin: 0 auto;
    padding: 0 16px 80px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #c9d1d9;
    font-size: 14px;
}

/* =============================================================================
   Hero
   ============================================================================= */
.pws-hero {
    background: #161a21;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius-lg);
    padding: 32px 28px;
    margin: 24px 0;
    display: flex;
    align-items: flex-start;
    gap: 32px;
    justify-content: space-between;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}
.pws-hero::before {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(233,69,96,.1) 0%, transparent 70%);
    pointer-events: none;
}

.pws-hero-inner { flex: 1; min-width: 240px; }

.pws-hero-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #e94560;
    background: rgba(233,69,96,.12);
    border: 1px solid rgba(233,69,96,.3);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.pws-hero-title {
    font-size: 28px;
    font-weight: 800;
    color: #e6edf3;
    margin: 0 0 10px;
    line-height: 1.2;
}

.pws-hero-desc {
    color: #8fa3b3;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px;
    max-width: 480px;
}

.pws-hero-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-self: center;
}
.pws-hero-stat {
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius);
    padding: 14px 20px;
    text-align: center;
    min-width: 90px;
}
.pws-hero-stat-num {
    display: block;
    font-size: 26px;
    font-weight: 800;
    color: #e94560;
    line-height: 1;
    margin-bottom: 5px;
}
.pws-hero-stat-label {
    font-size: 11px;
    color: #8fa3b3;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* =============================================================================
   Points Guide
   ============================================================================= */
.pws-points-guide {
    background: #161a21;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius);
    margin-bottom: 24px;
    overflow: hidden;
}
.pws-points-guide summary {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #c9d1d9;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pws-points-guide summary::-webkit-details-marker { display: none; }
.pws-points-guide[open] summary { border-bottom: 1px solid #21262d; }

.pws-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1px;
    background: #21262d;
    padding: 1px;
}
.pws-point-item {
    background: #161a21;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #c9d1d9;
}
.pws-point-item small { color: #6e7681; font-size: 11px; display: block; }
.pws-pt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 24px;
    padding: 0 8px;
    background: rgba(233,69,96,.15);
    border: 1px solid rgba(233,69,96,.3);
    border-radius: 12px;
    color: #e94560;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* =============================================================================
   Tab Navigation
   ============================================================================= */
.pws-tabs-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 0;
    scrollbar-width: thin;
    scrollbar-color: #30363d transparent;
}
.pws-tabs-nav::-webkit-scrollbar { height: 4px; }
.pws-tabs-nav::-webkit-scrollbar-thumb { background: #30363d; border-radius: 2px; }

.pws-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #161a21;
    border: 1px solid #30363d;
    border-bottom: none;
    border-radius: var(--pws-radius-sm) var(--pws-radius-sm) 0 0;
    color: #8fa3b3;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--pws-transition), background var(--pws-transition);
    white-space: nowrap;
    font-family: inherit;
    outline: none;
}
.pws-tab-btn:hover { color: #c9d1d9; background: #1c2333; }
.pws-tab-btn.active {
    background: #1c2333;
    color: #e6edf3;
    border-color: #30363d;
    border-bottom-color: #1c2333;
    position: relative;
    z-index: 1;
}
.pws-tab-avatar {
    width: 22px; height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #30363d;
}

/* =============================================================================
   Tab Panel
   ============================================================================= */
.pws-tab-panel {
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: 0 var(--pws-radius) var(--pws-radius) var(--pws-radius);
    overflow: hidden;
}

/* =============================================================================
   Streamer Card (inside panel)
   ============================================================================= */
.pws-streamer-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    border-bottom: 1px solid #30363d;
    flex-wrap: wrap;
    background: #161a21;
}

.pws-streamer-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 200px;
}
.pws-streamer-photo {
    width: 56px; height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #30363d;
    flex-shrink: 0;
}
.pws-streamer-name {
    font-size: 18px;
    font-weight: 700;
    color: #e6edf3;
    margin: 0 0 8px;
}
.pws-streamer-links { display: flex; gap: 8px; flex-wrap: wrap; }

.pws-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    text-decoration: none !important;
    transition: opacity var(--pws-transition);
}
.pws-link-btn:hover { opacity: .8; }
.pws-link-twitch { background: rgba(145,70,255,.15); color: #9146ff; border: 1px solid rgba(145,70,255,.3); }
.pws-link-ig     { background: rgba(225,48,108,.15); color: #e1306c; border: 1px solid rgba(225,48,108,.3); }

.pws-streamer-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }

.pws-joined-badge {
    font-size: 12px;
    font-weight: 700;
    color: #3fb950;
    background: rgba(63,185,80,.1);
    border: 1px solid rgba(63,185,80,.3);
    padding: 4px 12px;
    border-radius: 20px;
}

.pws-earn-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.pws-earn-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--pws-radius-sm);
    border: 1px solid #30363d;
    background: #1c2333;
    color: #c9d1d9;
    cursor: pointer;
    font-family: inherit;
    transition: border-color var(--pws-transition), background var(--pws-transition);
    outline: none;
}
.pws-earn-btn:hover { border-color: #e94560; background: rgba(233,69,96,.08); }
.pws-earn-btn:disabled { opacity: .4; cursor: default; pointer-events: none; }
.pws-earn-btn.done { color: #3fb950; border-color: rgba(63,185,80,.4); background: rgba(63,185,80,.06); cursor: default; }
.pws-earn-pts { color: #e94560; font-weight: 700; font-size: 11px; }

/* =============================================================================
   Buttons
   ============================================================================= */
.pws-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: var(--pws-radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--pws-transition);
    outline: none;
    text-decoration: none !important;
}
.pws-btn-primary:hover { background: #ff6080; }
.pws-btn-primary:disabled { opacity: .5; cursor: default; pointer-events: none; }

.pws-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: transparent;
    color: #8fa3b3;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: border-color var(--pws-transition), color var(--pws-transition);
    outline: none;
}
.pws-btn-secondary:hover { border-color: #8fa3b3; color: #c9d1d9; }

/* =============================================================================
   Leaderboard Section
   ============================================================================= */
.pws-lb-section { padding: 20px 24px; }

.pws-lb-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.pws-lb-filter-group { display: flex; align-items: center; gap: 6px; }
.pws-filter-label { font-size: 11px; color: #6e7681; text-transform: uppercase; letter-spacing: .06em; }

.pws-filter-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    border: 1px solid #30363d;
    background: transparent;
    color: #8fa3b3;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--pws-transition);
    outline: none;
}
.pws-filter-btn:hover { border-color: #e94560; color: #c9d1d9; }
.pws-filter-btn.active { background: rgba(233,69,96,.15); border-color: rgba(233,69,96,.5); color: #e94560; }

.pws-filter-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #8fa3b3; cursor: pointer; }
.pws-filter-toggle input { accent-color: #e94560; cursor: pointer; }

/* My rank strip */
.pws-my-rank {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(233,69,96,.07);
    border: 1px solid rgba(233,69,96,.2);
    border-radius: var(--pws-radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #c9d1d9;
}

/* =============================================================================
   Leaderboard Table
   ============================================================================= */
.pws-lb-table-wrap {
    background: #161a21;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius);
    overflow: hidden;
}

.pws-lb-loading, .pws-lb-empty {
    padding: 40px 20px;
    text-align: center;
    color: #6e7681;
    font-size: 13px;
}

.pws-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.pws-lb-table thead th {
    background: #0d1117;
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #6e7681;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom: 1px solid #21262d;
}

.pws-lb-row {
    border-bottom: 1px solid #21262d;
    transition: background var(--pws-transition);
}
.pws-lb-row:last-child { border-bottom: none; }
.pws-lb-row:hover { background: #21262d; }

/* Position-type highlights */
.pws-lb-winner { background: var(--pws-winner-glow); }
.pws-lb-winner:hover { background: rgba(233,69,96,.22); }
.pws-lb-backup  { background: var(--pws-backup-glow); }
.pws-lb-backup:hover  { background: rgba(88,166,255,.16); }
.pws-lb-me { outline: 2px solid rgba(233,69,96,.5); outline-offset: -2px; }

.pws-lb-table td { padding: 10px 14px; vertical-align: middle; }

/* Rank column */
.pws-lb-col-rank { width: 80px; }
.pws-rank { font-size: 12px; font-weight: 700; color: #8fa3b3; font-variant-numeric: tabular-nums; }
.pws-rank-gold   { color: var(--pws-gold); }
.pws-rank-silver { color: var(--pws-silver); }
.pws-rank-bronze { color: var(--pws-bronze); }

/* User column */
.pws-lb-user { display: flex; align-items: center; gap: 10px; }
.pws-lb-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #30363d;
    flex-shrink: 0;
}
.pws-lb-name { color: #c9d1d9; font-weight: 500; }
.pws-lb-name-me { color: #e6edf3; font-weight: 700; }
.pws-me-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #e94560;
    background: rgba(233,69,96,.15);
    border: 1px solid rgba(233,69,96,.35);
    padding: 1px 6px;
    border-radius: 10px;
    vertical-align: middle;
}

/* Points column */
.pws-lb-col-pts { width: 100px; text-align: right; }
.pws-lb-pts { font-size: 14px; font-weight: 700; color: #e6edf3; font-variant-numeric: tabular-nums; }

/* Status column */
.pws-lb-col-status { width: 120px; }
.pws-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}
.pws-status-winner { background: rgba(233,69,96,.15); color: #e94560; border: 1px solid rgba(233,69,96,.3); }
.pws-status-backup  { background: rgba(88,166,255,.12); color: #58a6ff; border: 1px solid rgba(88,166,255,.3); }

/* Hidden-me rows (highlight-me toggle) */
.pws-hide-non-me .pws-lb-row:not(.pws-lb-me) { opacity: .25; }

/* =============================================================================
   Instagram Modal
   ============================================================================= */
.pws-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.pws-modal {
    background: #161a21;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius-lg);
    padding: 28px 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    position: relative;
}
.pws-modal h3 { font-size: 18px; color: #e6edf3; margin: 0 0 12px; }
.pws-modal p  { color: #8fa3b3; font-size: 14px; margin: 0 0 16px; }
.pws-ig-countdown { font-size: 13px; color: #6e7681; margin-bottom: 16px; }
.pws-ig-countdown strong { color: #e94560; }
.pws-modal .pws-btn-primary   { width: 100%; justify-content: center; margin-bottom: 8px; }
.pws-modal .pws-btn-secondary { width: 100%; justify-content: center; }

/* =============================================================================
   Toast notification
   ============================================================================= */
.pws-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    background: #1c2333;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius);
    padding: 12px 18px;
    font-size: 13px;
    color: #c9d1d9;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    animation: pws-toast-in .25s ease;
}
.pws-toast.success { border-color: rgba(63,185,80,.5); color: #3fb950; }
.pws-toast.error   { border-color: rgba(233,69,96,.5); color: #e94560; }

@keyframes pws-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   Empty / misc
   ============================================================================= */
.pws-empty {
    padding: 40px 20px;
    text-align: center;
    color: #6e7681;
    background: #161a21;
    border: 1px solid #30363d;
    border-radius: var(--pws-radius);
    margin: 24px 0;
}

/* =============================================================================
   Admin styles (scoped to .pws-admin-wrap)
   ============================================================================= */
.pws-admin-wrap h1 { color: #1d2327; margin-bottom: 20px; }
.pws-admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.pws-admin-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
}
.pws-admin-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.pws-admin-card-header img {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.pws-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.pws-badge.active   { background: #d4edda; color: #155724; }
.pws-badge.inactive { background: #f8d7da; color: #721c24; }
.pws-stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pws-stat-table td { padding: 4px 6px; border-bottom: 1px solid #eee; }
.pws-stat-table td:last-child { text-align: right; font-weight: 600; }
.pws-admin-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.pws-admin-form-wrap { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 20px; }
@media (max-width: 768px) { .pws-admin-two-col { grid-template-columns: 1fr; } }

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 640px) {
    .pws-hero { flex-direction: column; gap: 20px; }
    .pws-hero-stats { justify-content: flex-start; }
    .pws-streamer-card { flex-direction: column; align-items: flex-start; }
    .pws-streamer-actions { align-items: flex-start; width: 100%; }
    .pws-earn-actions { justify-content: flex-start; }
    .pws-lb-col-status { display: none; }
    .pws-lb-col-pts { width: 70px; }
    .pws-modal { padding: 20px 16px; }
    .pws-toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
