/*
 * profile.css
 * Page-specific styles for the root profile.php (public player profiles page).
 * Self-contained, matching the brand tokens and breadcrumb/footer patterns
 * already established in seasonal.css.
 */

:root {
    --pp-dark: #0a1a17;
    --pp-dark-2: #112922;
    --pp-felt: #0d7a4a;
    --pp-felt-light: #15a060;
    --pp-gold: #d4a843;
    --pp-gold-light: #e6c06a;
    --pp-cream: #f4efe3;
    --pp-cream-dark: #e8dfcd;
    --pp-red: #b71c1c;
    --pp-bg: #f5f3ef;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 8px 30px rgba(0,0,0,0.1);
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100%; }
html { overflow-y: scroll; scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { display: none; width: 0; background: transparent; }
body {
    font-family: 'Poppins', system-ui, sans-serif;
    color: #222;
    background: var(--pp-bg);
    margin: 0;
    padding-top: 60px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── BREADCRUMB HEADER ─── */
.pp-navbar {
    background: var(--pp-dark);
    padding: 12px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    transition: transform .3s ease;
}
.pp-navbar.nav-hidden { transform: translateY(-100%); }

.breadcrumb-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 40px;
}
.breadcrumb-back {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(244,239,227,0.22);
    background: rgba(244,239,227,0.06);
    color: var(--pp-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all .2s;
}
.breadcrumb-back:hover { border-color: var(--pp-gold); color: var(--pp-gold-light); }
.breadcrumb-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    color: var(--pp-cream);
    /* Shows the player's name: keep the case it was typed in (Bebas Neue has no lowercase). */
    font-family: 'Poppins', sans-serif; font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#mainContent {
    padding-top: 32px;
    padding-bottom: 40px;
    max-width: 100%;
    padding-left: 40px;
    padding-right: 40px;
    flex: 1 0 auto;
    width: 100%;
}
.footer { flex-shrink: 0; }
.view-detail { display: none; }
.view-list { display: block; }

/* ─── FOOTER ─── */
.footer {
    background: var(--pp-dark);
    color: rgba(244,239,227,0.6);
    padding: 32px 0;
    text-align: center;
}
.footer a { color: rgba(244,239,227,0.6); text-decoration: none; }
.footer a:hover { color: var(--pp-gold); }

/* ─── ROSTER TOOLBAR + SEARCH ─── */
.roster-toolbar {
    margin-bottom: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.roster-search {
    position: relative;
    max-width: 360px;
    flex: 1 1 260px;
}
.roster-filter {
    position: relative;
    flex: 0 0 190px;
}
.roster-filter i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 0.85rem;
    pointer-events: none;
}
.roster-filter i:first-child { left: 14px; }
.roster-filter .roster-filter-caret { right: 14px; font-size: 0.7rem; }
.roster-filter select {
    width: 100%;
    padding: 10px 34px 10px 38px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    color: #333;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .2s;
}
.roster-filter select:focus { border-color: var(--pp-felt); }
.roster-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 0.85rem;
}
.roster-search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    outline: none;
    transition: border-color .2s;
}
.roster-search input:focus { border-color: var(--pp-felt); }

/* ─── PLAYER ROSTER GRID ─── */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}
@media (min-width: 992px) {
    .player-grid { grid-template-columns: repeat(5, 1fr); }
}
.player-card {
    background: white;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.player-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); }
.player-card-photo-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--pp-cream-dark);
}
.player-card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.player-card-body {
    padding: 20px 16px 24px;
    text-align: center;
}
.player-card-name {
    font-weight: 700;
    color: var(--pp-dark);
    font-size: 1.05rem;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* summary stats on the roster card */
.player-card-rate {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.pc-rate-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.15rem;
    line-height: 1;
    color: var(--pp-gold);
    flex-shrink: 0;
}
.pc-rate-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--pp-cream-dark);
    overflow: hidden;
}
.pc-rate-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--pp-gold), var(--pp-gold-light));
}
.player-card-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    margin-bottom: 14px;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.pc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.pc-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--pp-dark);
}
.pc-num.pc-wins   { color: var(--pp-felt); }
.pc-num.pc-losses { color: var(--pp-red); }
.pc-label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #999;
}
.player-card-btn {
    display: inline-block;
    background: var(--pp-felt);
    color: #fff;
    border: none;
    padding: 10px 26px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s;
}
.player-card:hover .player-card-btn { background: var(--pp-dark); }

/* ─── PLAYER HERO (profile detail) ─── */
.ph-hero {
    background: white;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 24px;
}
.ph-photo-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--pp-dark) 0%, var(--pp-felt) 100%);
}
.ph-photo-wrap::after {
    /* faint felt-diamond texture so a missing photo doesn't read as a flat gradient */
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(244,239,227,0.1) 1px, transparent 1px);
    background-size: 14px 14px;
    opacity: 0.5;
    pointer-events: none;
}
.ph-avatar, .ph-avatar-initials {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ph-avatar-initials {
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3rem, 14vw, 5rem);
    color: #fff;
}
#playerHero.no-avatar .ph-avatar { display: none; }
#playerHero.no-avatar .ph-avatar-initials { display: flex; }

.ph-hero-main { padding: 22px 24px 24px; }
.ph-identity { margin-bottom: 18px; }
.ph-identity-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.pp-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 8px 16px;
    border: 1px solid var(--pp-felt);
    background: transparent;
    color: var(--pp-felt);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.pp-share-btn:hover,
.pp-share-btn.copied {
    background: var(--pp-felt);
    color: #fff;
}
.ph-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}
.pp-match-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid var(--pp-gold);
    background: var(--pp-gold);
    color: var(--pp-dark);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.pp-match-btn:hover,
.pp-match-btn:focus {
    background: var(--pp-gold-light);
    border-color: var(--pp-gold-light);
    color: var(--pp-dark);
    text-decoration: none;
}
.pp-match-btn[hidden] { display: none; }
/* "Set a Duel": same shape as Match Request, outlined so the two read as a pair */
.pp-duel-btn {
    background: transparent;
    color: var(--pp-gold);
}
.pp-duel-btn:hover,
.pp-duel-btn:focus {
    background: var(--pp-gold);
    color: var(--pp-dark);
}
.pp-closed-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.06);
    color: #777;
    font-size: 0.75rem;
    font-weight: 600;
}
.pp-closed-note[hidden] { display: none; }
.ph-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.card-badge.active { background: rgba(13,122,74,0.12); color: var(--pp-felt); }
.card-badge.inactive { background: #f0f0f0; color: #999; }
.card-badge.rate { background: rgba(212,168,67,0.15); color: #a9821f; }
.ph-name {
    /* Player names keep the case they were typed in (Bebas Neue has no lowercase). */
    font-family: 'Poppins', sans-serif; font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    line-height: 1.1;
    color: var(--pp-dark);
    margin: 0 0 12px;
}
.ph-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-tags .tag {
    background: var(--pp-bg);
    border: 1px solid var(--pp-cream-dark);
    color: #555;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ph-tags .tag i { color: var(--pp-felt); }

.ph-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 1px;
    background: rgba(10,26,23,0.08);
    border-radius: 14px;
    overflow: hidden;
    border-top: 3px solid var(--pp-gold);
}
.ph-stats .stat {
    text-align: center;
    padding: 18px 8px;
    background: linear-gradient(135deg, var(--pp-dark) 0%, var(--pp-felt) 140%);
}
.ph-stats .stat i { color: var(--pp-gold-light); font-size: 1rem; margin-bottom: 8px; display: block; }
.ph-stats .stat .num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--pp-cream);
    line-height: 1;
}
.ph-stats .stat .label {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(244,239,227,0.55);
    margin-top: 5px;
}

@media (min-width: 768px) {
    .ph-hero { display: flex; align-items: stretch; }
    .ph-photo-wrap { width: 300px; flex: none; aspect-ratio: 1 / 1; }
    .ph-hero-main {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 18px;
        padding: 28px 32px;
    }
    .ph-hero-main .ph-identity { margin-bottom: 0; }
}
@media (min-width: 992px) {
    .ph-photo-wrap { width: 340px; }
}

/* ─── PROFILE SECTIONS (matches/tournaments + form sidebar) ─── */
.ph-body { display: block; }
.ph-main, .ph-side { min-width: 0; }
@media (min-width: 992px) {
    .ph-body {
        display: grid;
        grid-template-columns: 1fr 320px;
        align-items: start;
        gap: 24px;
    }
    .ph-main {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
        gap: 24px;
    }
    .ph-body .profile-section { margin-bottom: 24px; }
    .ph-main .profile-section { margin-bottom: 0; }
    .ph-side .profile-section:last-child { margin-bottom: 0; }
}
.profile-section {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.section-heading {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.5px;
    font-size: 1.15rem;
    color: var(--pp-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-heading i { color: var(--pp-felt); font-size: 0.95rem; }
.ph-form-card { border-top: 3px solid var(--pp-gold); }

/* form strip */
.form-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.form-pill {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.5px;
    color: #fff;
    background-image: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.5), rgba(255,255,255,0) 55%);
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.25), 0 2px 5px rgba(0,0,0,0.15);
}
.form-pill.win { background-color: var(--pp-felt); }
.form-pill.loss { background-color: var(--pp-red); }
.form-pill.draw { background-color: #8a8a8a; }

/* recent matches list */
.pm-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.pm-row:last-child { border-bottom: none; }
.pm-result {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}
.pm-result.W { background: #28a745; }
.pm-result.L { background: #dc3545; }
.pm-result.D { background: #999; }
.pm-info { flex: 1; min-width: 0; }
.pm-opponent {
    font-weight: 600;
    color: var(--pp-dark);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-meta { font-size: 0.72rem; color: #999; margin-top: 2px; }
.pm-score {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.15rem;
    color: var(--pp-felt);
    flex-shrink: 0;
}

/* tournament history list */
.th-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}
.th-row:last-child { border-bottom: none; }
.th-media {
    width: 54px;
    height: 54px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--pp-felt), var(--pp-dark-2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(244,239,227,0.3);
}
.th-media img { width: 100%; height: 100%; object-fit: cover; }
.th-info { flex: 1; min-width: 0; }
.th-name {
    font-weight: 600;
    color: var(--pp-dark);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.th-meta { font-size: 0.72rem; color: #999; margin-top: 2px; }
.th-record { text-align: right; flex-shrink: 0; }
.th-record .wl { font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem; color: var(--pp-felt); }
.th-champion {
    color: var(--pp-gold);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* empty / loading states */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}
.empty-state i { font-size: 2.4rem; color: #ddd; margin-bottom: 12px; display: block; }
.empty-state h3 { font-size: 1.1rem; color: #666; margin: 0 0 6px; }
.empty-state p { font-size: 0.85rem; margin: 0; }

/* skeleton loading */
.skeleton { background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 200% 100%; animation: pp-shimmer 1.4s infinite; border-radius: 6px; }
@keyframes pp-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 190px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 767px) {
    #mainContent { padding-left: 16px; padding-right: 16px; }
    .roster-search { max-width: 100%; }
    .roster-filter { flex: 1 1 100%; }
    .breadcrumb-inner { padding: 0 16px; }
    .breadcrumb-title { font-size: 0.95rem; }

    .ph-hero-main { padding: 18px 18px 20px; }
    .ph-stats { grid-template-columns: repeat(3, 1fr); }

    .profile-section { padding: 18px; }
}

@media (max-width: 576px) {
    .player-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .th-media { width: 44px; height: 44px; }
}

/* ─── RANKING POINTS (side card) ─── */
.ph-rank-card { border-top: 3px solid var(--pp-felt); }
.rank-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rank-tile {
    display: block;
    text-align: center;
    padding: 10px 4px;
    border-radius: 10px;
    background: var(--pp-bg);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.rank-tile:hover { background: var(--pp-cream); }
.rank-tile-pts { font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; line-height: 1; color: var(--pp-felt); }
.rank-tile-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.5px; color: #8a8275; margin-top: 4px; }
.rank-tile-rank { font-size: 0.74rem; font-weight: 600; color: var(--pp-dark); }
.rank-history { margin-top: 12px; }
.rank-history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1eee8;
    text-decoration: none;
    color: var(--pp-dark);
    font-size: 0.84rem;
}
.rank-history-row:last-child { border-bottom: none; }
.rank-history-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rank-history-name small { display: block; color: #8a8275; font-size: 0.72rem; }
.rank-history-pts { font-weight: 700; color: var(--pp-felt); white-space: nowrap; }
.rank-empty { margin: 12px 0 0; font-size: 0.82rem; color: #8a8275; }
.rank-more { display: inline-block; margin-top: 12px; font-size: 0.82rem; font-weight: 600; color: var(--pp-felt); text-decoration: none; }
.rank-more:hover { text-decoration: underline; }
