/* SYSTEM RESETS & THEME */
:root {
  --bg-dark: #0a0a0c;
  --bg-surface: #121216;
  --bg-surface-hover: #1a1a22;
  --bg-card: #16161c;
  --border-color: #262630;
  --border-color-hover: #3d3d4e;
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --favorite-color: #f59e0b;
  --gold-accent: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --mod-accent: #3b82f6;
  --mod-glow: rgba(59, 130, 246, 0.35);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --sidebar-width: 280px;
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body { background-color: var(--bg-dark); color: var(--text-main); display: flex; min-height: 100vh; overflow-x: hidden; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

@keyframes upvotePop { 0% { transform: scale(1); } 50% { transform: scale(1.35); color: #818cf8; } 100% { transform: scale(1); } }
@keyframes favoritePop { 0% { transform: scale(1); } 50% { transform: scale(1.35); color: var(--favorite-color); } 100% { transform: scale(1); } }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseSelect { 0%, 100% { border-color: var(--accent-primary); box-shadow: 0 0 10px var(--accent-glow); } 50% { border-color: #f59e0b; box-shadow: 0 0 16px var(--gold-glow); } }
@keyframes goldGlowRotate { 0% { box-shadow: 0 0 12px var(--gold-glow), inset 0 0 10px var(--gold-glow); } 50% { box-shadow: 0 0 22px var(--gold-glow), inset 0 0 15px var(--gold-glow); } 100% { box-shadow: 0 0 12px var(--gold-glow), inset 0 0 10px var(--gold-glow); } }
@keyframes modGlowRotate { 0% { box-shadow: 0 0 12px var(--mod-glow), inset 0 0 10px var(--mod-glow); } 50% { box-shadow: 0 0 22px var(--mod-glow), inset 0 0 15px var(--mod-glow); } 100% { box-shadow: 0 0 12px var(--mod-glow), inset 0 0 10px var(--mod-glow); } }

.upvote-pop { animation: upvotePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.favorite-pop { animation: favoritePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.view-animate { animation: viewFadeIn 0.3s ease-out forwards; }

/* LAYOUT & SIDEBAR */
.sidebar { width: var(--sidebar-width); background-color: var(--bg-surface); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; transition: transform var(--transition-smooth); }
.sidebar.closed { transform: translateX(-100%); }
.sidebar-header { height: var(--header-height); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--border-color); }
.brand-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.025em; background: linear-gradient(135deg, #a5b4fc, var(--accent-primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sidebar-content { padding: 20px 12px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 24px; }
.nav-section { display: flex; flex-direction: column; gap: 4px; }
.section-label { font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: var(--text-dim); padding: 0 12px 8px 12px; letter-spacing: 0.05em; }
.nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; background: transparent; border: none; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.95rem; font-weight: 500; transition: all var(--transition-fast); text-align: left; }
.nav-btn:hover { background-color: var(--bg-surface-hover); color: var(--text-main); }
.nav-btn.active { background-color: rgba(99, 102, 241, 0.12); color: #a5b4fc; font-weight: 600; }

.app-main { margin-left: var(--sidebar-width); flex-grow: 1; display: flex; flex-direction: column; min-width: 0; transition: margin-left var(--transition-smooth); }
.app-main.expanded { margin-left: 0; }

.top-header { height: var(--header-height); background-color: rgba(10, 10, 12, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 90; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px; }
.header-left { display: flex; align-items: center; gap: 16px; flex-grow: 1; max-width: 600px; }
.toggle-sidebar-btn { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); width: 40px; height: 40px; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.search-bar-wrap { position: relative; width: 100%; }
.search-input { width: 100%; height: 40px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 0 16px 0 40px; color: var(--text-main); font-size: 0.9rem; outline: none; }
.search-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }

.header-right { display: flex; align-items: center; gap: 12px; }
.sort-dropdown { height: 40px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); border-radius: var(--radius-sm); padding: 0 12px; font-size: 0.88rem; outline: none; cursor: pointer; }
.action-submit-btn { height: 40px; padding: 0 18px; background: var(--accent-primary); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all var(--transition-fast); }
.action-submit-btn:hover { background: var(--accent-hover); box-shadow: 0 4px 12px var(--accent-glow); }
.auth-btn { height: 40px; padding: 0 16px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.auth-btn:hover { border-color: var(--accent-primary); }

.view-container { padding: 28px; max-width: 1600px; margin: 0 auto; width: 100%; }
.view-header { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-end; }
.view-title { font-size: 1.5rem; font-weight: 700; }
.view-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

/* USER BADGES & PFPs */
.pfp-circle { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: var(--bg-card); border: 2px solid var(--border-color); }
.pfp-circle.admin { border: 3px solid var(--gold-accent); animation: goldGlowRotate 2s infinite ease-in-out; }
.pfp-circle.mod { border: 3px solid var(--mod-accent); animation: modGlowRotate 2s infinite ease-in-out; }

.role-badge { font-size: 0.7rem; font-weight: 800; padding: 3px 8px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.05em; display: inline-flex; align-items: center; gap: 4px; }
.role-badge.admin { background: rgba(245, 158, 11, 0.2); border: 1px solid var(--gold-accent); color: #fde68a; }
.role-badge.mod { background: rgba(59, 130, 246, 0.2); border: 1px solid var(--mod-accent); color: #93c5fd; }
.user-id-badge { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; font-weight: 800; font-size: 0.75rem; padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(99, 102, 241, 0.4); margin-left: 6px; }

.post-id-badge { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); border: 1px solid var(--border-color); color: #a5b4fc; font-size: 0.7rem; font-weight: 800; padding: 3px 6px; border-radius: 4px; z-index: 10; pointer-events: none; }

/* PROFILE HEADER CARD */
.profile-header-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 28px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; }
.profile-main-info { display: flex; gap: 24px; align-items: center; }
.profile-details h2 { font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.profile-details p { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; }
.profile-stats-row { display: flex; gap: 16px; margin-top: 14px; }
.profile-stat-box { background: var(--bg-card); border: 1px solid var(--border-color); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; }

/* CROPPER OVERLAY */
.cropper-wrapper { max-height: 350px; width: 100%; background: #000; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px; }
.cropper-view-box, .cropper-face { border-radius: 50% !important; }

/* TAG CLOUD BAR */
.tag-cloud-container { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.tag-cloud-label { font-size: 0.75rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; margin-right: 4px; }
.tag-pill { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted); font-size: 0.8rem; font-weight: 500; padding: 5px 12px; border-radius: 20px; cursor: pointer; transition: all var(--transition-fast); }
.tag-pill:hover { border-color: var(--accent-primary); color: var(--text-main); }
.tag-pill.active { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; font-weight: 600; }

/* HOTKEY SOUNDBOARD DECK (9 SPOTS) */
.hotkey-deck-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 18px; margin-bottom: 24px; }
.hotkey-deck-title { font-size: 0.9rem; font-weight: 700; color: #a5b4fc; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.hotkey-deck-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; }
.hotkey-slot { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px; text-align: center; cursor: pointer; transition: all var(--transition-fast); position: relative; min-height: 80px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
.hotkey-slot:hover { border-color: var(--accent-primary); background: var(--bg-surface-hover); }
.hotkey-slot.waiting { animation: pulseSelect 1s infinite; }
.hotkey-number-badge { font-size: 0.75rem; font-weight: 800; background: rgba(99, 102, 241, 0.2); color: #a5b4fc; padding: 2px 6px; border-radius: 4px; width: fit-content; }
.hotkey-sound-name { font-size: 0.75rem; font-weight: 600; color: #fff; line-height: 1.2; word-break: break-word; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hotkey-clear-btn { position: absolute; top: 4px; right: 4px; background: transparent; border: none; color: var(--text-dim); font-size: 0.7rem; cursor: pointer; }
.hotkey-clear-btn:hover { color: #ef4444; }

/* SOUNDBOARD GRID */
.soundboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.sound-tile { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; transition: border-color var(--transition-fast); position: relative; }
.sound-tile:hover { border-color: var(--accent-primary); }
.sound-tile.selectable { cursor: pointer; border-color: #f59e0b; box-shadow: 0 0 10px var(--gold-glow); }
.sound-tile-title { font-size: 0.95rem; font-weight: 700; color: var(--text-main); line-height: 1.3; }
.sound-play-btn { width: 100%; padding: 10px; background: rgba(99, 102, 241, 0.15); border: 1px solid var(--accent-primary); color: #a5b4fc; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.sound-play-btn:hover { background: var(--accent-primary); color: #fff; }

/* MOD STATS & TABS */
.mod-tabs-nav { display: flex; gap: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; }
.mod-tab-btn { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted); padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-size: 0.88rem; }
.mod-tab-btn.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

.mod-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 0.8rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-main); }
.stat-card.pending .stat-value { color: #f59e0b; }
.stat-card.approved .stat-value { color: #10b981; }

.user-roster-list { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.user-roster-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }

/* MEME GRID & CARDS */
.meme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.meme-card { position: relative; background-color: var(--bg-card); border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border-color); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; transition: border-color var(--transition-fast), transform var(--transition-fast); }
.meme-card:hover { border-color: var(--border-color-hover); transform: translateY(-2px); }
.meme-card.motd-card { border: 2px solid var(--gold-accent); box-shadow: 0 0 16px var(--gold-glow); }
.meme-media { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }

/* CORNER BADGES */
.motd-badge { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); border: 1px solid var(--gold-accent); color: #fde68a; font-size: 0.7rem; font-weight: 700; padding: 4px 8px; border-radius: 6px; pointer-events: none; z-index: 10; display: flex; align-items: center; gap: 4px; }
.video-badge { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); color: #fff; font-size: 0.7rem; padding: 4px 8px; border-radius: 6px; pointer-events: none; z-index: 10; }

.meme-card-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(10,10,12,0.95) 100%); opacity: 0; transition: opacity var(--transition-fast); display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; pointer-events: none; }
.meme-card:hover .meme-card-overlay { opacity: 1; pointer-events: auto; }
.meme-info { text-align: left; }
.meme-title { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.2; word-break: break-word; }
.meme-creator { font-size: 0.8rem; color: #a5b4fc; margin-top: 4px; font-weight: 500; cursor: pointer; }
.meme-creator:hover { text-decoration: underline; }
.meme-meta-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.meme-tags-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag-chip { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; }

.upvote-btn, .favorite-btn, .comment-trigger-btn { background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.1); color: #fff; padding: 6px 12px; border-radius: 20px; cursor: pointer; font-weight: 700; font-size: 0.8rem; display: flex; align-items: center; gap: 6px; transition: background var(--transition-fast); }
.upvote-btn.voted { background: var(--accent-primary); border-color: var(--accent-primary); }
.favorite-btn.favorited { background: var(--favorite-color); border-color: var(--favorite-color); color: #000; }

.download-btn, .admin-card-btn { background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.1); color: #fff; padding: 6px 10px; border-radius: 20px; text-decoration: none; font-size: 0.8rem; cursor: pointer; }
.admin-card-btn.delete { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.5); color: #fca5a5; }
.admin-card-btn.delete:hover { background: #ef4444; color: #fff; }
.admin-card-btn.motd { background: rgba(245, 158, 11, 0.25); border-color: rgba(245, 158, 11, 0.5); color: #fde68a; }
.admin-card-btn.motd:hover { background: #f59e0b; color: #000; }

/* COMMENT SECTION & LIGHTBOX STYLES */
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity var(--transition-fast); }
.lightbox-backdrop.open { opacity: 1; pointer-events: auto; }
.lightbox-wrapper { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); width: 100%; max-width: 900px; max-height: 85vh; display: grid; grid-template-columns: 1fr 340px; overflow: hidden; }
#lightbox-body { background: #000; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.lightbox-content { max-width: 100%; max-height: 85vh; object-fit: contain; }

.comment-section { padding: 20px; display: flex; flex-direction: column; background: var(--bg-surface); border-left: 1px solid var(--border-color); overflow: hidden; }
.comments-list { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.comment-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.comment-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; }
.comment-author { font-weight: 700; color: #a5b4fc; }
.comment-text { font-size: 0.85rem; color: var(--text-main); line-height: 1.35; word-break: break-word; }
.comment-delete-btn { background: transparent; border: none; color: #ef4444; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.comment-delete-btn:hover { text-decoration: underline; }

/* MODALS & PANELS */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity var(--transition-fast); }
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-lg); width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; padding: 28px; position: relative; }
.modal-close-btn { position: absolute; top: 20px; right: 20px; background: transparent; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.form-input, .form-textarea { width: 100%; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text-main); font-size: 0.9rem; }
.form-textarea { resize: vertical; min-height: 80px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); }
.submit-form-btn { width: 100%; padding: 12px; background: var(--accent-primary); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; margin-top: 10px; transition: background var(--transition-fast); }
.submit-form-btn:hover { background: var(--accent-hover); }

.info-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 24px; margin-bottom: 20px; }
.info-card h3 { font-size: 1.1rem; margin-bottom: 12px; color: #a5b4fc; }
.info-card p, .info-card ul { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 0.85rem; }
.admin-table th, .admin-table td { border: 1px solid var(--border-color); padding: 10px 12px; text-align: left; vertical-align: middle; }
.table-thumb-wrap { width: 70px; height: 70px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-card); border: 1px solid var(--border-color); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.table-thumb-media { width: 100%; height: 100%; object-fit: cover; }

.action-btn-sm { padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.8rem; font-weight: 600; }
.btn-approve { background: #10b981; color: #fff; }
.btn-decline { background: #ef4444; color: #fff; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0 !important; }
  .hotkey-deck-grid { grid-template-columns: repeat(3, 1fr); }
  .lightbox-wrapper { grid-template-columns: 1fr; max-height: 90vh; overflow-y: auto; }
  .comment-section { border-left: none; border-top: 1px solid var(--border-color); }
}