/* ================================================================
   DIAMOND KALONLINE — ULTRA PREMIUM RANKING SYSTEM
   Author: Diamond Dev Team
   Version: 3.0 — Glassmorphism Elite Edition
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --diamond: #00d4ff;
    --diamond-dim: rgba(0, 212, 255, 0.15);
    --gold: #d4a855;
    --gold-dim: rgba(212, 168, 85, 0.15);
    --silver: #b0c4de;
    --bronze: #cd7f32;
    --dark: #04070c;
    --dark2: #080d18;
    --glass: rgba(10, 16, 30, 0.65);
    --glass-light: rgba(255, 255, 255, 0.04);
    --border: rgba(0, 212, 255, 0.1);
    --text: #c8d8f0;
    --rank1-color: #ffd700;
    --rank2-color: #c0c0c0;
    --rank3-color: #cd7f32;
}

/* ================================================================
   BASE CONTAINER
================================================================ */
.ranking-container {
    width: 100%;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    position: relative;
}

/* ================================================================
   HEADER + SEARCH
================================================================ */
.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    background: rgba(0, 212, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px 0 16px 0;
    position: relative;
    overflow: hidden;
}
.ranking-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--diamond), var(--gold), var(--diamond), transparent);
    animation: shimmer-line 3s linear infinite;
}
@keyframes shimmer-line {
    0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.4; }
}

.ranking-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(212, 168, 85, 0.4);
}
.ranking-title svg { filter: drop-shadow(0 0 6px var(--gold)); }

.search-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 10px 0 10px 0;
    padding: 0.65rem 1.3rem 0.65rem 2.8rem;
    color: #fff;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    width: 240px;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.85rem center;
}
.search-input:focus {
    border-color: var(--diamond);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1), 0 0 20px rgba(0, 212, 255, 0.15);
    background-color: rgba(0, 0, 0, 0.6);
}
.search-input::placeholder { color: rgba(200, 216, 240, 0.35); }

/* ================================================================
   TOP 4 CHAMPION CARDS
================================================================ */
.top-classes-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}

.top-card {
    position: relative;
    padding: 1.5rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.8rem;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 16px 0 16px 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    cursor: default;
}
.top-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top, rgba(0, 212, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
}
.top-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0;
    transition: opacity 0.4s;
}
.top-card:hover { transform: translateY(-8px) scale(1.02); }
.top-card:hover::after { opacity: 0.6; }

.tc-knight  { border-color: rgba(180, 140, 60, 0.25); color: var(--gold); }
.tc-knight:hover  { box-shadow: 0 20px 50px rgba(180, 140, 60, 0.2), 0 0 0 1px rgba(180, 140, 60, 0.3); }
.tc-archer  { border-color: rgba(60, 200, 100, 0.25); color: #3dc864; }
.tc-archer:hover  { box-shadow: 0 20px 50px rgba(60, 200, 100, 0.2), 0 0 0 1px rgba(60, 200, 100, 0.3); }
.tc-mage    { border-color: rgba(150, 80, 255, 0.25); color: #a855f7; }
.tc-mage:hover    { box-shadow: 0 20px 50px rgba(150, 80, 255, 0.2), 0 0 0 1px rgba(150, 80, 255, 0.3); }
.tc-thief   { border-color: rgba(255, 60, 60, 0.25); color: #ef4444; }
.tc-thief:hover   { box-shadow: 0 20px 50px rgba(255, 60, 60, 0.2), 0 0 0 1px rgba(255, 60, 60, 0.3); }

.tc-img-container {
    position: relative;
    width: 90px; height: 90px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border-radius: 12px 0 12px 0;
    overflow: hidden;
    border: 1px solid currentColor;
    opacity: 0.9;
}
.tc-img-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.6) 100%);
    pointer-events: none; z-index: 1;
}

.tc-char-img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.5s ease;
    filter: saturate(1.1) contrast(1.05);
}
.top-card:hover .tc-char-img { transform: scale(1.08); }

.tc-info { width: 100%; }

.tc-title {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: currentColor;
    margin-bottom: 0.6rem;
    opacity: 0.9;
}
.tc-detail {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    padding: 0 0.5rem;
}
.tc-label { color: rgba(200, 216, 240, 0.45); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; }
.tc-val { color: #fff; font-weight: 600; }
.tc-val-lvl { color: currentColor; font-weight: 800; font-family: 'Cinzel', serif; font-size: 1rem; }

/* ================================================================
   LIST SCROLL WRAPPER
================================================================ */
.list-scroll-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 680px;
    overflow-y: auto;
    padding-right: 6px;
    scroll-behavior: smooth;
}
.list-scroll-wrapper::-webkit-scrollbar { width: 4px; }
.list-scroll-wrapper::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 4px; }
.list-scroll-wrapper::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--diamond), var(--gold)); border-radius: 4px; }

/* ================================================================
   PLAYER ROW — MAIN DESIGN
================================================================ */
.qigong-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1.2rem;
    background: rgba(8, 13, 24, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.qigong-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--diamond);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.3s ease;
    border-radius: 0 2px 2px 0;
}
.qigong-row:hover {
    background: rgba(0, 212, 255, 0.05);
    border-color: rgba(0, 212, 255, 0.2);
    transform: translateX(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(0, 212, 255, 0.03);
}
.qigong-row:hover::before { transform: scaleY(1); }

/* TOP 3 SPECIAL */
.top-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(8, 13, 24, 0.8));
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.08), inset 0 0 30px rgba(255, 215, 0, 0.03);
    animation: top1-pulse 4s ease-in-out infinite;
}
.top-1::before { background: var(--rank1-color); transform: scaleY(1); }

.top-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.07), rgba(8, 13, 24, 0.8));
    border-color: rgba(192, 192, 192, 0.25);
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.05);
}
.top-2::before { background: var(--rank2-color); transform: scaleY(1); }

.top-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.07), rgba(8, 13, 24, 0.8));
    border-color: rgba(205, 127, 50, 0.25);
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.05);
}
.top-3::before { background: var(--rank3-color); transform: scaleY(1); }

@keyframes top1-pulse {
    0%,100% { box-shadow: 0 0 30px rgba(255,215,0,0.08), inset 0 0 30px rgba(255,215,0,0.03); }
    50% { box-shadow: 0 0 50px rgba(255,215,0,0.15), inset 0 0 50px rgba(255,215,0,0.06); }
}

/* ================================================================
   ROW COLUMNS
================================================================ */
.col-rank { width: 52px; flex-shrink: 0; display:flex; align-items:center; justify-content:center; }

.normal-rank {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(200, 216, 240, 0.35);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.05);
    clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
    background: rgba(255,255,255,0.02);
}

/* ---- CSS-ONLY ELITE RANK BADGES ---- */
.rank-badge {
    position: relative;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: transform 0.3s;
}
.rank-badge-1 {
    background: linear-gradient(135deg, #b8860b, #ffd700, #b8860b);
    color: #3d2600;
    box-shadow: 0 0 15px rgba(255,215,0,0.5);
    animation: badge-pulse-gold 2.5s ease-in-out infinite;
}
.rank-badge-2 {
    background: linear-gradient(135deg, #778899, #dce8f5, #778899);
    color: #1a2030;
    box-shadow: 0 0 12px rgba(192,192,192,0.4);
    animation: badge-pulse-silver 3s ease-in-out infinite;
}
.rank-badge-3 {
    background: linear-gradient(135deg, #7c4a00, #cd7f32, #7c4a00);
    color: #3d1a00;
    box-shadow: 0 0 12px rgba(205,127,50,0.4);
    animation: badge-pulse-bronze 3.5s ease-in-out infinite;
}
.rank-badge::after {
    content: '';
    position: absolute;
    inset: 3px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, transparent 50%);
    pointer-events: none;
}
.qigong-row:hover .rank-badge { transform: scale(1.1); }
@keyframes badge-pulse-gold   { 0%,100%{box-shadow:0 0 15px rgba(255,215,0,0.5)} 50%{box-shadow:0 0 25px rgba(255,215,0,0.8)} }
@keyframes badge-pulse-silver { 0%,100%{box-shadow:0 0 12px rgba(192,192,192,0.4)} 50%{box-shadow:0 0 20px rgba(192,192,192,0.7)} }
@keyframes badge-pulse-bronze { 0%,100%{box-shadow:0 0 12px rgba(205,127,50,0.4)} 50%{box-shadow:0 0 20px rgba(205,127,50,0.7)} }

.col-icon {
    width: 48px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.magic-glow {
    position: absolute;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,255,0.2) 0%, transparent 70%);
    animation: icon-pulse 3s ease-in-out infinite;
}
@keyframes icon-pulse { 0%,100%{transform:scale(0.8);opacity:0.5} 50%{transform:scale(1.2);opacity:1} }

.magic-ring {
    position: absolute;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.25);
    animation: ring-spin 6s linear infinite;
}
@keyframes ring-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

.class-img {
    width: 38px; height: 38px;
    object-fit: contain;
    position: relative; z-index: 2;
    filter: drop-shadow(0 0 6px rgba(0,212,255,0.4));
    transition: filter 0.3s;
}
.qigong-row:hover .class-img { filter: drop-shadow(0 0 12px rgba(0,212,255,0.7)); }

.col-name-spec { flex: 2; min-width: 0; }
.p-name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}
.qigong-row:hover .p-name { color: var(--diamond); }
.top-1 .p-name { color: var(--rank1-color) !important; text-shadow: 0 0 10px rgba(255,215,0,0.4); }

.p-spec {
    display: block;
    font-size: 0.7rem;
    color: rgba(0, 212, 255, 0.6);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 0.15rem;
    font-weight: 500;
}

.col-stat { flex: 1; min-width: 70px; text-align: center; }
.col-guild { flex: 1; min-width: 80px; text-align: center; }
.col-exp { flex: 1.8; min-width: 120px; }
.col-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 60px;
    flex-shrink: 0;
}

.stat-label {
    display: block;
    font-size: 0.6rem;
    color: rgba(200, 216, 240, 0.3);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.25rem;
}
.stat-val {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--diamond);
    text-shadow: 0 0 8px rgba(0,212,255,0.3);
    letter-spacing: 1px;
}
.top-1 .stat-val { color: var(--rank1-color); text-shadow: 0 0 10px rgba(255,215,0,0.4); }

/* ================================================================
   GUILD BADGE
================================================================ */
.guild-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(0, 212, 255, 0.07);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 6px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(0, 212, 255, 0.8);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}
.qigong-row:hover .guild-badge {
    background: rgba(0, 212, 255, 0.12);
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--diamond);
}
.guild-none {
    background: transparent;
    border-color: rgba(255,255,255,0.05);
    color: rgba(200,216,240,0.2);
}

/* ================================================================
   STATUS DOT
================================================================ */
.status-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    position: relative;
}
.status-online {
    background: #00ff88;
    box-shadow: 0 0 6px #00ff88, 0 0 12px rgba(0,255,136,0.4);
    animation: online-blink 2s ease-in-out infinite;
}
.status-online::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(0,255,136,0.15);
    animation: online-ring 2s ease-in-out infinite;
}
@keyframes online-blink { 0%,100%{opacity:1} 50%{opacity:0.6} }
@keyframes online-ring { 0%{transform:scale(1);opacity:0.6} 100%{transform:scale(2.5);opacity:0} }
.status-offline {
    background: rgba(200, 216, 240, 0.15);
    border: 1px solid rgba(200,216,240,0.1);
}

/* ================================================================
   EXP BOXES — PREMIUM STYLE
================================================================ */
.exp-text {
    font-size: 0.63rem;
    color: rgba(200, 216, 240, 0.4);
    margin-bottom: 0.35rem;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.exp-boxes {
    display: flex;
    gap: 2px;
    align-items: center;
}
.exp-box {
    flex: 1;
    height: 8px;
    border-radius: 2px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.exp-box.filled {
    background: linear-gradient(90deg, rgba(0,212,255,0.6), var(--diamond));
    border-color: rgba(0,212,255,0.5);
    box-shadow: 0 0 6px rgba(0,212,255,0.4);
}
.exp-box.filled::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: exp-shine 2s linear infinite;
}
@keyframes exp-shine { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }
.exp-box.charging {
    background: rgba(0,212,255,0.2);
    border-color: rgba(0,212,255,0.3);
    animation: exp-charge 1s ease-in-out infinite;
}
@keyframes exp-charge { 0%,100%{opacity:1} 50%{opacity:0.4} }
.qigong-row:hover .exp-box.filled {
    box-shadow: 0 0 10px rgba(0,212,255,0.6);
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1024px) {
    .top-classes-wrapper { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .col-exp, .col-guild { display: none; }
    .top-classes-wrapper { grid-template-columns: repeat(2, 1fr); }
    .qigong-row { padding: 0.65rem 0.8rem; gap: 0.5rem; }
}
@media (max-width: 480px) {
    .top-classes-wrapper { grid-template-columns: 1fr; }
    .col-status { display: none; }
    .search-input { width: 100%; }
    .ranking-header { flex-direction: column; align-items: flex-start; }
}
/* ============================================================
   MOBILE RANKING FIX (FLEXBOX SCROLL)
============================================================ */
@media (max-width: 900px) {
    /* 1. إجبار الأعمدة المخفية (الخبرة، الجيلد، الحالة) على الظهور */
    .col-exp, 
    .col-guild { 
        display: block !important; 
    }
    .col-status { 
        display: flex !important; 
    }

    /* 2. إضافة السحب الأفقي للحاوية اللي شايلة اللاعبين */
    .list-scroll-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch; /* بيخلي السحب ناعم جداً على الموبايل */
        padding-bottom: 15px !important; /* مساحة لشريط السحب */
    }

    /* 3. إعطاء الصف عرض أدنى عشان العناصر متدخلش في بعضها ويشتغل السكرول */
    .qigong-row {
        min-width: 750px !important; /* لو حسيت إن الكلام لسه زنق، كبر الرقم ده لـ 800px */
    }
}