/* ========================================
   OpenClaw Mines - Social Features CSS
   Leaderboard, Profiles, Friends, Achievements
   ======================================== */

/* ========================================
   Header Buttons
   ======================================== */

.header-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 6px 10px;
    background: linear-gradient(180deg, #5d4c36 0%, #3d2c16 100%);
    border: 2px solid var(--border-dark);
    border-radius: 2px;
    color: var(--text-white);
    cursor: pointer;
    margin-right: 8px;
    transition: all 0.1s;
}

.header-btn:hover {
    background: linear-gradient(180deg, #6d5c46 0%, #4d3c26 100%);
    color: var(--text-yellow);
    border-color: var(--border-gold);
}

.header-btn:active {
    background: linear-gradient(180deg, #3d2c16 0%, #5d4c36 100%);
}

/* ========================================
   OSRS Panel Base
   ======================================== */

.osrs-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-height: 80vh;
    background: linear-gradient(180deg, #4a3d2a 0%, #3d3020 50%, #2d2418 100%);
    border: 4px solid #1a1208;
    border-radius: 4px;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 8px 32px rgba(0,0,0,0.8);
    z-index: 1000;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.osrs-panel.hidden {
    display: none;
}

.osrs-panel.sub-panel {
    width: 300px;
    left: calc(50% + 230px);
    z-index: 1001;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #5d4c36 0%, #4d3c26 100%);
    border-bottom: 3px solid #1a1208;
}

.panel-icon {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
    font-size: 16px;
}

.panel-header h2 {
    flex: 1;
    font-size: 10px;
    color: var(--text-orange);
    text-shadow: 1px 1px 0 #000;
}

.panel-close {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    width: 24px;
    height: 24px;
    background: linear-gradient(180deg, #8b2d2d 0%, #5a1d1d 100%);
    border: 2px solid #3a0d0d;
    border-radius: 2px;
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.panel-close:hover {
    background: linear-gradient(180deg, #ab3d3d 0%, #7a2d2d 100%);
}

/* ========================================
   Leaderboard Panel
   ======================================== */

#leaderboard-panel {
    width: 480px;
}

.leaderboard-tabs {
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border-bottom: 2px solid #1a1208;
}

.tab-group {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.tab-group:last-child {
    margin-bottom: 0;
}

.lb-tab,
.view-tab {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 6px 10px;
    background: linear-gradient(180deg, #3d2c16 0%, #2d1c06 100%);
    border: 2px solid var(--border-dark);
    border-radius: 2px;
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.1s;
}

.lb-tab:hover,
.view-tab:hover {
    background: linear-gradient(180deg, #4d3c26 0%, #3d2c16 100%);
    border-color: var(--border-gold);
}

.lb-tab.active,
.view-tab.active {
    background: linear-gradient(180deg, #5d4c36 0%, #4d3c26 100%);
    color: var(--text-yellow);
    border-color: var(--border-gold);
}

.tab-icon {
    font-size: 10px;
}

.leaderboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lb-header-row {
    display: flex;
    padding: 8px 12px;
    background: linear-gradient(180deg, #3d3426 0%, #2d2418 100%);
    border-bottom: 2px solid #1a1208;
    font-size: 6px;
    color: var(--text-orange);
    text-shadow: 1px 1px 0 #000;
}

.lb-entries {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
}

.lb-entry {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(26, 18, 8, 0.5);
    cursor: pointer;
    transition: background 0.1s;
}

.lb-entry:hover {
    background: rgba(255,255,255,0.05);
}

.lb-entry.is-me {
    background: rgba(0, 255, 0, 0.1);
    border-left: 3px solid var(--text-green);
}

.lb-entry.highlight {
    animation: entry-highlight 2s ease-out;
}

@keyframes entry-highlight {
    0% { background: rgba(255, 255, 0, 0.4); }
    100% { background: rgba(0, 255, 0, 0.1); }
}

.lb-col {
    font-size: 8px;
    text-shadow: 1px 1px 0 #000;
}

.lb-col.rank {
    width: 40px;
    color: var(--text-white);
}

.lb-col.rank.gold {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.lb-col.rank.silver {
    color: #c0c0c0;
    text-shadow: 0 0 6px rgba(192, 192, 192, 0.5);
}

.lb-col.rank.bronze {
    color: #cd7f32;
    text-shadow: 0 0 6px rgba(205, 127, 50, 0.5);
}

.lb-col.rank.top10 {
    color: var(--text-cyan);
}

.lb-col.rank.top100 {
    color: var(--text-green);
}

.lb-col.name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-yellow);
}

.lb-col.value {
    width: 100px;
    text-align: right;
    color: var(--text-white);
}

.lb-col.value.xmr {
    color: var(--text-orange);
}

.lb-col.value.hashrate {
    color: var(--text-cyan);
}

.lb-col.level {
    width: 40px;
    text-align: right;
    color: var(--text-green);
}

.online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #555;
}

.online-dot.active {
    background: var(--text-green);
    box-shadow: 0 0 4px rgba(0, 255, 0, 0.6);
}

.player-mini-avatar {
    width: 16px;
    height: 16px;
    background: var(--skin, #ffd699);
    border-radius: 50%;
    border: 2px solid var(--tunic, #2d8b4a);
    position: relative;
}

.player-mini-avatar::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 6px;
    background: var(--hair, #654321);
    border-radius: 50% 50% 0 0;
}

.leaderboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0,0,0,0.3);
    border-top: 2px solid var(--border-dark);
}

.player-rank {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rank-label {
    font-size: 7px;
    color: var(--text-white);
    text-shadow: 1px 1px 0 #000;
}

.rank-value {
    font-size: 10px;
    color: var(--text-yellow);
    text-shadow: 1px 1px 0 #000;
}

.lb-loading {
    padding: 40px;
    text-align: center;
}

.loading-pickaxe-small {
    font-size: 24px;
    animation: loading-swing 0.6s ease-in-out infinite alternate;
}

.lb-loading span {
    display: block;
    margin-top: 12px;
    font-size: 8px;
    color: var(--text-yellow);
    text-shadow: 1px 1px 0 #000;
}

/* ========================================
   Friends Panel
   ======================================== */

#friends-panel {
    width: 320px;
    left: calc(50% + 270px);
}

.friends-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border-bottom: 2px solid #1a1208;
}

.friends-tab {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 6px 10px;
    background: linear-gradient(180deg, #3d2c16 0%, #2d1c06 100%);
    border: 2px solid var(--border-dark);
    border-radius: 2px;
    color: var(--text-white);
    cursor: pointer;
    flex: 1;
}

.friends-tab:hover {
    background: linear-gradient(180deg, #4d3c26 0%, #3d2c16 100%);
}

.friends-tab.active {
    background: linear-gradient(180deg, #5d4c36 0%, #4d3c26 100%);
    color: var(--text-yellow);
}

.friends-content {
    flex: 1;
    overflow: hidden;
}

.friends-list {
    max-height: 300px;
    overflow-y: auto;
}

.friend-entry {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(26, 18, 8, 0.5);
    cursor: pointer;
    transition: background 0.1s;
}

.friend-entry:hover {
    background: rgba(255,255,255,0.05);
}

.friend-entry.online {
    background: rgba(0, 255, 0, 0.05);
}

.friend-name {
    flex: 1;
    font-size: 8px;
    color: var(--text-yellow);
    text-shadow: 1px 1px 0 #000;
    margin-left: 8px;
}

.friend-status {
    font-size: 6px;
    color: var(--text-white);
    opacity: 0.6;
    margin-right: 8px;
}

.friend-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.friend-entry:hover .friend-actions {
    opacity: 1;
}

.friend-action-btn {
    font-size: 10px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-dark);
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.friend-action-btn:hover {
    background: rgba(255,255,255,0.1);
}

.friends-empty {
    padding: 40px;
    text-align: center;
}

.empty-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-text {
    font-size: 8px;
    color: var(--text-white);
    opacity: 0.5;
}

.friends-footer {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.3);
    border-top: 2px solid var(--border-dark);
}

#add-friend-input {
    flex: 1;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 8px 10px;
    background: #0a0a0a;
    border: 2px solid var(--border-dark);
    color: var(--text-white);
    outline: none;
}

#add-friend-input:focus {
    border-color: var(--border-light);
}

/* ========================================
   Profile Panel
   ======================================== */

#profile-panel {
    width: 380px;
}

.profile-content {
    padding: 12px;
    overflow-y: auto;
    max-height: 500px;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(26, 18, 8, 0.5);
}

.avatar-display {
    width: 80px;
    height: 100px;
    background: rgba(0,0,0,0.3);
    border: 3px solid var(--border-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.avatar-character {
    position: relative;
    --hair-color: #654321;
    --skin-tone: #ffd699;
    --tunic-color: #2d8b4a;
}

.avatar-character .avatar-body {
    position: relative;
    width: 32px;
    height: 56px;
}

.avatar-character .avatar-shadow {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
    border-radius: 50%;
}

.avatar-character .avatar-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: var(--skin-tone);
    border-radius: 50% 50% 40% 40%;
    box-shadow: inset -3px 0 0 rgba(0,0,0,0.15);
}

.avatar-character .avatar-head::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 12px;
    background: var(--hair-color);
    border-radius: 50% 50% 0 0;
}

.avatar-character .avatar-head::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 3px;
    width: 14px;
    height: 4px;
    background: linear-gradient(90deg, 
        #000 0%, #000 15%, 
        transparent 15%, transparent 35%,
        #000 35%, #000 50%,
        transparent 50%, transparent 100%
    );
}

.avatar-character .avatar-torso {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 20px;
    background: var(--tunic-color);
    border-radius: 3px;
    box-shadow: inset -4px 0 0 rgba(0,0,0,0.15);
}

.avatar-character .avatar-torso::before,
.avatar-character .avatar-torso::after {
    content: '';
    position: absolute;
    top: 3px;
    width: 8px;
    height: 14px;
    background: var(--tunic-color);
    border-radius: 3px;
}

.avatar-character .avatar-torso::before {
    left: -8px;
    box-shadow: inset -2px 0 0 rgba(0,0,0,0.15);
}

.avatar-character .avatar-torso::after {
    right: -8px;
    box-shadow: inset 2px 0 0 rgba(255,255,255,0.1);
}

.avatar-character .avatar-legs {
    position: absolute;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 20px;
    background: linear-gradient(90deg, 
        #5a4632 0%, #5a4632 45%, 
        transparent 45%, transparent 55%, 
        #5a4632 55%, #5a4632 100%
    );
}

.avatar-character.large {
    transform: scale(1.3);
}

.profile-info-section {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(26, 18, 8, 0.5);
}

.profile-name {
    margin-bottom: 8px;
}

.profile-stat {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.profile-label {
    font-size: 7px;
    color: var(--text-white);
    opacity: 0.7;
    text-shadow: 1px 1px 0 #000;
}

.profile-value {
    font-size: 8px;
    color: var(--text-yellow);
    text-shadow: 1px 1px 0 #000;
}

.profile-name .profile-value {
    font-size: 10px;
    color: var(--text-cyan);
}

/* ========================================
   Achievements Section
   ======================================== */

.profile-achievements-section {
    margin-top: 8px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-title {
    font-size: 8px;
    color: var(--text-orange);
    text-shadow: 1px 1px 0 #000;
}

.achievement-count {
    font-size: 7px;
    color: var(--text-green);
    text-shadow: 1px 1px 0 #000;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.achievement-tile {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--border-dark);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: all 0.2s;
    cursor: pointer;
}

.achievement-tile:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--border-gold);
    transform: scale(1.05);
}

.achievement-tile.locked {
    opacity: 0.4;
}

.achievement-tile.locked .achievement-icon {
    filter: grayscale(100%);
}

.achievement-tile.unlocked {
    background: rgba(0, 100, 0, 0.3);
}

/* Rarity colors */
.achievement-tile.common.unlocked {
    border-color: #808080;
}

.achievement-tile.uncommon.unlocked {
    border-color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.achievement-tile.rare.unlocked {
    border-color: #00bfff;
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.3);
}

.achievement-tile.epic.unlocked {
    border-color: #9945ff;
    box-shadow: 0 0 8px rgba(153, 69, 255, 0.3);
}

.achievement-tile.legendary.unlocked {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    animation: legendary-glow 2s ease-in-out infinite;
}

@keyframes legendary-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.6); }
}

.achievement-tile .achievement-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.achievement-tile .achievement-name {
    font-size: 5px;
    color: var(--text-white);
    text-align: center;
    text-shadow: 1px 1px 0 #000;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ========================================
   Achievement Popup (OSRS Style)
   ======================================== */

.achievement-popup {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(180deg, #5d4c36 0%, #3d2c16 100%);
    border: 4px solid #ffd700;
    border-radius: 4px;
    padding: 12px 20px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.5s ease-out;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.5),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.achievement-popup.hidden {
    display: none;
}

.achievement-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.achievement-popup-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.achievement-popup .achievement-icon {
    font-size: 40px;
    animation: icon-bounce 0.5s ease-out;
}

@keyframes icon-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.achievement-popup .achievement-info {
    text-align: left;
}

.achievement-popup .achievement-unlocked {
    font-size: 7px;
    color: var(--text-green);
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 4px;
    animation: text-flash 0.5s ease-in-out infinite alternate;
}

@keyframes text-flash {
    0% { color: var(--text-green); }
    100% { color: var(--text-yellow); }
}

.achievement-popup .achievement-name {
    font-size: 10px;
    color: var(--text-yellow);
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 4px;
}

.achievement-popup .achievement-desc {
    font-size: 7px;
    color: var(--text-white);
    text-shadow: 1px 1px 0 #000;
    opacity: 0.8;
}

/* Firework particles */
.firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--color, #ffff00);
    border-radius: 50%;
    pointer-events: none;
    animation: firework-fly 1s ease-out forwards;
    box-shadow: 0 0 6px var(--color, #ffff00);
}

@keyframes firework-fly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* ========================================
   Avatar Customization Panel
   ======================================== */

#avatar-customization-panel {
    width: 280px;
}

.customization-content {
    padding: 12px;
    overflow-y: auto;
    max-height: 400px;
}

.avatar-preview-section {
    display: flex;
    justify-content: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid rgba(26, 18, 8, 0.5);
}

.avatar-preview {
    width: 100px;
    height: 120px;
    background: 
        repeating-linear-gradient(45deg, #1a1a1a 0px, #1a1a1a 10px, #222 10px, #222 20px);
    border: 3px solid var(--border-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.customization-section {
    margin-bottom: 12px;
}

.section-label {
    display: block;
    font-size: 7px;
    color: var(--text-orange);
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 6px;
}

.option-grid {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.style-option,
.color-option {
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.3);
    border: 2px solid var(--border-dark);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.1s;
}

.style-option:hover,
.color-option:hover {
    border-color: var(--border-gold);
    transform: scale(1.1);
}

.style-option.selected,
.color-option.selected {
    border-color: var(--text-yellow);
    box-shadow: 0 0 8px rgba(255, 255, 0, 0.5);
}

.customization-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.3);
    border-top: 2px solid var(--border-dark);
}

.customization-footer .osrs-btn {
    flex: 1;
}

.osrs-btn.secondary {
    background: linear-gradient(180deg, #4d4d4d 0%, #333333 100%);
}

.osrs-btn.secondary:hover {
    background: linear-gradient(180deg, #5d5d5d 0%, #434343 100%);
}

/* ========================================
   Whisper Chat Style
   ======================================== */

.chat-message.whisper {
    color: #ff66ff;
    font-style: italic;
}

.chat-message.whisper .whisper-label {
    color: #cc33cc;
}

.chat-message.whisper .whisper-text {
    color: #ff99ff;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 900px) {
    .osrs-panel {
        width: calc(100vw - 32px);
        max-width: 400px;
    }
    
    .osrs-panel.sub-panel {
        left: 50%;
        top: auto;
        bottom: 20px;
        transform: translateX(-50%);
    }
    
    #friends-panel {
        left: 50%;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .osrs-panel {
        width: calc(100vw - 16px);
        max-height: 70vh;
    }
    
    .lb-col.value {
        width: 70px;
        font-size: 7px;
    }
    
    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .achievement-tile .achievement-icon {
        font-size: 14px;
    }
}
