/* 
   CLAN SYSTEM STYLES 
   Modern Glassmorphism Design
*/

/* --- Leaderboard Cards (clans.php) --- */
.clan-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.clan-card {
    display: flex;
    align-items: center;
    background: rgba(26, 14, 46, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(157, 63, 255, 0.15);
    border-radius: var(--r-lg);
    padding: 16px 24px;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    cursor: pointer;
    text-decoration: none;
    animation: slideUp 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.clan-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(157, 63, 255, 0.2);
    background: rgba(26, 14, 46, 0.8);
    border-color: rgba(157, 63, 255, 0.3);
}

/* Rank Medals */
.clan-card[data-rank="1"] { border: 1px solid rgba(255, 215, 0, 0.3); box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.05); }
.clan-card[data-rank="2"] { border: 1px solid rgba(192, 192, 192, 0.3); box-shadow: inset 0 0 20px rgba(192, 192, 192, 0.05); }
.clan-card[data-rank="3"] { border: 1px solid rgba(205, 127, 50, 0.3); box-shadow: inset 0 0 20px rgba(205, 127, 50, 0.05); }

.card-rank {
    width: 40px;
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--faint);
    text-align: center;
    flex-shrink: 0;
}
.clan-card[data-rank="1"] .card-rank { color: var(--gold); text-shadow: 0 0 10px rgba(255, 215, 0, 0.6); font-size: 1.3rem; }
.clan-card[data-rank="2"] .card-rank { color: var(--silver); text-shadow: 0 0 10px rgba(192, 192, 192, 0.6); font-size: 1.2rem; }
.clan-card[data-rank="3"] .card-rank { color: var(--bronze); text-shadow: 0 0 10px rgba(205, 127, 50, 0.6); font-size: 1.2rem; }

.card-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    margin: 0 20px;
    border: 2px solid rgba(157, 63, 255, 0.3);
    background: rgba(0,0,0,0.3);
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.card-tag {
    color: var(--gold);
    font-family: var(--font-head);
    font-weight: 600;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--muted);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-stats {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-left: 20px;
}

.stat-mmr {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-mmr-val {
    font-family: var(--font-head);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--hot);
    text-shadow: 0 0 10px rgba(212, 160, 255, 0.4);
}

.stat-mmr-lbl {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.stat-winrate {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wr-bar-bg {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.wr-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--hot));
    border-radius: 3px;
    box-shadow: 0 0 10px var(--accent);
}

.wr-val {
    font-family: var(--font-head);
    font-weight: 700;
    color: #fff;
    width: 35px;
    text-align: right;
}

/* --- League Badges --- */
.league-badge {
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}
.league-amateur { background: rgba(205, 127, 50, 0.15); color: #cd7f32; border: 1px solid rgba(205, 127, 50, 0.4); box-shadow: 0 0 10px rgba(205, 127, 50, 0.2); }
.league-pro { background: rgba(192, 192, 192, 0.15); color: #c0c0c0; border: 1px solid rgba(192, 192, 192, 0.4); box-shadow: 0 0 10px rgba(192, 192, 192, 0.2); }
.league-elite { background: rgba(255, 215, 0, 0.15); color: #ffd700; border: 1px solid rgba(255, 215, 0, 0.4); box-shadow: 0 0 15px rgba(255, 215, 0, 0.4); animation: pulseGlow 2s infinite alternate; }

/* --- Hero Banner (clan_profile.php) --- */
.hero-banner {
    position: relative;
    background: linear-gradient(135deg, rgba(26, 14, 46, 0.8), rgba(7, 3, 15, 0.95));
    border: 1px solid var(--faint);
    border-radius: var(--r-lg);
    padding: 40px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: var(--glow-md);
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 100px;
    background: linear-gradient(180deg, rgba(157, 63, 255, 0.1), transparent);
    pointer-events: none;
}

.hero-logo-wrap {
    position: relative;
    z-index: 2;
}

.hero-logo {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    object-fit: cover;
    border: 3px solid rgba(157, 63, 255, 0.5);
    background: var(--surface);
    box-shadow: 0 0 30px rgba(157, 63, 255, 0.4);
    animation: pulseRing 3s infinite;
}

.hero-info {
    flex: 1;
    z-index: 2;
}

.hero-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.hero-title h1 {
    margin: 0;
    font-family: var(--font-head);
    font-size: 2.2rem;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.hero-tag {
    color: var(--gold);
    font-size: 1.4rem;
}

.hero-desc {
    color: var(--text);
    font-size: 1rem;
    max-width: 600px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.hero-meta {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    gap: 20px;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2;
}

/* --- Profile Page Layout --- */
.profile-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    align-items: start;
}
.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.profile-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* --- Dashboard Stats (clan_profile.php) --- */
.stats-dash {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 0;
}

.dash-card {
    background: rgba(26, 14, 46, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--r-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, background 0.2s;
}

.dash-card:hover {
    transform: translateY(-3px);
    background: rgba(26, 14, 46, 0.6);
    border-color: rgba(157, 63, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.dash-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(157, 63, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    flex-shrink: 0;
}

.dash-info {
    flex: 1;
}

.dash-lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 4px;
}

.dash-val {
    font-family: var(--font-head);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.dash-val.hot { color: var(--hot); text-shadow: 0 0 15px rgba(212, 160, 255, 0.4); }

/* SVG Circle Progress */
.circular-progress {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.circular-progress svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.circle-bg {
    fill: none;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 4;
}
.circle-fill {
    fill: none;
    stroke: url(#gradient-wr);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}
.circle-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
}

/* --- Player Grid --- */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.player-card {
    background: rgba(26, 14, 46, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--r);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.player-card:hover {
    transform: translateY(-3px);
    border-color: rgba(157, 63, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.pcard-role-strip {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}
.role-strip-2 { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.role-strip-1 { background: var(--silver); box-shadow: 0 0 10px var(--silver); }
.role-strip-0 { background: var(--faint); }

.pcard-main {
    padding: 16px 20px 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.pcard-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pcard-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    transition: color 0.2s;
}
.pcard-name:hover { color: var(--hot); }

.pcard-role {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pcard-rating {
    text-align: right;
}
.pcard-rating-val {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--hot);
}
.pcard-rating-lbl {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
}

.pcard-stats {
    padding: 12px 20px 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.pcard-stat-item {
    font-size: 0.85rem;
    color: var(--muted);
}
.pcard-stat-item span { color: var(--text); font-weight: 600; margin-left: 4px; }

.pcard-actions {
    padding: 10px 20px 10px 24px;
    background: rgba(0,0,0,0.4);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Timeline (History) --- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeline-item {
    display: flex;
    align-items: center;
    background: rgba(26, 14, 46, 0.4);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--r);
    padding: 16px 20px;
    border-left: 4px solid var(--faint);
}
.timeline-item.win { border-left-color: var(--positive); background: linear-gradient(90deg, rgba(79, 255, 176, 0.05), rgba(26, 14, 46, 0.4)); }
.timeline-item.loss { border-left-color: var(--negative); background: linear-gradient(90deg, rgba(255, 79, 123, 0.05), rgba(26, 14, 46, 0.4)); }

.tl-date {
    width: 140px;
    font-size: 0.85rem;
    color: var(--muted);
}

.tl-result {
    width: 100px;
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 700;
}
.tl-result.win { color: var(--positive); }
.tl-result.loss { color: var(--negative); }

.tl-match {
    flex: 1;
    font-size: 1rem;
    color: #fff;
}
.tl-match .tag-win { color: var(--accent); font-weight: 700; }
.tl-match .tag-loss { color: var(--muted); }

.tl-points {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
}
.tl-points.win { color: var(--positive); }
.tl-points.loss { color: var(--negative); }

/* --- Animations --- */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 10px rgba(255, 215, 0, 0.2); }
    to { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(157, 63, 255, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(157, 63, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(157, 63, 255, 0); }
}

/* Responsive */
@media (max-width: 768px) {

    /* --- Leaderboard cards --- */
    .clan-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px;
        overflow: hidden;
        box-sizing: border-box;
        width: 100%;
    }
    .card-rank { width: auto; }
    .card-logo { margin: 0; }
    .card-info { align-items: center; min-width: 0; width: 100%; }

    /* Назва + тег + бейдж — переносяться */
    .card-title {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    .card-name {
        font-size: 1rem;
        word-break: break-word;
        max-width: 100%;
    }
    .card-tag { font-size: 0.95rem; }
    .league-badge { font-size: 0.7rem; }

    .card-meta {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    /* Stats блок — стає вертикальним стовпцем */
    .card-stats {
        margin-left: 0;
        margin-top: 4px;
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    /* Lvl + прогрес-бар — на мобільному на всю ширину */
    .stat-lvl-pill {
        width: 100%;
        max-width: 280px;
        box-sizing: border-box;
    }
    .stat-lvl-xp {
        white-space: normal;
        word-break: break-all;
    }

    /* Winrate bar */
    .stat-winrate { gap: 8px; }
    .wr-bar-bg { width: 80px; }
    .wr-val { font-size: 0.9rem; }

    /* MMR */
    .stat-mmr { align-items: center; }
    .stat-mmr-val { font-size: 1.2rem; }

    /* --- Hero banner (clan_profile.php) --- */
    .hero-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px 16px;
        gap: 16px;
        overflow: hidden;
        box-sizing: border-box;
    }
    .hero-logo { width: 72px; height: 72px; }

    /* Назва + тег + бейдж + опис — всі переносяться */
    .hero-title {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        flex-direction: column;
        align-items: center;
    }
    .hero-title h1 {
        font-size: 1.5rem !important;
        word-break: break-word;
        text-align: center;
    }
    .hero-tag { font-size: 1.1rem !important; }
    .hero-desc {
        font-size: 0.9rem !important;
        max-width: 100% !important;
        text-align: center;
        word-break: break-word;
    }
    .hero-meta {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Lvl + xp бар в hero --- не виїжджає */
    .hero-info > div[style] {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    /* Lvl box — 100% ширини */
    .hero-info div[style*="width: 300px"] {
        width: 100% !important;
        max-width: 300px !important;
        box-sizing: border-box !important;
    }

    /* --- Timeline --- */
    .timeline-item {
        flex-wrap: wrap;
        gap: 10px;
    }
    .tl-date, .tl-result { width: 50%; }
    .tl-match { width: 100%; text-align: center; order: -1; font-size: 1rem; margin-bottom: 5px; }

    /* --- Profile layout --- */
    .profile-layout {
        grid-template-columns: 1fr;
    }

    /* --- Player grid --- */
    .player-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Settings Panel & Forms --- */
.manage-btn {
    background: rgba(157, 63, 255, 0.15);
    border: 1px solid rgba(157, 63, 255, 0.4);
    color: var(--glow);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.2s;
    margin-left: auto;
}
.manage-btn:hover {
    background: rgba(157, 63, 255, 0.3);
    box-shadow: 0 0 12px rgba(157, 63, 255, 0.3);
}
.settings-panel {
    display: none;
    background: rgba(10, 5, 20, 0.95);
    border: 1px solid var(--faint);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.settings-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-group input, .form-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: var(--accent);
}
.save-btn {
    background: linear-gradient(135deg, rgba(157,63,255,.88), rgba(115,53,207,.88));
    border: 1px solid rgba(185,106,255,.26);
    color: #fff;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-head);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: all 0.2s;
}
.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(115,53,207,.2);
}
.status-msg {
    margin-top: 10px;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 6px;
    display: none;
}
.status-msg.success { background: rgba(79, 255, 176, 0.1); color: var(--positive); border: 1px solid rgba(79, 255, 176, 0.3); }
.status-msg.error { background: rgba(255, 79, 123, 0.1); color: var(--negative); border: 1px solid rgba(255, 79, 123, 0.3); }
