/* ============================================================
   Krubuddy.com — Main Stylesheet
   Mobile-first · Dark Mode · Blue/White Theme
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  /* Brand Colors */
  --blue:       #3B82F6;
  --blue-light: #EFF6FF;
  --blue-mid:   #DBEAFE;
  --blue-dark:  #2563EB;
  --blue-900:   #1E3A8A;
  --green:      #22C55E;
  --amber:      #F59E0B;
  --red:        #EF4444;
  --purple:     #A855F7;

  /* Layout */
  --nav-h:      68px;
  --sidebar-w:  240px;
  --right-w:    288px;
  --content-max: 680px;

  /* Light Mode (default) */
  --bg:         #F0F2F5;
  --card:       #FFFFFF;
  --card2:      #F9FAFB;
  --text:       #1F2937;
  --text-2:     #4B5563;
  --muted:      #6B7280;
  --border:     #E5E7EB;
  --border-2:   #D1D5DB;
  --input-bg:   #F9FAFB;
  --hover:      #F3F4F6;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.12);

  /* Radius */
  --r-sm:  8px;
  --r:     12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Transitions */
  --t:     all .18s ease;
  --t-fast: all .12s ease;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:       #0F1117;
  --card:     #1C1F26;
  --card2:    #252830;
  --text:     #F1F5F9;
  --text-2:   #CBD5E1;
  --muted:    #94A3B8;
  --border:   #2D3244;
  --border-2: #374151;
  --input-bg: #252830;
  --hover:    #252830;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow:    0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  --blue-light: #1E2D4D;
  --blue-mid:   #1D3461;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Plus Jakarta Sans', 'Sarabun', sans-serif;
  font-feature-settings: "kern" 1;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background .3s, color .3s;
}
a { color: var(--blue); text-decoration: none; transition: var(--t); }
a:hover { color: var(--blue-dark); }
button, input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ── TOP NAVBAR ─────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 8px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--blue);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -.5px;
}
.navbar-brand img { width: 36px; height: 36px; border-radius: var(--r); }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 16px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-2);
  transition: var(--t);
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  background: var(--blue-light);
  color: var(--blue);
}
.nav-link svg { flex-shrink: 0; }

.navbar-search {
  flex: 0 1 300px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--t);
}
.navbar-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.navbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--r);
  cursor: pointer;
  color: var(--text-2);
  transition: var(--t);
}
.icon-btn:hover { background: var(--hover); color: var(--blue); }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  background: var(--red);
  color: white;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--card);
}

.avatar-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: var(--t);
  flex-shrink: 0;
}
.avatar-btn:hover { border-color: var(--blue); }
.avatar-btn img, .avatar-btn .avatar-initials {
  width: 100%; height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

/* Left Sidebar */
.sidebar-left {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  padding: 16px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover, .sidebar-item.active {
  background: var(--blue-light);
  color: var(--blue);
}
.sidebar-item .si-icon {
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Sidebar User Card */
.sidebar-user-card {
  display: block;
  margin-bottom: 12px;
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: var(--t);
}
.sidebar-user-card:hover { transform: translateY(-1px); }
.sidebar-user-inner {
  background: linear-gradient(135deg, var(--blue-mid) 0%, var(--blue-light) 100%);
  border: 1px solid var(--blue-light);
  border-radius: var(--r-lg);
  padding: 14px;
}
[data-theme="dark"] .sidebar-user-inner {
  background: linear-gradient(135deg, #1e2d4d 0%, #1a2035 100%);
  border-color: #2a3a5c;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 8px 14px 4px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  margin-right: var(--right-w);
  max-width: 100%;
  padding: 24px 20px;
  min-height: calc(100vh - var(--nav-h));
}

.feed-container {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Right Sidebar */
.sidebar-right {
  position: fixed;
  top: var(--nav-h);
  right: 0;
  width: var(--right-w);
  height: calc(100vh - var(--nav-h));
  padding: 16px 14px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-body { padding: 16px 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--card2);
}

/* ── POST CARD ──────────────────────────────────────────────── */
.post-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow .2s;
}
.post-card:hover { box-shadow: var(--shadow); }

.post-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.post-meta { flex: 1; min-width: 0; }
.post-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.post-author {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: var(--t);
}
.post-author:hover { color: var(--blue); }

.post-time {
  font-size: 12px;
  color: var(--muted);
}

.post-content {
  padding: 0 20px 12px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.post-media {
  margin: 0 20px 12px;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card2);
  border: 1px solid var(--border);
  max-height: 400px;
}
.post-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post-media video {
  width: 100%;
  border-radius: var(--r);
}

.post-tags {
  padding: 0 20px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.post-actions {
  padding: 4px 14px 8px;
  display: flex;
  gap: 2px;
  border-top: 1px solid var(--border);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: var(--t);
}
.action-btn:hover { background: var(--hover); color: var(--text); }
.action-btn.liked { color: var(--red); background: #FEE2E2; }
.action-btn.commented { color: var(--blue); background: var(--blue-light); }
.action-btn.saved { color: var(--amber); background: #FEF3C7; }

/* ── CREATE POST ─────────────────────────────────────────────── */
.create-post {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.create-post-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.create-post-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: var(--t);
  outline: none;
}
.create-post-input:focus, .create-post-input:hover {
  border-color: var(--blue);
  background: var(--card);
}
.create-post-actions {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.create-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: var(--t);
}
.create-action-btn:hover { background: var(--hover); color: var(--blue); }

/* ── TABS / FILTERS ─────────────────────────────────────────── */
.feed-filters {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 16px;
  padding-bottom: 2px;
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 8px;
}
.feed-filters::-webkit-scrollbar { display: none; }

.filter-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: var(--t);
  text-decoration: none;
}
.filter-tab:hover { background: var(--hover); color: var(--text); }
.filter-tab.active {
  background: var(--blue);
  color: white;
}

/* ── CHIPS / BADGES ─────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.chip-blue    { background: var(--blue-light); color: var(--blue); }
.chip-green   { background: #DCFCE7; color: #16A34A; }
.chip-red     { background: #FEE2E2; color: var(--red); }
.chip-amber   { background: #FEF3C7; color: #D97706; }
.chip-purple  { background: #F3E8FF; color: #7C3AED; }
.chip-solid   { color: white; }

.tag-pill {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--blue-light);
  color: var(--blue);
  transition: var(--t);
  cursor: pointer;
}
.tag-pill:hover { background: var(--blue); color: white; }

.exp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg,#FEF3C7,#FDE68A);
  color: #92400E;
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #FCD34D;
}

/* ── AVATAR ─────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--r-full);
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: .85em;
  text-transform: uppercase;
}
.avatar-online {
  position: relative;
}
.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 1px; right: 1px;
  width: 25%; height: 25%;
  background: var(--green);
  border: 2px solid var(--card);
  border-radius: var(--r-full);
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: var(--t);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--blue);
  color: white;
}
.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
  color: white;
}
.btn-secondary {
  background: var(--blue-light);
  color: var(--blue);
}
.btn-secondary:hover { background: var(--blue-mid); color: var(--blue-dark); }
.btn-outline {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORM ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--t);
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-input { /* alias for form-control used in Phase 5 views */
  display: block;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--t);
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-input::placeholder { color: var(--muted); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.alert-error   { background: #FEE2E2; color: #DC2626; border: 1px solid #FCA5A5; }
.alert-info    { background: var(--blue-light); color: var(--blue-dark); border: 1px solid var(--blue-mid); }
.alert-warning { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }

/* ── COMMENTS ─────────────────────────────────────────────────── */
.comments-section { padding: 4px 20px 16px; }
.comment-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.comment-bubble {
  background: var(--card2);
  border-radius: var(--r-lg);
  padding: 10px 14px;
  flex: 1;
  border: 1px solid var(--border);
}
.comment-author {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.comment-time {
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
}
.comment-text {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
}
.comment-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.comment-input {
  flex: 1;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: var(--t);
}
.comment-input:focus { border-color: var(--blue); }

/* ── LEADERBOARD WIDGET ─────────────────────────────────────── */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.leaderboard-item:last-child { border-bottom: none; }
.lb-rank {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.lb-rank.top-1 { color: #F59E0B; font-size: 16px; }
.lb-rank.top-2 { color: #9CA3AF; font-size: 15px; }
.lb-rank.top-3 { color: #B45309; font-size: 14px; }
.lb-name  { flex: 1; font-weight: 600; font-size: 13.5px; }
.lb-pts   { font-size: 12px; font-weight: 700; color: var(--blue); }

/* ── MISSIONS WIDGET ────────────────────────────────────────── */
.mission-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.mission-item:last-child { border-bottom: none; }
.mission-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.mission-icon {
  width: 32px; height: 32px;
  background: var(--blue-light);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.mission-title { font-weight: 600; font-size: 13px; flex: 1; }
.mission-reward { font-size: 11px; font-weight: 700; color: var(--amber); }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: var(--r-full);
  transition: width .4s ease;
}

/* ── PRODUCT CARD (Marketplace) ─────────────────────────────── */
.product-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--t);
  cursor: pointer;
}
.product-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.product-cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-body { padding: 16px; }
.product-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-desc {
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}
.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.product-price {
  font-weight: 800;
  font-size: 16px;
  color: var(--blue);
}
.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--amber);
  font-weight: 600;
}

/* ── TRAINING CARD ──────────────────────────────────────────── */
.training-card {
  background: var(--card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--t);
  margin-bottom: 12px;
}
.training-card:hover { box-shadow: var(--shadow); }
.training-body { padding: 16px 20px; }
.training-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.training-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.training-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.seat-counter {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.countdown-timer {
  font-family: monospace;
  font-weight: 700;
  color: var(--red);
  font-size: 13px;
}

/* ── DROPDOWN ────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 1100;
  animation: dropIn .15s ease;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
}
.dropdown-item:hover { background: var(--hover); color: var(--blue); }
.dropdown-item.danger:hover { background: #FEE2E2; color: var(--red); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 17px;
}
.modal-body    { padding: 20px 24px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r);
  border: none;
  background: var(--hover);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: var(--t);
}
.modal-close:hover { background: #FEE2E2; color: var(--red); }

/* ── MESSENGER POPUP ─────────────────────────────────────────── */
.messenger-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  height: 480px;
  background: var(--card);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  animation: slideUp .2s ease;
}
.messenger-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.messenger-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.messenger-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* ── NOTIFICATION DROPDOWN ──────────────────────────────────── */
.notif-dropdown {
  width: 380px;
  max-height: 480px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r);
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
  color: var(--text);
}
.notif-item:hover { background: var(--hover); }
.notif-item.unread { background: var(--blue-light); }
.notif-content { flex: 1; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-body  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-time  { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── LEVEL / EXP BAR ────────────────────────────────────────── */
.level-card {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: white;
  border-radius: var(--r-lg);
  padding: 16px;
}
.level-number {
  font-family: 'Sora', sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}
.exp-bar { height: 8px; background: rgba(255,255,255,.2); border-radius: var(--r-full); margin-top: 8px; }
.exp-fill { height: 100%; background: white; border-radius: var(--r-full); }

/* Points Pill */
.pts-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  color: #1E40AF;
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #FCD34D;
}

/* ── SKELETON LOADING ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--hover) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .sidebar-right { display: none; }
  .main-content  { margin-right: 0; }
}
@media (max-width: 768px) {
  .sidebar-left   { display: none; }
  .main-content   { margin-left: 0; padding: 12px; }
  .navbar-nav     { display: none; }
  .navbar-search  { flex: 1; }
  .feed-container { max-width: 100%; }
  .modal          { border-radius: var(--r-lg); }
  .messenger-popup { width: calc(100vw - 32px); right: 16px; }
}

/* ── UTILITY ────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-4  { padding: 16px; }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--muted); }
.text-blue  { color: var(--blue); }
.font-bold  { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── ANIMATIONS ─────────────────────────────────────────────── */
.fade-up {
  animation: fadeUp .3s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bounce-in {
  animation: bounceIn .4s cubic-bezier(.68,-.55,.265,1.55) both;
}
@keyframes bounceIn {
  from { opacity: 0; transform: scale(.6); }
  to   { opacity: 1; transform: scale(1); }
}
