@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

:root {
  --primary: #b7102a;
  --primary-dark: #92001c;
  --secondary: #ae2f34;
  --secondary-container: #ff6b6b;
  --surface: #f8f9fa;
  --surface-bright: #f8f9fa;
  --surface-low: #f3f4f5;
  --surface-container: #edeeef;
  --surface-high: #e7e8e9;
  --surface-highest: #e1e3e4;
  --surface-lowest: #ffffff;
  --surface-dim: #d9dadb;
  --on-surface: #191c1d;
  --on-surface-variant: #5b403f;
  --outline: #8f6f6e;
  --outline-variant: #e4bebc;
  --error: #ba1a1a;
  --tertiary: #006860;
  --surface-tint: #bb152c;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
  --shadow-ambient: 0 10px 40px 0 rgba(25, 28, 29, 0.04);
  --shadow-float: 0 4px 24px 0 rgba(25, 28, 29, 0.08);
  --gradient-primary: linear-gradient(135deg, #b7102a 0%, #ff6b6b 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .headline {
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
}

/* ── Glass Components ── */
.glass-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-ambient);
}

.glass-nav {
  background: rgba(248,249,250,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(228,190,188,0.15);
}

/* ── Buttons ── */
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  padding: 0.75rem 1.75rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid rgba(183,16,42,0.2);
  border-radius: var(--radius-xl);
  padding: 0.7rem 1.75rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.btn-secondary:hover { background: rgba(183,16,42,0.06); border-color: rgba(183,16,42,0.4); }

.btn-ghost {
  background: none;
  border: none;
  color: var(--on-surface-variant);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; gap: 0.375rem;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--surface-low); color: var(--on-surface); }

/* ── Chips ── */
.chip {
  background: rgba(228,190,188,0.25);
  color: var(--on-surface-variant);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.chip-primary {
  background: rgba(183,16,42,0.1);
  color: var(--primary);
}

/* ── Input Fields ── */
.input-group { position: relative; margin-bottom: 1rem; }
.input-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--on-surface-variant);
  margin-bottom: 0.375rem;
}
.input-field {
  width: 100%;
  background: var(--surface-container);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  color: var(--on-surface);
  outline: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.input-field:focus {
  background: var(--surface-lowest);
  box-shadow: 0 0 0 1.5px rgba(183,16,42,0.2);
}
.input-field::placeholder { color: var(--outline); }

/* ── Avatar ── */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--gradient-primary);
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-sm  { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-md  { width: 2.5rem; height: 2.5rem; font-size: 0.9375rem; }
.avatar-lg  { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
.avatar-xl  { width: 5rem; height: 5rem; font-size: 1.75rem; }
.avatar-2xl { width: 7rem; height: 7rem; font-size: 2.25rem; }

/* ── Badge ── */
.badge-verified {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-full);
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Navigation ── */
.main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 2rem;
}
.nav-logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}
.nav-link {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--on-surface-variant);
  font-size: 0.75rem;
  font-weight: 500;
  gap: 0.125rem;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface-low); color: var(--on-surface); }
.nav-link.active { color: var(--primary); }
.nav-link .material-symbols-outlined { font-size: 1.375rem; }

/* ── Page Layout ── */
.page-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 1.5rem 2rem;
}
.page-layout-2col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 1.5rem 2rem;
}
.page-layout-full {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 1.5rem 2rem;
}

/* ── Sidebar ── */
.sidebar-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-ambient);
  margin-bottom: 1rem;
}
.sidebar-section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-bottom: 0.75rem;
}

/* ── Post Card ── */
.post-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-ambient);
  margin-bottom: 1rem;
}
.post-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.875rem; }
.post-author-info { flex: 1; }
.post-author-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--on-surface);
  display: flex; align-items: center; gap: 0.375rem;
}
.post-author-meta { font-size: 0.8125rem; color: var(--on-surface-variant); margin-top: 0.125rem; }
.post-content { font-size: 0.9375rem; line-height: 1.65; color: var(--on-surface); margin-bottom: 1rem; }
.post-actions { display: flex; gap: 0.25rem; padding-top: 0.75rem; border-top: 1px solid rgba(228,190,188,0.2); }
.post-action-btn {
  display: flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  border: none;
  background: none;
  color: var(--on-surface-variant);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.post-action-btn:hover { background: var(--surface-low); color: var(--on-surface); }
.post-action-btn.liked { color: var(--primary); }
.post-action-btn .material-symbols-outlined { font-size: 1.125rem; }

/* ── Community Card ── */
.community-card {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-ambient);
  display: flex; align-items: flex-start; gap: 1rem;
}
.community-icon {
  width: 3rem; height: 3rem;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1.375rem;
  flex-shrink: 0;
}

/* ── Profile Card ── */
.profile-hero {
  background: var(--surface-lowest);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-float);
}
.profile-banner {
  height: 160px;
  background: linear-gradient(135deg, #b7102a 0%, #ff6b6b 60%, #f8f9fa 100%);
}
.profile-info { padding: 0 1.5rem 1.5rem; }
.profile-avatar-wrap { margin-top: -3.5rem; margin-bottom: 0.75rem; }
.profile-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--on-surface);
  letter-spacing: -0.03em;
}
.profile-stats { display: flex; gap: 2rem; margin: 1rem 0; }
.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--on-surface);
}
.stat-label { font-size: 0.75rem; color: var(--on-surface-variant); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 1000;
  background: var(--on-surface);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  box-shadow: var(--shadow-float);
  animation: slideUp 0.3s ease;
  display: flex; align-items: center; gap: 0.5rem;
}
.toast.success { background: #006860; }
.toast.error { background: var(--error); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── OTP Input ── */
.otp-inputs { display: flex; gap: 0.75rem; justify-content: center; margin: 1.5rem 0; }
.otp-digit {
  width: 3.25rem; height: 3.75rem;
  text-align: center;
  font-size: 1.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  background: var(--surface-container);
  border: none;
  border-radius: var(--radius-md);
  outline: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.otp-digit:focus { background: var(--surface-lowest); box-shadow: 0 0 0 2px var(--primary); }

/* ── Compose Box ── */
.compose-box {
  background: var(--surface-lowest);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-ambient);
  margin-bottom: 1rem;
}
.compose-textarea {
  width: 100%;
  background: var(--surface-low);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  color: var(--on-surface);
  resize: none;
  outline: none;
  min-height: 80px;
  transition: background 0.15s;
}
.compose-textarea:focus { background: var(--surface-container); }

/* ── Liked Heart ── */
.post-action-btn.liked { color: #e53935; }
.post-action-btn.liked .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: #e53935;
}

/* ── Nav Badge ── */
.nav-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  min-width: 1.125rem;
  height: 1.125rem;
  font-size: 0.625rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  border: 2px solid var(--surface);
  line-height: 1;
}
.nav-link { position: relative; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-dim); border-radius: 3px; }

/* ── Utility ── */
.text-primary { color: var(--primary); }
.text-muted { color: var(--on-surface-variant); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.fw-bold { font-weight: 700; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sticky-sidebar { position: sticky; top: 80px; }

/* ─────────────── RESPONSIVE / MOBILE ─────────────────────────────────────── */

/* Tablet: collapse left sidebar */
@media (max-width: 1100px) {
  .page-layout { grid-template-columns: 1fr 320px; }
  .page-layout aside:first-child { display: none; }
}
@media (max-width: 900px) {
  .page-layout { grid-template-columns: 1fr; }
  .page-layout aside { display: none; }
  .page-layout-2col { grid-template-columns: 1fr; }
  .page-layout-2col aside { display: none; }
}

/* Mobile nav: compress labels */
@media (max-width: 768px) {
  .main-nav { padding: 0 0.75rem; gap: 0.5rem; }
  .nav-logo { font-size: 1rem; }
  .nav-link { padding: 0.375rem 0.5rem; font-size: 0.625rem; }
  .nav-link .material-symbols-outlined { font-size: 1.25rem; }
  .page-layout, .page-layout-2col, .page-layout-full { padding: 72px 0.875rem 1.5rem; }
  .post-card { padding: 1rem; }
  .compose-box { padding: 1rem; }
  .sidebar-card { padding: 1rem; }
  .profile-hero { border-radius: var(--radius-lg); }
  .profile-banner { height: 120px; }
  .profile-info { padding: 0 1rem 1rem; }
  .profile-name { font-size: 1.25rem; }
  .profile-stats { gap: 1.25rem; }
  .stat-value { font-size: 1rem; }
  .btn-primary, .btn-secondary { padding: 0.625rem 1.25rem; font-size: 0.875rem; }
}

/* Small mobile: hide nav labels, show only icons */
@media (max-width: 520px) {
  .main-nav { height: 56px; }
  .nav-link { flex-direction: column; padding: 0.25rem 0.375rem; font-size: 0; gap: 0; }
  .nav-link .material-symbols-outlined { font-size: 1.375rem; }
  .page-layout, .page-layout-2col, .page-layout-full { padding: 64px 0.75rem 1.25rem; }
  .btn-ghost span:not(.material-symbols-outlined) { display: none; }
}

/* Mobile: communities grid single column */
@media (max-width: 600px) {
  .communities-grid { grid-template-columns: 1fr !important; }
  .results-grid { grid-template-columns: 1fr !important; }
}

/* Mobile: profile 2col */
@media (max-width: 768px) {
  .page-layout-2col aside { display: none !important; }
}

/* Mobile: messages layout */
@media (max-width: 768px) {
  .msg-layout { grid-template-columns: 1fr; height: calc(100vh - 56px); margin-top: 56px; }
  .msg-sidebar { position: fixed; inset: 56px 0 0 0; z-index: 50; display: none; }
  .msg-sidebar.visible { display: flex; flex-direction: column; }
}

/* Bottom nav bar for mobile */
@media (max-width: 520px) {
  .main-nav .nav-links {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(248,249,250,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(228,190,188,0.2);
    justify-content: space-around;
    padding: 0.375rem 0 0.5rem;
    z-index: 99;
    height: 56px;
    margin: 0;
    gap: 0;
  }
  .main-nav { height: 52px; }
  body { padding-bottom: 56px; }
  .page-layout, .page-layout-2col, .page-layout-full { padding-top: 60px; padding-bottom: 70px; }
  .msg-layout { margin-top: 52px; height: calc(100vh - 52px - 56px); }
  .toast { bottom: 4.5rem; right: 1rem; }
}

/* Admin panel mobile */
@media (max-width: 640px) {
  .admin-main { margin-left: 0; padding: 1rem; }
  .admin-sidebar { display: none; }
}
