@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;800&display=swap');

:root {
    --bg-theme: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --accent: #00f2fe;
    --accent-hover: #4facfe;
    --danger: #ff416c;
    --success: #00e676;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; user-select: none; }

body { background: var(--bg-theme); color: var(--text-main); height: 100vh; overflow: hidden; transition: background 0.5s ease; }

/* 3D Glassmorphism */
.glass-3d {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.4);
    border-left: 1px solid rgba(255,255,255,0.4);
    border-right: 1px solid rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(0,0,0,0.2);
    border-radius: 20px;
    box-shadow: 10px 10px 20px rgba(0,0,0,0.4), 
                -5px -5px 15px rgba(255,255,255,0.05),
                inset 2px 2px 8px rgba(255,255,255,0.15),
                inset -3px -3px 10px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.glass-3d::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
    transform: skewX(-20deg); transition: 0.5s; pointer-events: none;
}
.glass-3d:hover::before { left: 150%; }

.screen { width: 100vw; height: 100vh; position: absolute; top: 0; left: 0; transition: opacity 0.4s; }
.hidden { opacity: 0; pointer-events: none; z-index: -10; display: none !important; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.scrollable { overflow-y: auto; overflow-x: hidden; padding-right: 5px; }
.scrollable::-webkit-scrollbar { width: 8px; }
.scrollable::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 10px; }
.scrollable::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; box-shadow: inset 1px 1px 2px rgba(255,255,255,0.5); }

/* Inputs & Buttons */
.btn {
    padding: 10px 20px; border-radius: 15px; cursor: pointer; text-align: center;
    font-weight: 600; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border-top: 1px solid rgba(255,255,255,0.4); border-left: 1px solid rgba(255,255,255,0.4);
    box-shadow: 4px 4px 10px rgba(0,0,0,0.3), inset 1px 1px 3px rgba(255,255,255,0.2);
    color: #fff; text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.btn:hover { transform: translateY(-3px) scale(1.02); box-shadow: 6px 6px 15px rgba(0,0,0,0.4), inset 2px 2px 5px rgba(255,255,255,0.4); }
.btn:active { transform: translateY(2px); box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); border: none; color: #000; text-shadow: none; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #cc0033); border: none; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 10px; }
.btn-glow { box-shadow: 0 0 15px rgba(0, 242, 254, 0.4), inset 2px 2px 5px rgba(255,255,255,0.5); border: 1px solid var(--accent); color: #fff; }

input {
    width: 100%; padding: 12px 15px; border-radius: 12px;
    background: rgba(0,0,0,0.4); color: #fff; outline: none; font-size: 1rem;
    border: 1px solid rgba(255,255,255,0.1); border-top: 1px solid rgba(0,0,0,0.5); border-left: 1px solid rgba(0,0,0,0.5);
    box-shadow: inset 3px 3px 6px rgba(0,0,0,0.6), inset -2px -2px 4px rgba(255,255,255,0.05);
    transition: 0.3s;
}
input:focus { border-color: var(--accent); box-shadow: inset 3px 3px 6px rgba(0,0,0,0.6), 0 0 12px rgba(0, 242, 254, 0.4); }

.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); border-radius: 34px; transition: .4s; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5); }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; border-radius: 50%; transition: .4s; box-shadow: 2px 2px 5px rgba(0,0,0,0.3); }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(24px); }

/* Layouts */
.auth-box { width: 400px; padding: 40px; text-align: center; }
.logo-title { font-size: 2.2rem; font-weight: 800; margin-bottom: 30px; text-shadow: 2px 2px 5px rgba(0,0,0,0.5); }
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }

.nav-bar { display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; margin: 15px; }
.nav-brand { font-size: 1.5rem; font-weight: 800; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
.nav-links { display: flex; gap: 20px; }
.nav-item { padding: 10px 18px; cursor: pointer; border-radius: 12px; transition: 0.3s; font-weight: 600; background: rgba(0,0,0,0.2); box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3); }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.15); box-shadow: 2px 2px 8px rgba(0,0,0,0.3), inset 1px 1px 2px rgba(255,255,255,0.3); }
.nav-actions { display: flex; align-items: center; gap: 15px; }

#main-content { padding: 0 15px 15px; height: calc(100vh - 100px); }
.tab-content { height: 100%; display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
@keyframes smoothExpand { from { max-height: 0; opacity: 0; } to { max-height: 400px; opacity: 1; } }
@keyframes contentSwap { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }

/* Feed & Sidebar */
.feed-layout { display: grid; grid-template-columns: 1fr 350px; gap: 25px; height: 100%; }
.feed-main { height: 100%; padding-right: 10px; }
.feed-sidebar { display: flex; flex-direction: column; gap: 15px; height: 100%; }
.sidebar-header { padding: 15px; text-align: center; }
.leaderboard-list { flex: 1; padding: 15px; display: flex; flex-direction: column; gap: 12px; }
.animate-swap { animation: contentSwap 0.4s cubic-bezier(0.25, 1, 0.5, 1); }

/* Smooth fade+shrink transition used when swapping displayed card content */
.card-swap-out { opacity: 0; transform: scale(0.96) translateY(6px); transition: opacity 0.18s ease, transform 0.18s ease; }

.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; padding-bottom: 30px; }

/* Posts */
.post-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.post-card:hover { transform: translateY(-8px) scale(1.01); z-index: 10; }
.post-header { display: flex; justify-content: space-between; align-items: center; }
.post-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 5px; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }
.username-hover { cursor: pointer; font-weight: 800; color: #fff; transition: 0.2s; position: relative; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); }
.username-hover:hover { color: var(--accent); }
.post-img-wrapper { width: 100%; aspect-ratio: 1; border-radius: 15px; overflow: hidden; position: relative; box-shadow: inset 3px 3px 10px rgba(0,0,0,0.5); }
.post-img { width: 100%; height: 100%; object-fit: cover; }
.post-price-tag { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.8); padding: 8px 15px; border-radius: 20px; font-weight: 800; backdrop-filter: blur(10px); box-shadow: 2px 2px 8px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.2); }
.strikethrough { text-decoration: line-through; color: var(--danger); font-size: 0.85rem; margin-right: 5px; }

.post-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.post-actions .btn { flex: 1; min-width: 30%; }
.dl-btn { position: relative; }

/* Likes & Tooltips */
.like-container { position: relative; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.like-tooltip { position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.9); padding: 8px 12px; border-radius: 10px; font-size: 0.8rem; white-space: nowrap; pointer-events: none; opacity: 0; transition: 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); z-index: 100; }
.like-container:hover .like-tooltip { opacity: 1; bottom: 140%; }

/* Comments */
.comments-section { display: none; font-size: 0.85rem; border-top: 1px solid rgba(255,255,255,0.2); padding-top: 10px; margin-top: 10px; overflow: hidden; }
.comments-section.open { display: flex; flex-direction: column; animation: smoothExpand 0.4s ease-out; }
.comments-list { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 5px; margin-bottom: 10px; }
.comment-item { display: flex; justify-content: space-between; background: rgba(0,0,0,0.3); padding: 8px 12px; border-radius: 12px; box-shadow: inset 2px 2px 5px rgba(0,0,0,0.4); }
.comment-input-group { display: flex; gap: 8px; }

/* Leaderboard */
.account-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-radius: 15px; cursor: pointer; transition: 0.2s; background: rgba(0,0,0,0.15); box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3); border: 1px solid transparent; }
.account-item:hover { background: rgba(255,255,255,0.1); transform: translateX(5px); border-color: rgba(255,255,255,0.2); box-shadow: 2px 2px 8px rgba(0,0,0,0.3), inset 1px 1px 2px rgba(255,255,255,0.2); }
.user-info-flex { display: flex; align-items: center; gap: 15px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3); }
.status-dot.online { background: #00e676; box-shadow: 0 0 8px #00e676, inset -2px -2px 4px rgba(0,0,0,0.3); }
.offline-time { font-size: 0.75rem; color: var(--text-muted); }
.money-badge { font-family: monospace; font-size: 1.15rem; color: #ffd700; font-weight: 800; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); }

/* Profile Inventory Layout */
.profile-layout { display: grid; grid-template-columns: 400px 1fr; gap: 30px; height: 100%; }
.profile-editor { padding: 30px; height: fit-content; }
.profile-inventory { padding: 10px; }

/* Profile stats row (wealth / items worth right now / items sold) */
.profile-stats-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 25px; }
.profile-stat-card { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; }
.stat-label { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }

/* Themes */
.theme-selectors { display: flex; gap: 20px; margin-top: 20px; }
.selector-group { flex: 1; }
.theme-options { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.theme-circle { width: 35px; height: 35px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; box-shadow: 2px 2px 5px rgba(0,0,0,0.4), inset 2px 2px 5px rgba(255,255,255,0.3); }
.theme-circle:hover, .theme-circle.active { transform: scale(1.15); border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,0.6); }

/* Title toggle input — collapses/expands smoothly instead of a hard show/hide */
.title-collapse { max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.35s ease; }
.title-collapse.open { max-height: 100px; opacity: 1; margin-bottom: 15px; }

/* Modals & Hover Cards */
#hover-card {
    position: fixed; width: 260px; padding: 20px; z-index: 1000; pointer-events: none;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
}
.hover-avatar, .leader-avatar { width: 75px; height: 75px; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); box-shadow: 0 5px 15px rgba(0,0,0,0.4); }
.hover-stat { display: flex; justify-content: space-between; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.1); padding: 8px 0; font-size: 0.9rem; font-weight: 600; }

/* User detail popup — opens when a user is clicked in the Accounts leaderboard.
   Centered on screen so it always has room regardless of where the click came
   from, and scrolls internally (max-height + overflow-y) so large amounts of
   user data are never cut off — they scroll instead of getting clipped. */
.user-detail-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    max-width: 90vw;
    max-height: 75vh;
    padding: 30px;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    cursor: default;
}
.user-detail-popup::-webkit-scrollbar { width: 8px; }
.user-detail-popup::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 10px; }
.user-detail-popup::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; box-shadow: inset 1px 1px 2px rgba(255,255,255,0.5); }

#modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 2000; display: flex; justify-content: center; align-items: center; }
#modal-content { width: 420px; padding: 35px; display: flex; flex-direction: column; gap: 20px; }

/* Toasts */
#toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; flex-direction: column; gap: 15px; }
.toast { background: rgba(10,10,10,0.85); backdrop-filter: blur(15px); padding: 15px 25px; border-radius: 15px; font-weight: 600; color: #fff; border-left: 5px solid var(--accent); box-shadow: 5px 5px 20px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.2); animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.9); } }