/* ============================================
   GLHF Tournaments — Premium Dark Theme
   ============================================ */

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(0, 255, 100, 0.2); }
    50%      { box-shadow: 0 0 24px rgba(0, 255, 100, 0.45); }
}
@keyframes championGlow {
    0%, 100% { text-shadow: 0 0 8px rgba(255, 152, 0, 0.3); }
    50%      { text-shadow: 0 0 20px rgba(255, 152, 0, 0.6); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes lineReveal {
    from { stroke-dashoffset: 300; }
    to   { stroke-dashoffset: 0; }
}

/* --- Enerhodar font baseline compensation (~5px upward shift) --- */
#glhf-wrapper .glhf-tourney-title,
#glhf-wrapper .glhf-section-title,
#glhf-wrapper .glhf-admin-panel-title,
#glhf-wrapper .glhf-form-label,
#glhf-wrapper .glhf-champion-label,
#glhf-wrapper .glhf-champion-name,
#glhf-wrapper .champion,
#glhf-wrapper #glhf-create-form h3,
#glhf-wrapper #glhf-main h2 {
    position: relative;
    top: 0.12em;
}

/* --- Page --- */
.tournaments-page {
    overflow-x: clip;
}

/* --- Wrapper --- */
#glhf-wrapper {
    width: 100%;
    color: var(--glhf-text-primary);
    animation: fadeIn 0.4s ease;
}

#glhf-main {
    animation: fadeInUp 0.5s ease;
}

/* --- Tournament Layout (participants left, info right) --- */
.glhf-tourney-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.5s ease;
}
.glhf-tourney-left {
    flex: 1;
    min-width: 0;
    order: 2;
}

/* --- Tournament Info Column (info + forms) --- */
.glhf-tourney-info-col {
    order: 1;
    flex: 1;
    min-width: 0;
    position: sticky;
    top: calc(var(--glhf-header-height, 70px) + 0.5rem);
    align-self: flex-start;
}

/* --- Tournament Info Card --- */
.glhf-tourney-info {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-md);
    padding: 1.75rem 2rem;
    animation: fadeInUp 0.5s ease;
}

.glhf-tourney-title {
    font-family: var(--glhf-font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--glhf-text-primary);
    margin: 0 0 1.25rem;
    letter-spacing: 0.5px;
}

.glhf-tourney-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.glhf-tourney-field {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.glhf-tourney-field-icon {
    flex-shrink: 0;
    font-size: 1rem;
    opacity: 0.7;
}

.glhf-tourney-field-label {
    color: var(--glhf-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.glhf-tourney-field-value {
    color: var(--glhf-text-secondary);
}

.glhf-tourney-field--prize .glhf-tourney-field-value {
    color: var(--glhf-funcoin);
    font-weight: 600;
}

.glhf-tourney-roles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.glhf-tourney-roles .role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--glhf-radius-full, 9999px);
    border: 1px solid currentColor;
    opacity: 0.9;
}

.glhf-tourney-roles .role-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.glhf-role-sep {
    font-size: 0.7rem;
    color: var(--glhf-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Section Headers --- */
.glhf-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glhf-border);
}

.glhf-section-title {
    font-family: var(--glhf-font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--glhf-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.glhf-section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--glhf-radius-full);
    background: rgba(var(--glhf-accent-rgb), 0.12);
    color: var(--glhf-accent);
    border: 1px solid rgba(var(--glhf-accent-rgb), 0.25);
}

.glhf-section-badge--warning {
    background: rgba(255, 152, 0, 0.12);
    color: var(--glhf-funcoin);
    border-color: rgba(255, 152, 0, 0.25);
}

/* --- Participant List --- */
ul.glhf-part-list,
ul.glhf-app-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0;
}

.glhf-part-list li,
.glhf-app-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 0;
    border-radius: var(--glhf-radius-sm);
    transition: background var(--glhf-transition-fast);
    font-size: 0.9rem;
    color: var(--glhf-text-secondary);
    animation: fadeInUp 0.3s ease both;
    background: none;
    border: none;
    box-shadow: none;
}

.glhf-part-list li:hover,
.glhf-app-list li:hover {
    background: rgba(255, 255, 255, 0.03);
}

.glhf-part-num {
    color: var(--glhf-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.glhf-part-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Action Buttons (circle icons) --- */
.glhf-action-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--glhf-radius-full);
    border: 1.5px solid;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font-size: 0;
    transition: all var(--glhf-transition-fast);
    flex-shrink: 0;
}

.glhf-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.glhf-action-btn--accept {
    border-color: var(--glhf-accent);
    color: var(--glhf-accent);
}
.glhf-action-btn--accept:hover {
    background: rgba(var(--glhf-accent-rgb), 0.15);
}

.glhf-action-btn--reject,
.glhf-action-btn--remove {
    border-color: var(--glhf-danger);
    color: var(--glhf-danger);
}
.glhf-action-btn--reject:hover,
.glhf-action-btn--remove:hover {
    background: rgba(239, 68, 68, 0.15);
}

.glhf-action-btn--ban {
    border-color: var(--glhf-warning);
    color: var(--glhf-warning);
}
.glhf-action-btn--ban:hover {
    background: rgba(234, 179, 8, 0.15);
}

/* Backwards compat aliases — icon-only circle buttons */
.glhf-remove-btn { border-color: var(--glhf-danger) !important; color: var(--glhf-danger) !important; background: transparent !important; width: 26px; height: 26px; border-radius: var(--glhf-radius-full); padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center; cursor: pointer; transition: all var(--glhf-transition-fast); flex-shrink: 0; }
.glhf-remove-btn:hover { background: rgba(239, 68, 68, 0.15) !important; }
ul.glhf-app-list button.glhf-accept-btn { border-color: var(--glhf-accent) !important; color: var(--glhf-accent) !important; background: transparent !important; width: 26px !important; height: 26px !important; border-radius: var(--glhf-radius-full) !important; padding: 0 !important; min-width: 26px !important; min-height: 26px !important; display: inline-flex !important; align-items: center; justify-content: center; box-shadow: none !important; margin-right: 2px; }
ul.glhf-app-list button.glhf-accept-btn:hover { background: rgba(var(--glhf-accent-rgb), 0.15) !important; }
ul.glhf-app-list button.glhf-reject-btn { border-color: var(--glhf-danger) !important; color: var(--glhf-danger) !important; background: transparent !important; width: 26px !important; height: 26px !important; border-radius: var(--glhf-radius-full) !important; padding: 0 !important; min-width: 26px !important; min-height: 26px !important; display: inline-flex !important; align-items: center; justify-content: center; box-shadow: none !important; margin-right: 2px; }
ul.glhf-app-list button.glhf-reject-btn:hover { background: rgba(239, 68, 68, 0.15) !important; }
ul.glhf-app-list button.glhf-accept-btn .dashicons,
ul.glhf-app-list button.glhf-reject-btn .dashicons,
.glhf-remove-btn .dashicons,
.glhf-erase-btn .dashicons { font-size: 16px !important; line-height: 1 !important; margin: 0 !important; display: flex !important; align-items: center; justify-content: center; width: 16px; height: 16px; }
.glhf-ban-btn { background: transparent; border-color: var(--glhf-warning); color: var(--glhf-warning); width: 26px; height: 26px; border-radius: var(--glhf-radius-full); padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center; margin-right: 2px; }
.glhf-ban-btn:hover { background: rgba(234, 179, 8, 0.15); }

/* --- Buttons (global) --- */
#glhf-wrapper button,
#glhf-wrapper input[type="submit"],
#glhf-wrapper form button {
    background: var(--glhf-accent);
    color: var(--glhf-bg-primary);
    border: none;
    border-radius: var(--glhf-radius-sm);
    padding: 0.7rem 1.25rem 0.4rem;
    font-family: var(--glhf-font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--glhf-transition-fast);
    box-shadow: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1.4;
}

#glhf-wrapper button:hover,
#glhf-wrapper input[type="submit"]:hover,
#glhf-wrapper form button:hover {
    background: var(--glhf-accent-hover);
    box-shadow: 0 0 16px rgba(var(--glhf-accent-rgb), 0.25);
}

#glhf-wrapper button[value="withdraw"],
#glhf-wrapper button[value="delete"] {
    background: transparent;
    color: var(--glhf-danger);
    border: 1.5px solid var(--glhf-danger);
}
#glhf-wrapper button[value="withdraw"]:hover,
#glhf-wrapper button[value="delete"]:hover {
    background: rgba(239, 68, 68, 0.12);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

/* --- Form Inputs --- */
#glhf-main input,
#glhf-main textarea,
#glhf-main select {
    background: var(--glhf-bg-tertiary);
    border: 1.5px solid var(--glhf-border);
    color: var(--glhf-text-primary);
    font-family: var(--glhf-font-body);
    font-size: 0.9rem;
    height: auto;
    padding: 0.55rem 0.75rem;
    border-radius: var(--glhf-radius-sm);
    outline: none;
    transition: border-color var(--glhf-transition-fast), box-shadow var(--glhf-transition-fast);
    width: 100%;
    max-width: 100%;
}

#glhf-main textarea {
    min-height: 70px;
    resize: vertical;
}

#glhf-main input:focus,
#glhf-main textarea:focus,
#glhf-main select:focus {
    border-color: var(--glhf-accent);
    box-shadow: 0 0 0 3px rgba(var(--glhf-accent-rgb), 0.15);
}

/* --- Admin Manual-add Form --- */
.glhf-manual {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: stretch;
}

.glhf-manual input {
    flex: 1;
    max-width: 280px;
}

/* --- Admin Panel --- */
.glhf-admin-panel {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-md);
    padding: 1.25rem 1.5rem;
    margin-top: 1.5rem;
    animation: fadeInUp 0.4s ease 0.2s both;
}

.glhf-admin-panel-title {
    font-family: var(--glhf-font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--glhf-text-muted);
    margin: 0 0 1rem;
}

.glhf-admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.75rem;
}

.glhf-admin-danger {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(239, 68, 68, 0.15);
}

/* --- Create Tournament Form --- */
#glhf-create-form {
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-md);
    padding: 2rem;
    max-width: 1000px;
    animation: scaleIn 0.4s ease;
}

.glhf-create-columns {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.glhf-create-left {
    flex: 1;
    min-width: 0;
}

.glhf-create-right {
    flex: 1;
    min-width: 0;
}

.glhf-create-right .glhf-role-selector {
    max-height: 212px;
}

@media (max-width: 700px) {
    .glhf-create-columns {
        flex-direction: column;
    }
}

#glhf-create-form h3 {
    font-family: var(--glhf-font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--glhf-text-primary);
    margin: 0 0 1.25rem;
}

#glhf-create-form input[type="text"],
#glhf-create-form input[name="name"],
#glhf-create-form input[name="org"],
#glhf-create-form input[name="prize"],
#glhf-create-form textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.75rem;
    background: var(--glhf-bg-tertiary);
    border: 1.5px solid var(--glhf-border);
    color: var(--glhf-text-primary);
    font-family: var(--glhf-font-body);
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--glhf-radius-sm);
    outline: none;
    transition: border-color var(--glhf-transition-fast), box-shadow var(--glhf-transition-fast);
    height: auto;
}

#glhf-create-form textarea {
    min-height: 70px;
    resize: vertical;
}

#glhf-create-form input:focus,
#glhf-create-form textarea:focus {
    border-color: var(--glhf-accent);
    box-shadow: 0 0 0 3px rgba(var(--glhf-accent-rgb), 0.15);
}

.glhf-form-label {
    display: block;
    font-family: var(--glhf-font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--glhf-text-muted);
    margin-bottom: 0.35rem;
}

.glhf-form-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
    opacity: 0.7;
}

.glhf-form-note {
    font-size: 0.8rem;
    color: var(--glhf-funcoin);
    margin: 0 0 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 152, 0, 0.08);
    border-radius: var(--glhf-radius-sm);
    border-left: 3px solid var(--glhf-funcoin);
}

.glhf-role-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.glhf-role-mode-label {
    font-size: 0.8rem;
    color: var(--glhf-text-muted);
    font-weight: 500;
    margin-right: 0.2rem;
}
.glhf-role-mode-btn {
    padding: 0.35rem 0.85rem !important;
    font-size: 0.78rem !important;
    font-family: var(--glhf-font-body) !important;
    text-transform: none !important;
    border: 1.5px solid var(--glhf-border) !important;
    border-radius: var(--glhf-radius-sm) !important;
    background: transparent !important;
    color: var(--glhf-text-muted) !important;
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 0 !important;
    line-height: 1.3 !important;
}
.glhf-role-mode-btn:hover {
    border-color: rgba(var(--glhf-accent-rgb), 0.5) !important;
    color: var(--glhf-text-primary) !important;
}
.glhf-role-mode-btn.active {
    border-color: var(--glhf-accent) !important;
    background: rgba(var(--glhf-accent-rgb), 0.15) !important;
    color: var(--glhf-accent) !important;
    font-weight: 600;
}

.glhf-role-search {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0.4rem;
    background: var(--glhf-bg-tertiary);
    border: 1.5px solid var(--glhf-border);
    color: var(--glhf-text-primary);
    font-family: var(--glhf-font-body);
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--glhf-radius-sm);
    outline: none;
    transition: border-color var(--glhf-transition-fast), box-shadow var(--glhf-transition-fast);
    height: auto;
}

.glhf-role-search:focus {
    border-color: var(--glhf-accent);
    box-shadow: 0 0 0 3px rgba(var(--glhf-accent-rgb), 0.15);
}

.glhf-role-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--glhf-bg-tertiary);
    border: 1.5px solid var(--glhf-border);
    border-radius: var(--glhf-radius-sm);
    max-height: 200px;
    overflow-y: auto;
}

.glhf-role-selector label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--glhf-radius-full);
    background: var(--glhf-bg-card);
    border: 1.5px solid var(--glhf-border);
    cursor: pointer;
    transition: all var(--glhf-transition-fast);
    font-size: 0.8rem;
    color: var(--glhf-text-secondary);
    user-select: none;
    opacity: 0.55;
}

.glhf-role-selector label:hover {
    opacity: 0.85;
}

.glhf-role-selector label:has(input:checked) {
    opacity: 1;
    border-color: currentColor;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.06);
}

.glhf-role-selector label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    transition: all var(--glhf-transition-fast);
}

.glhf-role-selector label:has(input:checked)::before {
    content: '✓';
    width: auto;
    height: auto;
    background: none;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.glhf-role-selector label.glhf-role-used {
    opacity: 0.25;
    cursor: not-allowed;
    text-decoration: line-through;
}

.glhf-role-selector input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.glhf-role-selector label.glhf-role-used input[type="checkbox"] {
    cursor: not-allowed;
}

.glhf-role-name {
    white-space: nowrap;
}

#glhf-create-form button[type="submit"] {
    margin-top: 0.5rem;
}

#glhf-create-form .glhf-form-error {
    color: var(--glhf-danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--glhf-radius-sm);
    border-left: 3px solid var(--glhf-danger);
}

/* --- Auth / Steam prompt --- */
.glhf-tournament-auth {
    text-align: center;
    padding: 2rem 1.5rem;
    border: 1px dashed var(--glhf-border);
    border-radius: var(--glhf-radius-md);
    margin: 1.25rem 0;
    animation: fadeInUp 0.4s ease 0.1s both;
}

.glhf-tournament-auth p {
    margin-bottom: 1rem;
    color: var(--glhf-text-muted);
    font-size: 0.9rem;
}

.glhf-btn-discord,
.glhf-btn-steam {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.8rem 1.5rem 0.5rem;
    font-family: var(--glhf-font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--glhf-radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--glhf-transition-fast);
}

.glhf-btn-discord {
    background: var(--glhf-discord);
    color: #fff;
    border: none;
}
.glhf-btn-discord:hover {
    opacity: 0.9;
    box-shadow: 0 0 16px rgba(88, 101, 242, 0.35);
    color: #fff;
}

.glhf-btn-steam {
    background: transparent;
    color: #66c0f4;
    border: 1.5px solid #66c0f4;
}
.glhf-btn-steam:hover {
    background: rgba(102, 192, 244, 0.1);
    box-shadow: 0 0 16px rgba(102, 192, 244, 0.2);
    color: #fff;
}

/* --- Bracket Wrapper --- */
#glhf-bracket-wrap {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    padding-bottom: 1rem;
    animation: fadeIn 0.5s ease;
    -webkit-overflow-scrolling: touch;
}

#glhf-bracket-wrap .bracket {
    overflow: visible;
    min-width: max-content;
}

/* --- Bracket --- */
.bracket {
    display: flex;
    gap: 48px;
    justify-content: center;
    margin: 1.5rem 0;
    padding-bottom: 10px;
    position: relative;
}

.round {
    list-style: none;
    padding: 0;
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.round .spacer {
    flex: 2;
    min-height: 40px;
}

/* --- Match Slot --- */
li.game,
.game {
    position: relative;
    padding: 0.5rem 0.75rem;
    margin: 0;
    background: var(--glhf-bg-card);
    border: 1px solid var(--glhf-border);
    font-size: 0.85rem;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    transition: all var(--glhf-transition-fast);
    color: var(--glhf-text-primary);
    cursor: default;
}

.game.top {
    border-bottom: none;
    border-radius: var(--glhf-radius-sm) var(--glhf-radius-sm) 0 0;
}
.game.bot {
    border-top: 1px solid rgba(var(--glhf-accent-rgb), 0.08);
    border-radius: 0 0 var(--glhf-radius-sm) var(--glhf-radius-sm);
}

.game.winner {
    background: rgba(var(--glhf-accent-rgb), 0.08);
    border-color: rgba(var(--glhf-accent-rgb), 0.25);
    color: var(--glhf-accent);
    font-weight: 600;
}

.game.bye {
    background: var(--glhf-bg-tertiary);
    border-color: var(--glhf-border);
    font-style: italic;
    color: var(--glhf-text-muted);
}

/* Moderator hover on undecided matches */
.moderator li.game:not(.winner):not(.has-winner):hover {
    background: rgba(var(--glhf-accent-rgb), 0.12);
    border-color: rgba(var(--glhf-accent-rgb), 0.4);
    cursor: pointer;
}

.moderator li.game.has-winner,
.moderator li.game.winner {
    cursor: default;
}

/* Clickable player name in bracket */
.glhf-win,
a.glhf-win {
    display: inline;
    background: none;
    border-radius: 0;
    width: auto;
    height: auto;
    padding: 0;
    box-sizing: border-box;
    transition: none;
    text-decoration: none;
    color: var(--glhf-accent);
}
a.glhf-win:hover {
    color: var(--glhf-accent-hover);
}

/* --- Middle spacer (vertical connector line — hidden, using SVG instead) --- */
.game.spacer {
    flex: 0;
    width: 0;
    min-height: 1px;
    padding: 0;
    margin: 0 auto;
    position: relative;
    border: none;
    background: none;
}
.game.spacer::before {
    display: none;
}

/* Hide old CSS connectors — we use SVG lines */
.game.top::before,
.game.bot::before,
.game.top::after,
.game.bot::after {
    display: none;
}

/* --- SVG Bracket Lines --- */
svg.bracket-lines {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}

svg.bracket-lines path {
    stroke: rgba(var(--glhf-accent-rgb), 0.2);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 300;
    stroke-dashoffset: 0;
}

svg.bracket-lines path.glhf-line-active {
    stroke: rgba(var(--glhf-accent-rgb), 0.5);
    stroke-width: 2.5;
}

.glhf-bracket-animate svg.bracket-lines path {
    animation: lineReveal 0.8s ease forwards;
}

/* --- Champion --- */
.glhf-champion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 2rem 0 0.5rem;
    padding: 1.25rem 2rem;
    background: var(--glhf-bg-card);
    border: 1px solid rgba(255, 152, 0, 0.25);
    border-radius: var(--glhf-radius-md);
    animation: scaleIn 0.5s ease, glowPulse 3s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.1);
}

.glhf-champion-icon {
    font-size: 2rem;
}

.glhf-champion-label {
    font-family: var(--glhf-font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--glhf-text-muted);
}

.glhf-champion-name {
    font-family: var(--glhf-font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--glhf-funcoin);
    animation: championGlow 3s ease-in-out infinite;
}

/* Legacy .champion class */
.champion {
    text-align: center;
    margin-top: 1.5rem;
    font-family: var(--glhf-font-heading);
    font-size: 1.25em;
    font-weight: 700;
    color: var(--glhf-funcoin);
}

/* --- Erase Button --- */
.glhf-erase-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    background: var(--glhf-bg-tertiary);
    border: none;
    border-radius: var(--glhf-radius-full);
    width: 22px;
    height: 22px;
    padding: 15px 18px 14px 20px !important;
    opacity: 0;
    cursor: pointer;
    transition: all var(--glhf-transition-fast);
    z-index: 10;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.glhf-erase-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: var(--glhf-text-muted);
    line-height: 1;
    transition: color var(--glhf-transition-fast);
}
li.game.top.winner:hover .glhf-erase-btn,
li.game.bot.winner:hover .glhf-erase-btn {
    display: flex;
    opacity: 0.5;
}
li.game.top .glhf-erase-btn,
li.game.bot .glhf-erase-btn {
    display: none;
}
.glhf-erase-btn:hover {
    opacity: 1 !important;
    background: var(--glhf-bg-elevated);
}
.glhf-erase-btn:hover .dashicons {
    color: var(--glhf-danger) !important;
}

/* --- Drag & Drop --- */
.glhf-draggable-slot {
    cursor: grab;
    transition: all var(--glhf-transition-fast);
    z-index: 2;
}
.glhf-draggable-slot.dragging {
    opacity: 0.6;
    box-shadow: 0 0 0 3px rgba(var(--glhf-accent-rgb), 0.3);
    background: rgba(var(--glhf-accent-rgb), 0.08);
}
.glhf-draggable-slot.dragover {
    box-shadow: 0 0 0 3px rgba(var(--glhf-accent-rgb), 0.5);
    background: rgba(var(--glhf-accent-rgb), 0.15);
}

/* --- Finalize Button --- */
#glhf-finalize-bracket {
    margin-bottom: 1rem;
}

/* --- Notice --- */
.glhf-notice {
    background: rgba(255, 152, 0, 0.08);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    border-left: 3px solid var(--glhf-funcoin);
    border-radius: var(--glhf-radius-sm);
    font-size: 0.85rem;
    color: var(--glhf-text-secondary);
}

/* --- Text --- */
#glhf-main h2 {
    font-family: var(--glhf-font-heading);
    font-weight: 800;
    color: var(--glhf-text-primary);
    margin: 0 0 0.75rem;
}

#glhf-main p {
    margin: 0.35rem 0;
    color: var(--glhf-text-secondary);
    font-size: 0.9rem;
}

#glhf-main p strong {
    color: var(--glhf-text-primary);
    font-weight: 700;
}

#glhf-wrapper ul {
    color: var(--glhf-text-secondary);
}

/* --- Shimmer Loading --- */
.glhf-loading {
    background: linear-gradient(90deg, var(--glhf-bg-tertiary) 25%, var(--glhf-bg-elevated) 50%, var(--glhf-bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--glhf-radius-sm);
    height: 2rem;
}

/* --- Steam select in registration --- */
#glhf-main select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    margin-bottom: 0.75rem;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .glhf-tourney-layout {
        flex-direction: column;
    }
    .glhf-tourney-info-col {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .bracket {
        gap: 32px;
    }
    .round {
        width: 170px;
    }
    li.game, .game {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    .glhf-tourney-info {
        padding: 1.25rem;
    }
    .glhf-tourney-title {
        font-size: 1.3rem;
    }
    .glhf-champion {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    #glhf-wrapper button,
    #glhf-wrapper form button {
        font-size: 0.8rem;
        padding: 0.6rem 1rem 0.3rem;
    }
}

@media (max-width: 480px) {
    .round {
        width: 150px;
    }
    .bracket {
        gap: 24px;
    }
}

/* --- Tournament Tabs (Moderator) --- */
.glhf-tabs-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 1.25rem;
    padding-bottom: 0;
    border-bottom: 2px solid var(--glhf-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.glhf-tabs-bar::-webkit-scrollbar { display: none; }

.glhf-tab {
    position: relative;
    padding: 15px 20px 10px 20px;
    font-family: var(--glhf-font-heading);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--glhf-text-muted);
    background: rgba(255, 255, 255, 0.02);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 8px 8px 0 0;
    box-shadow: none;
    opacity: 0.45;
}
.glhf-tab:hover {
    color: var(--glhf-text-primary);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
    opacity: 0.7;
}
.glhf-tab.active {
    color: var(--glhf-accent);
    border-bottom-color: var(--glhf-accent);
    background: rgba(var(--glhf-accent-rgb), 0.04);
    box-shadow: none;
    opacity: 1;
}

.glhf-tab-add {
    color: var(--glhf-text-muted);
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    font-weight: 400;
    opacity: 0.5;
}
.glhf-tab-add:hover {
    color: var(--glhf-accent);
    opacity: 0.8;
}
.glhf-tab-add.active {
    color: var(--glhf-accent);
    border-bottom-color: var(--glhf-accent);
    opacity: 1;
}

button.glhf-tab {
    border-radius: 8px 8px 0 0 !important;
    padding: 17px 25px 13px !important;
}
button.glhf-tab.glhf-tab-add {
    padding: 10px 20px !important;
    height: 34px;
    margin-top: auto;
}
button.glhf-tab.glhf-tab-add:hover {
    height: 40px;
}

.glhf-tournament-content {
    animation: fadeInUp 0.35s ease;
    transition: opacity 0.2s ease;
}

/* Delete button override for danger styling inside tabs context */
.glhf-delete-tournament-btn {
    background: transparent !important;
    color: var(--glhf-danger) !important;
    border: 1.5px solid var(--glhf-danger) !important;
}
.glhf-delete-tournament-btn:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2) !important;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
