/*
    CityCards Live Widget
    Panneau flottant léger : petit au repos, détaillé au clic.
    Les couleurs restent volontairement sobres pour être compatibles prosilver et styles personnalisés.
*/
.cc-live-widget {
    position: fixed;
    left: 18px;
    top: 5px;
    z-index: 2147481000;
    width: min(360px, calc(100vw - 24px));
    font-size: 13px;
}

.cc-live-widget *,
.cc-live-widget *::before,
.cc-live-widget *::after {
    box-sizing: border-box;
}

.cc-live-widget-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    margin-right: auto;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, rgba(34, 45, 89, 0.96), rgba(91, 50, 122, 0.94));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
    cursor: pointer;
}

.cc-live-widget-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    font-size: 20px;
}

.cc-live-widget-main {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.cc-live-widget-main strong {
    font-size: 14px;
}

.cc-live-widget-main small {
    opacity: 0.86;
}

.cc-live-widget-panel {
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 22px;
    color: #fff;
    background: rgba(18, 24, 46, 0.97);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
}

/*
    Scroll interne :
    - le petit bouton reste fermé par défaut grâce à l'attribut hidden du template/JS ;
    - quand la fenêtre est ouverte, elle ne dépasse jamais de l'écran ;
    - seule la zone de contenu défile, pas tout le widget flottant.
*/
.cc-live-widget-panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 82px);
}

.cc-live-widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 10px;
    background: linear-gradient(135deg, rgba(75, 94, 173, 0.38), rgba(150, 77, 158, 0.22));
}

.cc-live-widget-head strong,
.cc-live-widget-head span {
    display: block;
}

.cc-live-widget-head span {
    margin-top: 3px;
    font-size: 12px;
    opacity: 0.82;
}

.cc-live-widget-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cc-live-widget-stats,
.cc-live-widget-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px 0;
}

.cc-live-widget-stats span,
.cc-live-widget-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    white-space: nowrap;
}

.cc-live-widget-legend {
    padding-top: 8px;
    font-size: 11px;
    opacity: 0.9;
}

.cc-live-widget-filter {
    display: grid;
    gap: 4px;
    padding: 10px 12px 0;
}

.cc-live-widget-filter span {
    font-size: 11px;
    opacity: 0.82;
}

.cc-live-widget-filter select {
    width: 100%;
    min-height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.28);
}

.cc-live-widget-list {
    display: grid;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(440px, calc(100vh - 285px));
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    scrollbar-gutter: stable;
}

.cc-live-widget-player {
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.075);
}

.cc-live-widget-player-main {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    grid-template-areas:
        "dot name status"
        "dot forum status";
    gap: 2px 8px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.cc-live-widget-dot {
    grid-area: dot;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.16);
}

.cc-live-widget-player--available .cc-live-widget-dot {
    background: #35d07f;
    box-shadow: 0 0 0 3px rgba(53, 208, 127, 0.18);
}

.cc-live-widget-player--playing .cc-live-widget-dot {
    background: #f7c948;
    box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.18);
}

.cc-live-widget-name {
    grid-area: name;
    min-width: 0;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-live-widget-name a {
    color: #fff !important;
    text-decoration: none;
}

.cc-live-widget-forum {
    grid-area: forum;
    min-width: 0;
    font-size: 11px;
    opacity: 0.72;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-live-widget-status {
    grid-area: status;
    padding: 4px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    font-size: 11px;
    white-space: nowrap;
}

.cc-live-widget-details {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 10px 10px;
    scrollbar-gutter: stable;
}

.cc-live-widget-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
}

.cc-live-widget-detail-grid span {
    opacity: 0.78;
}

.cc-live-widget-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 9px;
}

.cc-live-widget-actions form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
}

.cc-live-widget-deckpick {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
}

.cc-live-widget-deckpick span {
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
    font-weight: 800;
}

.cc-live-widget-deckpick select {
    width: 100%;
    min-height: 32px;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(4, 10, 24, 0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

.cc-live-widget-deckpick select:focus {
    border-color: rgba(90, 238, 154, 0.72);
    box-shadow: 0 0 0 2px rgba(90, 238, 154, 0.16);
}

.cc-live-widget-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 6px 10px;
    border: 0;
    border-radius: 999px;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.14);
    text-decoration: none !important;
    cursor: pointer;
}

.cc-live-widget-action--invite {
    background: linear-gradient(135deg, #21855f, #35ad7f);
}

.cc-live-widget-action--watch {
    background: linear-gradient(135deg, #9061f9, #5b7cfa);
}

.cc-live-widget-empty {
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
    opacity: 0.88;
}

.cc-live-widget-list::-webkit-scrollbar,
.cc-live-widget-details::-webkit-scrollbar {
    width: 8px;
}

.cc-live-widget-list::-webkit-scrollbar-thumb,
.cc-live-widget-details::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}

.cc-live-widget-list::-webkit-scrollbar-track,
.cc-live-widget-details::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 700px) {
    .cc-live-widget {
        left: 12px;
        bottom: 82px;
        width: min(340px, calc(100vw - 24px));
    }

    .cc-live-widget-toggle {
        padding: 9px 10px;
    }
}

/* correction fast - panneau live déplaçable sur l'index */
.cc-live-widget.cc-live-widget-dragging {
    transition: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    user-select: none;
}
.cc-live-widget .cc-live-widget-toggle,
.cc-live-widget .cc-live-widget-head {
    cursor: move;
    touch-action: none;
}
.cc-live-widget .cc-live-widget-close,
.cc-live-widget select,
.cc-live-widget a,
.cc-live-widget button:not(.cc-live-widget-toggle) {
    cursor: pointer;
}


/* CityCards panel : voyant invitation et menu invitations. */
#cc-games-panel-v2-invites {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 48px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 214, 94, .88);
    background: linear-gradient(135deg, rgba(255, 188, 65, .95), rgba(255, 87, 126, .92));
    color: #190b12;
    font-weight: 1000;
    box-shadow: 0 0 18px rgba(255, 176, 64, .42);
    animation: ccPanelInvitePulse 1.5s ease-in-out infinite;
}


#cc-games-panel-v2-invites.is-declined {
    width: auto;
    min-width: 48px;
    max-width: 72px;
    white-space: nowrap;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(130, 146, 176, .96), rgba(82, 96, 126, .96));
    border-color: rgba(220, 229, 255, .9);
    color: #fff;
    animation: none;
}

#cc-games-panel-v2-invites[hidden] {
    display: none !important;
}

#cc-games-panel-v2-invites span {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(5, 10, 22, .9);
    color: #fff;
    font-size: 12px;
    line-height: 1;
}

@keyframes ccPanelInvitePulse {
    0%, 100% { transform: translateY(0); filter: brightness(1); }
    50% { transform: translateY(-1px); filter: brightness(1.15); }
}

.cc-panel-invites {
    display: grid;
    gap: 14px;
}

.cc-panel-invite-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(126, 230, 255, .30);
    background: linear-gradient(155deg, rgba(15, 27, 50, .96), rgba(6, 11, 24, .96));
    box-shadow: 0 12px 28px rgba(0, 0, 0, .25);
}

.cc-panel-invite-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #fff;
}

.cc-panel-invite-card__head strong {
    font-size: 18px;
    font-weight: 1000;
}

.cc-panel-invite-card__head span {
    color: #aebbd0;
    font-weight: 800;
    font-size: 12px;
}

.cc-panel-invite-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cc-panel-invite-card__meta span {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(126, 230, 255, .10);
    color: #dbeeff;
    font-weight: 800;
    font-size: 12px;
}

.cc-panel-invite-card__form {
    display: grid;
    gap: 10px;
}

.cc-panel-invite-card__form label {
    display: grid;
    gap: 5px;
    color: #cfe1f6;
    font-weight: 900;
}

.cc-panel-invite-card__form select {
    width: 100%;
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(126, 230, 255, .35);
    background: rgba(4, 9, 20, .92);
    color: #fff;
    padding: 8px 10px;
    font-weight: 900;
}

.cc-panel-invite-card__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-panel-invite-card__actions button {
    flex: 1 1 160px;
    min-height: 42px;
    border-radius: 999px;
    font-weight: 1000;
}

.cc-panel-invite-card__actions button[data-panel-invite-decline] {
    background: rgba(255, 255, 255, .08);
    color: #f7fbff;
    border-color: rgba(255, 255, 255, .22);
}
