/* ============================================================================
   profile.css — styles scoped to views/profile.php
   Loaded AFTER style.css, so selectors here override shared defaults.
   ============================================================================ */

/* ── Local design tokens ─────────────────────────────────────────────────
   One canonical card surface so every section on this page feels like it
   belongs to the same layer. Tuned to sit ~5% lighter than the page bg
   (#0f1419 → #1a1f2e) — enough separation for borders to do the rest. */
.profile-container {
    --card-surface: rgba(255, 255, 255, 0.025);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-border-hover: rgba(0, 217, 255, 0.35);
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    --card-shadow-hover: 0 10px 28px -8px rgba(0, 217, 255, 0.22);
}

html[data-theme="light"] .profile-container {
    --card-surface: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-border-hover: rgba(0, 153, 204, 0.4);
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 10px 24px -6px rgba(0, 153, 204, 0.2);
}

/* ── Profile header (override red border, flatten, elevate) ─────────────── */
.profile-container {
    padding: 2.5rem 0 3.5rem;
}

.profile-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    margin-bottom: 2rem;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, rgba(0,217,255,0.04) 0%, rgba(255,255,255,0.02) 60%);
    border: 1px solid rgba(0, 217, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.28), 0 0 0 1px rgba(0,217,255,0.05);
    overflow: hidden;
}

/* soft accent glow in the top-right corner */
.profile-header::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 217, 255, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

.profile-header > * { position: relative; z-index: 1; }

.avatar-large {
    width: 108px;
    height: 108px;
    border-radius: 18px;
    border: 2px solid rgba(0, 217, 255, 0.45);
    box-shadow: 0 8px 24px rgba(0, 217, 255, 0.25);
    object-fit: cover;
    flex-shrink: 0;
}

.profile-info { min-width: 0; flex: 1; }

.profile-share-btn { flex-shrink: 0; align-self: center; }
.profile-share-btn.is-copied { color: #4ade80; border-color: rgba(74, 222, 128, 0.35); }

.profile-info h1 {
    font-size: clamp(1.4rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    color: var(--text-primary);
    text-shadow: none;
    word-break: break-word;
}

.steam-id {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: monospace;
    letter-spacing: 0.02em;
    margin: 0;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.profile-tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 1.75rem;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    scrollbar-width: none;
}

.profile-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    display: none;
    animation: profileFadeIn 0.25s ease;
}

.tab-content.active { display: block; }

/* ── Kill the dark slab behind tab panels ────────────────────────────────
   theme.css has plain `.tab-content` rules with !important. profile.css
   loads BEFORE theme.css, so we lose source-order ties.
   Using a `body` qualifier bumps our specificity to 0,1,3 vs theme.css's
   0,1,0 — guaranteed win regardless of load order. */
body .profile-container .tab-content,
body .profile-container .tab-content.active,
body .profile-container #stats-tab,
body .profile-container #teams-tab,
body .profile-container #matches-tab {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

@keyframes profileFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.stat-card {
    position: relative;
    background: linear-gradient(135deg, rgba(0,217,255,0.03) 0%, rgba(255,255,255,0.02) 100%);
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    border: 1px solid rgba(0,217,255,0.1);
    text-align: left;
    box-shadow: var(--card-shadow);
    transition: transform .2s, border-color .2s, box-shadow .2s;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), transparent);
    opacity: 0.5;
    transition: opacity .2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover);
}

.stat-card:hover::before { opacity: 1; }

.stat-card h3 {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.stat-value {
    font-size: 2.1rem;
    font-weight: 900;
    color: var(--accent-primary);
    letter-spacing: -0.03em;
    text-shadow: 0 0 20px rgba(0, 217, 255, 0.35);
    line-height: 1;
    margin: 0;
    font-variant-numeric: tabular-nums;
}
.stat-value .stat-of { font-size: 1.1rem; font-weight: 700; color: var(--text-muted); text-shadow: none; }
.stat-note { margin: 0.45rem 0 0; font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }

/* ── Headline stat row ─────────────────────────────────────────────────── */
.stats-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.hero-stat {
    background: linear-gradient(135deg, rgba(0,217,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid rgba(0,217,255,0.16);
    border-radius: 16px;
    padding: 1.15rem 1.35rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.hs-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}
.hs-value {
    font-size: 2.3rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.hs-value.hs-good { color: #4ade80; }
.hs-value.hs-bad  { color: #f87171; }
.hs-sub { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Recent form strip ────────────────────────────────────────────────── */
.form-strip {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1.1rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}
.form-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}
.form-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.form-dot {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
}
.form-dot.form-w { background: rgba(74,222,128,0.18);  color: #4ade80; border: 1px solid rgba(74,222,128,0.35); }
.form-dot.form-l { background: rgba(248,113,113,0.16); color: #f87171; border: 1px solid rgba(248,113,113,0.32); }
.form-dot.form-d { background: rgba(148,163,184,0.16); color: #94a3b8; border: 1px solid rgba(148,163,184,0.3); }

.stats-empty {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-muted);
}
.stats-empty i { font-size: 2.6rem; opacity: 0.45; display: block; margin-bottom: 0.9rem; }
.stats-empty h3 { margin: 0 0 0.4rem; color: var(--text-secondary); font-size: 1.05rem; }
.stats-empty p { margin: 0; font-size: 0.88rem; }

@media (max-width: 720px) {
    .stats-hero { grid-template-columns: repeat(2, 1fr); }
    .hs-value { font-size: 1.9rem; }
}

/* ── Teams tab ──────────────────────────────────────────────────────────── */
.teams-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 12px;
    flex-wrap: wrap;
}

.teams-header h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.loading-teams, .no-teams {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--text-muted);
}

.loading-teams i, .no-teams i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    opacity: 0.7;
}

.no-teams h3 {
    color: var(--text-primary);
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.team-card {
    position: relative;
    background: var(--card-surface);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.25rem;
    cursor: pointer;
    transition: transform .2s, border-color .2s, box-shadow .2s;
    overflow: hidden;
}

.team-card:hover {
    transform: translateY(-3px);
    border-color: var(--card-border-hover);
    box-shadow: var(--card-shadow-hover);
}

.team-card.captain {
    border-color: rgba(255, 215, 0, 0.22);
}

.team-card.captain:hover {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 10px 28px -6px rgba(255, 215, 0, 0.25);
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    gap: 10px;
}

.team-card-header h3 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: rgba(0, 217, 255, 0.12);
    border-radius: 999px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid rgba(0, 217, 255, 0.25);
}

.team-card.captain .role-badge {
    background: rgba(255, 215, 0, 0.12);
    color: #FFD700;
    border-color: rgba(255, 215, 0, 0.3);
}

.team-card-body { margin-bottom: 0.85rem; }

.team-card-body p {
    margin: 6px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.member-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.team-record {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.team-record i { color: #FFD700; opacity: 0.8; }
.team-record .tr-w { color: #4ade80; font-weight: 700; }
.team-record .tr-l { color: #f87171; font-weight: 700; }
.team-record .tr-rate {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-left: 2px;
}
.team-record--empty { color: var(--text-muted); }
.team-record--empty i { opacity: 0.4; }

.team-card-footer .btn-view {
    background: rgba(0, 217, 255, 0.08);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 217, 255, 0.2);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background .15s, border-color .15s;
    width: 100%;
    font-family: inherit;
}

.team-card-footer .btn-view:hover {
    background: rgba(0, 217, 255, 0.16);
    border-color: rgba(0, 217, 255, 0.4);
}

/* ── Recent matches table (also used from this page) ───────────────────── */
.recent-matches-section {
    margin-top: 0;
}

.recent-matches-section h2 {
    font-size: 1.35rem;
    margin: 0 0 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-shadow: none;
}

.matches-table {
    background: var(--card-surface);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.matches-table table {
    width: 100%;
    border-collapse: collapse;
}

.matches-table th {
    background: rgba(0, 217, 255, 0.06);
    padding: 0.9rem 1rem;
    text-align: left;
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(0, 217, 255, 0.18);
}

.matches-table td {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.matches-table tr { transition: background .15s; }
.matches-table tr:hover { background: rgba(0, 217, 255, 0.04); }

.clickable-row { cursor: pointer; }

.result-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

.result-badge.win {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.result-badge.loss {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.no-data {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 1.25rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), #0099cc);
    color: #04141e;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    transition: transform .18s, box-shadow .18s;
    box-shadow: 0 4px 15px rgba(0, 217, 255, 0.25);
}

.view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 217, 255, 0.4);
    color: #04141e;
}

/* ── Modals (used for create-team / team-details / add-member) ──────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 18, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: linear-gradient(180deg, #1a1f2e 0%, #141825 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn .25s cubic-bezier(.2, .9, .3, 1.15);
}

.modal-content.modal-large { max-width: 800px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i { color: var(--accent-primary); }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    transition: color .15s;
    line-height: 1;
    padding: 0 4px;
}

.modal-close:hover { color: var(--text-primary); }

.modal-content form { padding: 1.25rem 1.5rem 1.5rem; }

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color .15s, background .15s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.4);
}

.form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 5px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-info {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00D9FF, #0099cc);
    color: #04141e;
    box-shadow: 0 4px 14px rgba(0, 217, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 217, 255, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.btn-info:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.45);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.45);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

/* ── Team details modal content ─────────────────────────────────────────── */
.team-details { padding: 1.5rem; }

.team-info-section,
.team-members-section {
    margin-bottom: 1.75rem;
}

.team-info-section h4,
.team-members-section h4 {
    color: var(--accent-primary);
    margin: 0 0 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.team-info-section p {
    color: var(--text-secondary);
    margin: 8px 0;
    font-size: 0.88rem;
}

.team-info-section strong { color: var(--text-primary); }

.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    transition: background .15s, border-color .15s;
    gap: 10px;
    flex-wrap: wrap;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.member-item.captain-member {
    border-color: rgba(255, 215, 0, 0.28);
    background: rgba(255, 215, 0, 0.04);
}

.member-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.member-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.92rem;
}

.member-name-link { color: inherit; text-decoration: none; }
.member-name-link:hover { color: var(--accent-primary); text-decoration: underline; }

.member-role {
    font-size: 0.72rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.member-item.captain-member .member-role { color: #FFD700; }

.member-steamid {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Right-side actions cluster: pencil-edit + remove buttons. */
.member-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Generic icon button (used by the pencil edit + inline save/cancel).
   Smaller and lighter than .btn-primary so it doesn't crowd the row. */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .14s, border-color .14s, color .14s;
    font-family: inherit;
    font-size: 0.78rem;
}

.btn-icon:hover {
    background: rgba(0, 217, 255, 0.12);
    border-color: rgba(0, 217, 255, 0.4);
    color: var(--accent-primary);
}

.btn-icon:disabled { opacity: .5; cursor: not-allowed; }

.btn-icon-ok:hover {
    background: rgba(74, 222, 128, 0.15);
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ade80;
}

.btn-icon-cancel:hover {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.4);
    color: #f44336;
}

/* Inline edit input — replaces the .member-name span while editing.
   Sized to feel like a continuation of the original text. */
.member-name-input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 217, 255, 0.45);
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.92rem;
    font-family: inherit;
    padding: 4px 8px;
    width: 180px;
    max-width: 100%;
    margin-right: 6px;
}

.member-name-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.15);
}

.member-name-input:disabled { opacity: .6; }

/* While editing, let the input + buttons live next to each other. */
.member-name[data-editing="1"] {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.team-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
}

.player-preview {
    padding: 0.85rem 1rem;
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 10px;
    margin-top: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.player-preview-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1px solid rgba(0, 217, 255, 0.35);
    object-fit: cover;
    flex-shrink: 0;
}

.player-preview-info {
    min-width: 0;
    flex: 1;
}

.player-preview p {
    color: var(--text-primary);
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.3;
}

.player-preview-source {
    color: var(--accent-primary) !important;
    font-size: 0.72rem !important;
    margin-top: 2px !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.player-preview-source:empty { display: none; }

/* ── Utility ──────────────────────────────────────────────────────────────
   Replaces inline `style="display:none"` attributes; toggled via JS
   classList.add/remove instead of writing to .style.display directly. */
.is-hidden { display: none !important; }

/* ── Loading / empty states for the Teams tab ─────────────────────────── */
.loading-teams,
.no-teams {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-teams i,
.no-teams i {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--accent-primary);
}

.no-teams i { opacity: 0.5; }

/* ── Tournament badges (Statistics tab) ──────────────────────────────────
   Surfaces tournaments the user is actively part of as captain / player /
   admin, rendered as a row of clickable cards under the stat tiles. Only
   active tournament statuses are shown (registration / active / in_progress).
   Each badge links to the appropriate page based on role. */
.tournament-badges {
    margin-top: 2rem;
}

.tournament-badges .section-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tournament-badges .section-title i {
    color: var(--accent-primary);
    font-size: 0.95rem;
}

.t-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

/* Each badge — clickable card. The left strip color and icon hue change
   based on role so admin / captain / player are visually distinct without
   relying on the role label text alone. */
.t-badge {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: var(--card-surface);
    border: 1px solid var(--card-border);
    border-radius: 11px;
    text-decoration: none;
    color: inherit;
    transition: transform .18s, border-color .18s, background .18s;
    position: relative;
    overflow: hidden;
}

.t-badge::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
    opacity: 0.55;
    transition: opacity .18s;
}

.t-badge:hover {
    border-color: var(--card-border-hover);
    background: rgba(0, 217, 255, 0.04);
    transform: translateY(-2px);
}

.t-badge:hover::before { opacity: 1; }

.t-badge-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: rgba(0, 217, 255, 0.12);
    color: var(--accent-primary);
}

.t-badge-body {
    flex: 1;
    min-width: 0;
}

.t-badge-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.t-badge-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.t-badge-role {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.t-badge-team {
    color: var(--text-secondary);
    font-weight: 600;
}

.t-badge-status {
    color: #4CAF50;
    font-weight: 600;
}

.t-badge-sep { opacity: 0.5; }

.t-badge-chevron {
    color: var(--text-muted);
    font-size: 0.78rem;
    flex-shrink: 0;
    transition: transform .18s, color .18s;
}

.t-badge:hover .t-badge-chevron {
    color: var(--accent-primary);
    transform: translateX(2px);
}

/* Per-role color treatments — admin gets gold, captain gets gold-orange,
   player keeps the cyan default. */
.t-badge.t-role-admin::before {
    background: linear-gradient(180deg, #FFD54A, #FFA000);
}
.t-badge.t-role-admin .t-badge-icon {
    background: rgba(255, 213, 74, 0.12);
    color: #FFD54A;
}
.t-badge.t-role-admin .t-badge-role {
    color: #FFD54A;
}

.t-badge.t-role-captain::before {
    background: linear-gradient(180deg, #FFB74D, #FF7043);
}
.t-badge.t-role-captain .t-badge-icon {
    background: rgba(255, 183, 77, 0.12);
    color: #FFB74D;
}
.t-badge.t-role-captain .t-badge-role {
    color: #FFB74D;
}

/* ── My Tournaments tab ───────────────────────────────────────────────────
   Two sections (Owned + Entered), each rendering a card grid that follows
   the same visual language as the team cards. Owned cards lean cyan/admin,
   entered cards stay neutral with a role tag inline. */
.my-t-request-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, rgba(0,217,255,.06), rgba(139,92,246,.06));
    border: 1px solid rgba(0,217,255,.18);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.no-tournaments {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}
.no-tournaments i {
    font-size: 3rem;
    color: var(--accent-primary);
    opacity: 0.4;
    margin-bottom: 1.25rem;
}
.no-tournaments h3 {
    color: var(--text-primary);
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}
.no-tournaments p {
    margin: 0;
    font-size: 0.92rem;
}

.my-t-section { margin-bottom: 2rem; }
.my-t-section:last-child { margin-bottom: 0; }

.my-t-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.my-t-section-title i {
    color: var(--accent-primary);
    font-size: 0.95rem;
}
.my-t-count {
    margin-left: auto;
    background: rgba(0, 217, 255, 0.12);
    color: var(--accent-primary);
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.my-t-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.my-t-card {
    background: var(--card-surface);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    transition: border-color .2s, transform .2s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.my-t-card:hover {
    border-color: var(--card-border-hover);
    transform: translateY(-2px);
}
.my-t-card--owned {
    border-left: 3px solid var(--accent-primary);
}
.my-t-card--entered {
    border-left: 3px solid #FFB74D;
}

.my-t-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.my-t-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.02rem;
    flex: 1;
    word-break: break-word;
}

/* Status pills — same color treatment as admin/tournaments.php for
   visual consistency between the admin manager and this profile tab. */
.my-t-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}
.my-t-pill--draft        { background: rgba(255,193,7,.12);   color: #FFC107; border: 1px solid rgba(255,193,7,.28); }
.my-t-pill--registration { background: rgba(0,217,255,.12);   color: #00D9FF; border: 1px solid rgba(0,217,255,.28); }
.my-t-pill--active       { background: rgba(76,175,80,.12);   color: #4CAF50; border: 1px solid rgba(76,175,80,.28); }
.my-t-pill--in_progress  { background: rgba(255,152,0,.12);   color: #FF9800; border: 1px solid rgba(255,152,0,.28); }
.my-t-pill--completed    { background: rgba(156,39,176,.12);  color: #ce93d8; border: 1px solid rgba(156,39,176,.28); }
.my-t-pill--cancelled    { background: rgba(244,67,54,.12);   color: #f44336; border: 1px solid rgba(244,67,54,.28); }

.my-t-team-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.86rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.025);
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
}
.my-t-team-line i {
    color: var(--accent-primary);
}
.my-t-team-line strong {
    color: var(--text-primary);
}
.my-t-tag {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.78rem;
}

.my-t-role-tag {
    margin-left: auto;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.my-t-role-tag--captain {
    background: rgba(255, 183, 77, 0.15);
    color: #FFB74D;
}
.my-t-role-tag--player {
    background: rgba(0, 217, 255, 0.12);
    color: var(--accent-primary);
}

/* "Up next" / "Live now" indicator. The live variant pulses subtly so it's
   immediately obvious which tournaments need attention right now. */
.my-t-next-match {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    background: rgba(255, 152, 0, 0.08);
    border: 1px solid rgba(255, 152, 0, 0.22);
    color: #FFB74D;
}
.my-t-next-match--in_progress {
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.32);
    color: #f44336;
    animation: myTPulse 1.8s ease-in-out infinite;
}
@keyframes myTPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.18); }
    50%      { box-shadow: 0 0 0 5px rgba(244, 67, 54, 0); }
}

.my-t-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.my-t-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.my-t-meta-item i {
    color: var(--text-muted);
    opacity: 0.7;
}

.my-t-progress {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
}
.my-t-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), #0088bb);
    border-radius: 999px;
    transition: width .4s ease;
    width: 0;
}

.my-t-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.my-t-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, transform .15s, border-color .15s;
    border: 1px solid transparent;
    cursor: pointer;
}
.my-t-btn--primary {
    background: linear-gradient(135deg, var(--accent-primary), #0088bb);
    color: #000;
}
.my-t-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.32);
}
.my-t-btn--ghost {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
    color: var(--text-primary);
}
.my-t-btn--ghost:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.18);
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .profile-container { padding: 1.5rem 0 2.5rem; }

    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
    }

    .avatar-large { width: 88px; height: 88px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .stat-card { padding: 1rem 1.1rem; }
    .stat-value { font-size: 1.5rem; }

    .t-badges-grid { grid-template-columns: 1fr; }
    .t-badge-name { font-size: 0.86rem; }

    .my-t-grid { grid-template-columns: 1fr; }
    .my-t-name { font-size: 0.95rem; }

    .teams-grid { grid-template-columns: 1fr; }

    .matches-table { overflow-x: auto; }
    .matches-table table { min-width: 560px; }

    .modal-content { max-width: 100%; }
    .modal-header { padding: 1rem 1.25rem; }
    .modal-content form { padding: 1rem 1.25rem 1.25rem; }

    .member-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-actions { justify-content: stretch; }
    .modal-actions > * { flex: 1; justify-content: center; }

    .tab-btn { padding: 10px 14px; font-size: 0.88rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .profile-info h1 { font-size: 1.35rem; }
    .modal { padding: 0.5rem; }
    .modal-content { border-radius: 12px; }
    .modal-content form { padding: 0.875rem 1rem 1rem; }
    .modal-header { padding: 0.875rem 1rem; }
    .tab-btn { padding: 8px 10px; font-size: 0.82rem; }
}

/* ==================== PROFILE MOBILE POLISH ==================== */

@media (max-width: 768px) {
    /* Tabs scroll */
    .profile-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 3px;
        scrollbar-width: none;
    }
    .profile-tabs::-webkit-scrollbar { display: none; }
    .tab-btn { white-space: nowrap; flex-shrink: 0; }

    /* Match history table */
    .matches-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .matches-table table { min-width: 520px; }
    .matches-table th, .matches-table td { padding: 0.45rem 0.6rem; font-size: 0.82rem; }

    /* Stat cards */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 0.9rem 1rem; border-radius: 10px; }
    .stat-value { font-size: 1.4rem; }
    .stat-label { font-size: 0.72rem; }

    /* Team/badge sections */
    .my-t-card { padding: 12px; border-radius: 10px; }
    .my-t-name { font-size: 0.88rem; }

    /* Form inputs in modals */
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px !important;
        min-height: 44px;
    }
    .modal-actions .btn { min-height: 44px; font-size: 0.9rem; }
}

@media (max-width: 375px) {
    .avatar-large { width: 76px; height: 76px; }
    .profile-info h1 { font-size: 1.15rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-value { font-size: 1.25rem; }
    .tab-btn { padding: 6px 8px; font-size: 0.76rem; }
    .matches-table table { min-width: 460px; }
}