/**
 * Fall of Aden — Upgrade CSS
 * Supplementary styles for PvP, Olympiad, Inventory, Clan, Activity, Leaderboard pages
 * Base styles in foa-accounts.css
 */

/* ── Page Headers ──────────────────────────────────────── */
.foa-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.foa-page-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--heading);
    margin: 0;
}

/* ── Character Selector ────────────────────────────────── */
.foa-char-selector {
    background: var(--surface);
    border: 1px solid var(--border-gold);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: var(--foa-radius);
    font-size: 0.875rem;
    cursor: pointer;
}

.foa-char-selector:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

/* ── PvP Rank Badges ───────────────────────────────────── */
.foa-pvp-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.foa-rank-recruit { color: #6b7280; }
.foa-rank-fighter { color: #22c55e; }
.foa-rank-warrior { color: #3b82f6; }
.foa-rank-gladiator { color: #a855f7; }
.foa-rank-commander { color: #ef4444; }
.foa-rank-warlord { color: var(--gold); }
.foa-rank-legend {
    color: var(--gold);
    animation: foa-legend-glow 2s ease-in-out infinite;
}

@keyframes foa-legend-glow {
    0%, 100% { filter: drop-shadow(0 0 6px var(--gold-glow)); }
    50% { filter: drop-shadow(0 0 16px var(--gold)); }
}

/* ── PvP/PK/Win/Loss Badges ────────────────────────────── */
.foa-badge-pvp {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.foa-badge-pk {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.foa-badge-win {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.foa-badge-loss {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── Charts ────────────────────────────────────────────── */
.foa-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.foa-chart-card {
    background: var(--surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--foa-radius-lg);
    padding: 1.25rem;
}

.foa-chart-card-full {
    grid-column: 1 / -1;
}

.foa-chart-header {
    margin-bottom: 1rem;
}

.foa-chart-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--heading);
    margin: 0;
}

.foa-chart-container {
    width: 100%;
    height: 280px;
}

/* ── Stat Icon Colors ──────────────────────────────────── */
.foa-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--foa-radius);
    background: var(--surface-elevated);
    color: var(--gold);
    flex-shrink: 0;
}

.foa-pvp-icon {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

.foa-pk-icon {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
}

.foa-streak-icon {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.foa-win-icon {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.1);
}

.foa-loss-icon {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
}

/* ── Hero Badge ────────────────────────────────────────── */
.foa-stat-hero {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--surface), rgba(212, 168, 67, 0.1));
}

.foa-hero-badge {
    color: var(--gold);
    animation: foa-legend-glow 2s ease-in-out infinite;
}

/* ── Search Input ──────────────────────────────────────── */
.foa-search-wrap {
    position: relative;
}

.foa-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.foa-search-input {
    background: var(--surface);
    border: 1px solid var(--border-gold);
    color: var(--text);
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border-radius: var(--foa-radius);
    font-size: 0.875rem;
    width: 200px;
}

.foa-search-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold-glow);
}

/* ── Paper Doll (Inventory) ────────────────────────────── */
.foa-paperdoll {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: repeat(7, auto);
    gap: 0.5rem;
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--foa-radius-lg);
    position: relative;
}

.foa-paperdoll::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(212, 168, 67, 0.03) 0%, transparent 70%);
    pointer-events: none;
    border-radius: var(--foa-radius-lg);
}

.foa-paperdoll-slot {
    width: 56px;
    height: 56px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-dark);
    border-radius: var(--foa-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.foa-paperdoll-slot:hover {
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.foa-paperdoll-slot[data-enchant] .foa-slot-enchant {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 3px;
    border-radius: 3px;
    background: var(--gold);
    color: #000;
}

.foa-paperdoll-slot.foa-enchant-high {
    border-color: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

.foa-paperdoll-slot.foa-enchant-epic {
    border-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.foa-slot-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.foa-slot-icon {
    width: 40px;
    height: 40px;
    opacity: 0.3;
}

.foa-paperdoll-slot[data-item-id] .foa-slot-icon {
    opacity: 1;
}

.foa-paperdoll-slot .foa-slot-empty {
    color: var(--muted);
    opacity: 0.3;
}

/* Paper doll grid layout */
.foa-pd-hair { grid-column: 2; grid-row: 1; justify-self: center; }
.foa-pd-head { grid-column: 2; grid-row: 2; justify-self: center; }
.foa-pd-neck { grid-column: 3; grid-row: 2; }
.foa-pd-rear { grid-column: 1; grid-row: 3; }
.foa-pd-lear { grid-column: 3; grid-row: 3; }
.foa-pd-chest { grid-column: 2; grid-row: 3; justify-self: center; }
.foa-pd-rhand { grid-column: 1; grid-row: 4; }
.foa-pd-lhand { grid-column: 3; grid-row: 4; }
.foa-pd-gloves { grid-column: 2; grid-row: 4; justify-self: center; }
.foa-pd-legs { grid-column: 2; grid-row: 5; justify-self: center; }
.foa-pd-rfinger { grid-column: 1; grid-row: 5; }
.foa-pd-lfinger { grid-column: 3; grid-row: 5; }
.foa-pd-feet { grid-column: 2; grid-row: 6; justify-self: center; }
.foa-pd-cloak { grid-column: 2; grid-row: 7; justify-self: center; }

/* ── Inventory Grid ────────────────────────────────────── */
.foa-inventory-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.foa-inv-tab {
    padding: 0.5rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--foa-radius);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.foa-inv-tab:hover {
    border-color: var(--gold);
    color: var(--text);
}

.foa-inv-tab.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    font-weight: 600;
}

.foa-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 0.5rem;
}

.foa-item-card {
    width: 64px;
    height: 64px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-dark);
    border-radius: var(--foa-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.foa-item-card:hover {
    border-color: var(--gold);
}

.foa-item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.6rem;
    color: var(--gold-light);
}

/* ── Clan Panel ────────────────────────────────────────── */
.foa-clan-overview {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--foa-radius-lg);
    margin-bottom: 1.5rem;
}

.foa-clan-crest {
    width: 64px;
    height: 64px;
    border-radius: var(--foa-radius);
    border: 2px solid var(--border-gold);
    background: var(--surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.foa-clan-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.foa-clan-info h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    color: var(--heading);
    margin: 0 0 0.5rem;
}

.foa-clan-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.foa-clan-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.foa-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.foa-online-dot.online {
    background: var(--foa-green);
    box-shadow: 0 0 6px var(--foa-green);
}

.foa-online-dot.offline {
    background: var(--muted);
}

.foa-no-clan {
    text-align: center;
    padding: 3rem;
}

.foa-no-clan svg {
    color: var(--muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.foa-no-clan p {
    color: var(--muted);
    font-size: 1rem;
}

/* ── Activity Log ──────────────────────────────────────── */
.foa-badge-web {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.foa-badge-game {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.foa-badge-launcher {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.foa-badge-success {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.foa-badge-fail {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.foa-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.foa-session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border-dark);
    border-radius: var(--foa-radius);
}

.foa-session-item.foa-session-current {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--surface-elevated), rgba(212, 168, 67, 0.05));
}

.foa-session-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.foa-session-device {
    font-weight: 600;
    color: var(--text);
}

.foa-session-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.foa-btn-revoke {
    padding: 0.35rem 0.75rem;
    background: transparent;
    border: 1px solid var(--red-bright);
    color: var(--red-bright);
    border-radius: var(--foa-radius);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.foa-btn-revoke:hover {
    background: var(--red-bright);
    color: #fff;
}

/* ── Leaderboard ───────────────────────────────────────── */
.foa-leaderboard {
    max-width: 1000px;
    margin: 0 auto;
}

.foa-leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.foa-lb-tab {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--foa-radius);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s;
}

.foa-lb-tab:hover {
    border-color: var(--gold);
    color: var(--text);
}

.foa-lb-tab.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    font-weight: 600;
}

.foa-lb-rank {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--gold);
    width: 40px;
    text-align: center;
}

.foa-lb-rank-1 {
    color: #ffd700;
    font-size: 1.2rem;
}

.foa-lb-rank-2 {
    color: #c0c0c0;
    font-size: 1.1rem;
}

.foa-lb-rank-3 {
    color: #cd7f32;
    font-size: 1.05rem;
}

.foa-lb-login-prompt {
    text-align: center;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border-gold);
    border-radius: var(--foa-radius-lg);
    margin-top: 1.5rem;
}

.foa-lb-login-prompt a {
    color: var(--gold);
    text-decoration: underline;
}

/* ── Empty States ──────────────────────────────────────── */
.foa-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
}

.foa-empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.foa-empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

/* ── Table Character Name ──────────────────────────────── */
.foa-table-char {
    font-weight: 600;
    color: var(--text);
}

.foa-table-char:hover {
    color: var(--gold);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .foa-charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .foa-stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .foa-paperdoll {
        max-width: 100%;
        padding: 1rem;
    }

    .foa-clan-overview {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .foa-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
