/* ═══════════════════════════════════════════════════════
   PROFILE.CSS  —  MineMev Profile Page
   ═══════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --bg:          #0f0f13;
  --surface:     #16161d;
  --surface-2:   #1e1e28;
  --border:      #2a2a38;
  --border-hover:#3d3d52;

  --text:        #e8e8f0;
  --text-muted:  #8888a8;
  --text-dim:    #555570;

  --accent:      #7c3aed;
  --accent-2:    #a855f7;
  --gold:        #f59e0b;
  --gold-dim:    #92400e;

  --green:       #22c55e;
  --red:         #ef4444;
  --orange:      #f97316;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
  --shadow:      0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.6);

  --sidebar-w:   320px;
  --transition:  .2s ease;
}

/* ── Reset / Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body * {
  font-family: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans TC", "Noto Sans KR", sans-serif;
}

a { color: inherit; text-decoration: none; }

/* ── Page Layout ─────────────────────────────────────── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  gap: 24px;
  padding: 24px;
  align-items: flex-start;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 24px;
}

/* ── Admin Panel ─────────────────────────────────────── */
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-panel__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

/* ── Permission Select ───────────────────────────────── */
.permission-select-wrapper {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.permission-select-wrapper__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.permission-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.permission-select:hover,
.permission-select:focus {
  border-color: var(--accent);
  outline: none;
}

/* ── MC Auth ─────────────────────────────────────────── */
.mc-auth {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ════════════════════════════════════════════════════════
   BUTTON SYSTEM
   ════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  background: none;
}

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--border-hover);
  background: #252535;
}

.btn--danger {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.35);
  color: #fca5a5;
}
.btn--danger:hover {
  background: rgba(239,68,68,.22);
  border-color: var(--red);
}

.btn--success {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.35);
  color: #86efac;
}
.btn--success:hover {
  background: rgba(34,197,94,.22);
  border-color: var(--green);
}

.btn--warning {
  background: rgba(249,115,22,.12);
  border-color: rgba(249,115,22,.35);
  color: #fdba74;
}
.btn--warning:hover {
  background: rgba(249,115,22,.22);
  border-color: var(--orange);
}

.btn--accent {
  background: rgba(124,58,237,.15);
  border-color: rgba(124,58,237,.4);
  color: #c4b5fd;
}
.btn--accent:hover {
  background: rgba(124,58,237,.25);
  border-color: var(--accent);
}

.btn--follow {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 14px;
}
.btn--follow:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124,58,237,.4);
}

.btn--sm  { padding: 7px 12px; font-size: 12px; }
.btn--xs  { padding: 4px 8px;  font-size: 11px; }
.btn--full { width: 100%; }

/* ════════════════════════════════════════════════════════
   PROFILE CARD
   ════════════════════════════════════════════════════════ */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Banner */
.profile-card__banner {
  position: relative;
  height: 100px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 12px;
  overflow: hidden;
}

.profile-card__banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-url) center/cover no-repeat;
  opacity: .45;
}

/* MEV Score */
.mev-score {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  backdrop-filter: blur(6px);
}

.mev-score__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1;
}

.mev-score__value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

/* Crown */
.crown-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  opacity: .9;
}

/* Avatar */
.profile-card__avatar-wrap {
  display: flex;
  justify-content: center;
  margin-top: -40px;
  position: relative;
  z-index: 2;
}

.profile-card__avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
}

/* Body */
.profile-card__body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-card__name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-card__username {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.profile-card__mc-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: .03em;
}

/* Stat blocks */
.profile-card__stats {
  display: flex;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stat-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  gap: 2px;
  transition: background var(--transition);
}

.stat-block:hover { background: #252535; }

.stat-block__value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.stat-block__label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

/* Social links */
.social-links {
  display: flex;
  gap: 8px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all var(--transition);
}

.social-link--yt  { color: #ff4444; }
.social-link--twitch { color: #9b59b6; }

.social-link:hover {
  border-color: currentColor;
  background: #252535;
  transform: translateY(-2px);
}

/* Server badges */
.server-memberships {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.server-memberships__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.server-memberships__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.server-badge-link { display: inline-flex; }

.server-badge {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 3px;
  background: var(--surface-2);
  transition: all var(--transition);
}

.server-badge:hover {
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.1);
}

/* Certified badge */
.certified-badge { display: flex; align-items: center; }

/* Tooltip */
.tooltip-wrap { position: relative; }
.tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--border);
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* Description */
.profile-card__desc {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}

.desc-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════ */
.content {
  flex: 1;
  min-width: 0;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 16px;
}

/* ── Posts Grid ──────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── Post Card ───────────────────────────────────────── */
.post-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.post-card--hidden {
  border-color: rgba(239,68,68,.4);
  background: rgba(239,68,68,.05);
}

/* Image */
.post-card__img-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--surface-2);
}

.post-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.post-card:hover .post-card__img { transform: scale(1.04); }

/* Vote bar */
.post-card__votes {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.vote-btn:hover { border-color: var(--border-hover); color: var(--text); }

.vote-btn--up.is-active  { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.5); color: var(--green); }
.vote-btn--down.is-active { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.5); color: var(--red); }

.vote-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 24px;
  text-align: center;
}

/* Favorite */
.post-card__favorite {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn:hover          { border-color: var(--gold); color: var(--gold); }
.icon-btn.is-active      { color: var(--gold); border-color: var(--gold); background: rgba(245,158,11,.15); }

/* Post info */
.post-card__info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.post-card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.post-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}

.post-card__title:hover { color: var(--accent-2); }

/* Tags */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  background: rgba(124,58,237,.1);
}

.tag--version {
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.3);
  color: var(--gold);
}

.tag--version:hover {
  background: rgba(245,158,11,.16);
  border-color: var(--gold);
  color: var(--gold);
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .page-wrapper {
    flex-direction: column;
    padding: 16px;
  }

  .sidebar {
    width: 100%;
    position: static;
  }

  .admin-panel,
  .mc-auth {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .admin-panel__label { width: 100%; }
}

@media (max-width: 600px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }

  .section-title { font-size: 22px; }

  .profile-card__avatar { width: 68px; height: 68px; }
}