/**
 * Senka (戦果) — Sistema de Torneos y Liga Beyblade X (BDB)
 * Módulo de Estilos: Gestión de Participantes, Enlaces de Inscripción y Códigos QR
 * Autor: Sebastián Ariza / https://sebastiandeveloper.website/
 */

/* =========================================================================
   BARRA DE ACCIONES DE PARTICIPANTES
   ========================================================================= */
.participants-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.participants-stats-pills {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.participant-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--cyan-neon);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.25);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-pill);
}

.participant-count-badge.warning {
    color: var(--gold-trophy);
    background: rgba(255, 183, 0, 0.1);
    border-color: rgba(255, 183, 0, 0.3);
}

.participants-actions-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* Botones Prominentes de Mezcla / Barajado Aleatorio */
.btn-shuffle-participants {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.16), rgba(11, 123, 177, 0.32));
    border: 1px solid var(--cyan-neon);
    color: var(--cyan-neon);
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-shuffle-participants:hover {
    background: linear-gradient(135deg, var(--cyan-neon), #00b0ff);
    color: var(--text-contrast);
    box-shadow: var(--shadow-neon-cyan);
    transform: translateY(-1px);
}

.btn-quick-shuffle-groups {
    background: linear-gradient(135deg, #00f0ff 0%, #0091ea 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #03080e !important;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.btn-quick-shuffle-groups:hover {
    background: linear-gradient(135deg, #33ecff 0%, #29b6f6 100%);
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.65), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
    color: #03080e !important;
}

.btn-quick-shuffle-groups:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* =========================================================================
   TABLA / GRILLA DE PARTICIPANTES
   ========================================================================= */
.participants-table-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-md);
    position: relative;
    max-width: 100%;
}

.participants-table-container::-webkit-scrollbar {
    height: 6px;
}

.participants-table-container::-webkit-scrollbar-track {
    background: rgba(10, 18, 30, 0.4);
    border-radius: 4px;
}

.participants-table-container::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.35);
    border-radius: 4px;
}

.participants-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--cyan-neon);
}

.participants-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: left;
}

.participants-table th {
    background: var(--bg-surface-elevated);
    padding: 0.9rem 1.2rem;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.participants-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
}

.participants-table tbody tr {
    transition: background var(--transition-fast);
}

.participants-table tbody tr:hover {
    background: rgba(0, 240, 255, 0.03);
}

.participants-table tbody tr:last-child td {
    border-bottom: none;
}

.participant-seed-cell {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--cyan-neon);
    width: 70px;
}

.participant-seed-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: var(--radius-sm);
    text-align: center;
    min-width: 38px;
}

.participant-info-cell {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.participant-avatar-badge {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--bg-deep));
    border: 1.5px solid var(--cyan-neon);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    overflow: hidden;
    flex-shrink: 0;
}

.participant-avatar-badge img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.participant-name-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    font-size: 0.98rem;
    white-space: nowrap;
}

.participant-user-link {
    font-size: 0.78rem;
    color: var(--cyan-neon);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.participant-user-link:hover {
    text-decoration: underline;
}

.participant-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.22rem 0.65rem;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.participant-type-pill.registered {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

.participant-type-pill.guest {
    background: rgba(156, 179, 198, 0.12);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-remove-participant {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-remove-participant:hover {
    color: var(--danger);
    background: rgba(255, 23, 68, 0.12);
    border-color: rgba(255, 23, 68, 0.3);
    transform: scale(1.05);
}

/* =========================================================================
   ESTADO VACÍO / ONBOARDING DE PARTICIPANTES
   ========================================================================= */
.participants-empty-card {
    text-align: center;
    padding: 3.5rem 2rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.empty-icon-wrap {
    width: 68px;
    height: 68px;
    margin: 0 auto 1.2rem;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan-neon);
}

.participants-empty-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.participants-empty-desc {
    color: var(--text-secondary);
    font-size: 0.92rem;
    max-width: 480px;
    margin: 0 auto 1.8rem;
    line-height: 1.55;
}

.participants-empty-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* =========================================================================
   MODAL DE COMPARTIR Y CÓDIGO QR
   ========================================================================= */
.qr-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0;
}

.qr-code-display-card {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 3px solid var(--cyan-neon);
    box-shadow: var(--shadow-neon-cyan);
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qr-code-display-card img {
    display: block;
    width: 220px;
    height: 220px;
    image-rendering: pixelated;
}

.qr-instructions-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 420px;
    line-height: 1.5;
}

.qr-link-copy-box {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.qr-link-input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
    color: var(--cyan-neon);
    font-family: monospace;
    font-size: 0.88rem;
    user-select: all;
}

.qr-link-copy-box button {
    white-space: nowrap;
}

.qr-share-options {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.share-register-prompt {
    margin-top: 1.25rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-align: center;
    width: 100%;
}

.share-register-prompt a {
    color: var(--cyan-neon);
    font-weight: 700;
    text-decoration: none;
    margin-left: 0.35rem;
    transition: color var(--transition-fast);
}

.share-register-prompt a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* =========================================================================
   MODAL DE AGREGAR PARTICIPANTE (PESTAÑAS)
   ========================================================================= */
.add-participant-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
}

.add-participant-tabs::-webkit-scrollbar {
    display: none;
}

.add-part-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.7rem 1.1rem;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    white-space: nowrap;
}

.add-part-tab-btn:hover {
    color: var(--text-primary);
}

.add-part-tab-btn.active {
    color: var(--cyan-neon);
    border-bottom-color: var(--cyan-neon);
}

.registered-user-search-wrap {
    position: relative;
    width: 100%;
}

.user-search-dropdown-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 240, 255, 0.1);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.user-search-dropdown-results.active {
    display: block;
}

.user-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.user-search-item:hover {
    background: rgba(0, 240, 255, 0.08);
}

.user-search-item:last-child {
    border-bottom: none;
}

.user-search-item-info,
.user-search-info {
    flex: 1;
    min-width: 0;
}

.user-search-item-name,
.user-search-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-search-item-role,
.user-search-role {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.selected-user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid var(--cyan-neon);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

/* =========================================================================
   MODAL DE AUTO-INSCRIPCIÓN (JUGADOR)
   ========================================================================= */
.join-tourney-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.join-tourney-user-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.join-tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.join-tab-toggle {
    flex: 1;
    text-align: center;
    padding: 0.65rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.join-tab-toggle.active {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--cyan-neon);
    color: var(--cyan-neon);
}

/* =========================================================================
   SISTEMA DE MODALES FLOTANTES (OVERLAYS)
   ========================================================================= */
.senka-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    background: rgba(3, 8, 14, 0.88) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top, 1rem)) max(1rem, env(safe-area-inset-right, 1rem)) max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 1.25rem)) max(1rem, env(safe-area-inset-left, 1rem)) !important;
    z-index: 99999 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
}

.senka-modal-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.senka-modal-card {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-xl) !important;
    width: 100% !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 240, 255, 0.15) !important;
    overflow: hidden !important;
    position: relative !important;
    max-height: calc(100dvh - 3.5rem) !important;
    max-height: calc(100vh - 3.5rem) !important;
    display: flex !important;
    flex-direction: column !important;
    animation: modalSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: auto !important;
}

@keyframes modalSlideUp {
    from {
        transform: scale(0.95) translateY(14px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.senka-modal-card .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.senka-modal-card .modal-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 0.3rem;
    color: var(--text-primary);
}

.senka-modal-card .modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.senka-modal-card .modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}

.senka-modal-card .modal-footer {
    padding: 1rem 1.5rem max(1rem, calc(env(safe-area-inset-bottom, 0px) + 0.85rem)) !important;
    background: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.modal-close-btn,
.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.7rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close-btn:hover,
.btn-close-modal:hover {
    color: var(--danger);
    background: rgba(255, 23, 68, 0.12);
}

/* =========================================================================
   GESTOR DE GRUPOS AVANZADO ESTILO CHALLONGE (SESIÓN GRUPOS BDB)
   ========================================================================= */

/* Sub-navegación: Gestionar Participantes | Gestionar Grupos (Cyberpunk Pills) */
.participants-subnav-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(10, 18, 30, 0.6);
    padding: 0.3rem 0.4rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

.part-subnav-btn,
.participants-subnav-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    font-style: normal;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    padding: 0.45rem 1rem;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
}

.part-subnav-btn svg,
.participants-subnav-btn svg {
    flex-shrink: 0;
    stroke: currentColor;
    transition: transform 0.18s ease;
}

.part-subnav-btn:hover,
.participants-subnav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 85, 0, 0.08);
    border-color: rgba(255, 85, 0, 0.25);
}

.part-subnav-btn:hover svg,
.participants-subnav-btn:hover svg {
    transform: scale(1.12);
}

.part-subnav-btn.active,
.participants-subnav-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255, 85, 0, 0.28) 0%, rgba(255, 119, 0, 0.16) 100%);
    border-color: #ff5500;
    box-shadow: 0 0 14px rgba(255, 85, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.part-subnav-btn.active svg,
.participants-subnav-btn.active svg {
    stroke: #ff7700;
    filter: drop-shadow(0 0 4px rgba(255, 85, 0, 0.5));
}

/* Barra Superior de Grupos: Parámetros y Acciones */
.groups-manage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.4rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.groups-manage-toolbar-left,
.groups-quick-params {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.groups-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-surface-elevated);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.groups-stat-pill strong {
    color: var(--cyan-neon);
    font-weight: 700;
}

.groups-param-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
    color: var(--text-secondary);
    background: var(--bg-surface-elevated);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.groups-param-pill input {
    width: 55px;
    background: var(--bg-base);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--cyan-neon);
    font-weight: 700;
    text-align: center;
    padding: 0.2rem 0.3rem;
    font-size: 0.86rem;
}

.groups-param-pill input:focus {
    border-color: var(--cyan-neon);
    outline: none;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.25);
}

.groups-manage-toolbar-right,
.groups-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

/* Banner de Bladers Sin Asignar */
.unassigned-bladers-pool {
    background: rgba(255, 183, 0, 0.05);
    border: 1px dashed rgba(255, 183, 0, 0.35);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.unassigned-pool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--gold-trophy);
}

.unassigned-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.unassigned-blader-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.75rem 0.3rem 0.4rem;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: grab;
    transition: all var(--transition-fast);
}

.unassigned-blader-chip:hover {
    border-color: var(--cyan-neon);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 240, 255, 0.15);
}

.unassigned-blader-chip .chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.unassigned-blader-chip .chip-avatar img,
.chip-avatar img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.chip-assign-select {
    background: transparent;
    border: none;
    color: var(--cyan-neon);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 0.25rem;
    padding: 0 0.2rem;
}

/* Grilla de Tarjetas de Grupo */
.groups-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.group-card-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all var(--transition-fast);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.group-card-container.drag-over {
    border-color: var(--cyan-neon);
    background: rgba(0, 240, 255, 0.04);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
    transform: scale(1.01);
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.group-card-title-wrap {
    display: flex;
    flex-direction: column;
}

.group-card-letter {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1;
}

.group-card-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
    margin-top: 0.2rem;
}

.btn-delete-group {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-delete-group:hover {
    color: var(--danger);
    background: rgba(255, 23, 68, 0.1);
    transform: scale(1.1);
}

.btn-group-assign-participants {
    width: 100%;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: all var(--transition-fast);
}

.btn-group-assign-participants:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--cyan-neon);
    color: var(--cyan-neon);
}

/* Lista de Bladers dentro del Grupo */
.group-bladers-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 80px;
}

.group-blader-row {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.group-blader-row:hover {
    border-color: rgba(0, 240, 255, 0.4);
    background: rgba(0, 240, 255, 0.03);
}

.group-blader-row.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.blader-row-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.blader-drag-handle {
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    cursor: grab;
}

.blader-group-index {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    width: 22px;
}

.blader-group-avatar,
.group-blader-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--bg-deep));
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.blader-group-avatar img,
.group-blader-avatar img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.user-search-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--cyan-neon);
    overflow: hidden;
    flex-shrink: 0;
}

.user-search-avatar img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.blader-group-name-wrap {
    min-width: 0;
}

.blader-group-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blader-group-seed {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.blader-row-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.select-move-to-group {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
}

.select-move-to-group:hover {
    border-color: var(--cyan-neon);
    color: var(--cyan-neon);
}

.btn-unassign-blader {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-unassign-blader:hover {
    color: var(--danger);
    background: rgba(255, 23, 68, 0.1);
}

/* Estado Vacío de Grupos Challonge */
.groups-challonge-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    max-width: 680px;
    margin: 1rem auto;
}

.groups-empty-svg-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    color: var(--text-muted);
}

.groups-empty-headline {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.groups-empty-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto 1.8rem;
    line-height: 1.5;
}

.groups-empty-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.btn-challonge-orange {
    background: linear-gradient(135deg, #ff6600, #ff4400);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.65rem 1.4rem;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255, 85, 0, 0.35);
    transition: all var(--transition-fast);
}

.btn-challonge-orange:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 85, 0, 0.45);
    background: linear-gradient(135deg, #ff7711, #ff5500);
}

.toast-container {
    z-index: 100000 !important;
}

/* =========================================================================
   OPTIMIZACIONES RESPONSIVE (MÓVIL / TABLET)
   ========================================================================= */
@media (max-width: 768px) {
    .participants-toolbar {
        padding: 0.85rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .participants-stats-pills {
        justify-content: space-between;
        width: 100%;
    }

    .participants-actions-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .participants-actions-group .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-height: 42px;
        font-size: 0.84rem;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0.45rem 0.65rem;
    }

    .groups-manage-toolbar {
        padding: 0.85rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .groups-manage-toolbar-left,
    .groups-quick-params {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .groups-manage-toolbar-left .groups-stat-pill {
        flex: 1 1 calc(50% - 0.4rem);
        font-size: 0.76rem;
        padding: 0.35rem 0.5rem;
        justify-content: center;
    }

    .groups-manage-toolbar-right,
    .groups-toolbar-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .groups-manage-toolbar-right .btn,
    .groups-toolbar-actions .btn {
        flex: 1 1 calc(50% - 0.5rem);
        min-height: 42px;
        font-size: 0.84rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0.45rem 0.65rem;
        white-space: nowrap;
    }

    .groups-manage-toolbar-right .btn-quick-shuffle-groups,
    .groups-toolbar-actions .btn-quick-shuffle-groups {
        flex: 1 1 100%;
        min-height: 44px;
        font-size: 0.92rem;
        order: -1;
    }

    .groups-empty-actions {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    .groups-empty-actions .btn {
        width: 100%;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .groups-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .participants-actions-group .btn,
    .groups-manage-toolbar-right .btn,
    .groups-toolbar-actions .btn {
        flex: 1 1 100%;
        min-height: 44px;
        font-size: 0.88rem;
    }

    .participants-stats-pills .participant-count-badge {
        font-size: 0.8rem;
        padding: 0.3rem 0.65rem;
    }
}

/* =========================================================================
   ADAPTACIONES SAFARI / MÓVIL PARA MODALES (TOUCH & SAFE AREAS)
   ========================================================================= */
@media (max-width: 640px) {
    .senka-modal-overlay {
        padding: max(0.5rem, env(safe-area-inset-top, 0.5rem)) 0.5rem max(1.25rem, calc(env(safe-area-inset-bottom, 0px) + 1.25rem)) 0.5rem !important;
        align-items: center !important;
    }

    .senka-modal-card {
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 2rem) !important;
        max-height: calc(100vh - 2rem) !important;
        border-radius: var(--radius-lg) !important;
        margin: auto !important;
        width: 100% !important;
    }

    .senka-modal-card .modal-header {
        padding: 0.9rem 1.15rem;
    }

    .senka-modal-card .modal-title {
        font-size: 1.15rem;
    }

    .senka-modal-card .modal-body {
        padding: 1rem 1.15rem;
    }

    .senka-modal-card .modal-footer {
        padding: 0.85rem 1.15rem max(1rem, calc(env(safe-area-inset-bottom, 0px) + 1rem)) !important;
    }

    .senka-modal-card .modal-footer .btn {
        min-height: 44px;
        font-size: 0.88rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Prevención crítica de auto-zoom en iOS Safari al escribir combos */
    .join-combo-input,
    .senka-modal-card input[type="text"],
    .senka-modal-card input[type="email"],
    .senka-modal-card input[type="password"] {
        font-size: 16px !important;
    }
}

/* Header estilizado de combos fijos */
.join-combos-container {
    box-shadow: inset 0 0 15px rgba(255, 183, 0, 0.04);
}

.join-combos-header-row {
    border-bottom: 1px solid rgba(255, 183, 0, 0.15);
    padding-bottom: 0.5rem;
}

/* =========================================================================
   CONTROL DE PAGO DE PARTICIPANTES (OWNER / ORGANIZADOR)
   ========================================================================= */
.participant-paid-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.participant-paid-wrap:hover {
    background: rgba(0, 240, 255, 0.08);
}

.cb-participant-paid {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-medium);
    border-radius: 6px;
    background: var(--bg-surface-elevated);
    cursor: pointer;
    position: relative;
    outline: none;
    transition: all var(--transition-fast);
    display: inline-block;
    vertical-align: middle;
}

.cb-participant-paid:hover {
    border-color: var(--cyan-neon);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.cb-participant-paid:checked {
    background: var(--cyan-neon);
    border-color: var(--cyan-neon);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

.cb-participant-paid:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #03080e;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.cb-participant-paid:focus-visible {
    outline: 2px solid var(--cyan-neon);
    outline-offset: 2px;
}



