@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --green: #1b6b4a;
  --green-dark: #0d4a32;
  --green-light: #2d8f6f;
  --green-bg: #e3f2e8;
  --green-hover: #165540;
  --orange: #e8821c;
  --orange-light: #f5a623;
  --orange-bg: #fff3e0;
  --yellow: #f4c430;
  --yellow-bg: #fffde7;
  --beige: #f5efe0;
  --beige-dark: #e8dcc4;
  --beige-light: #faf6ed;
  --white: #ffffff;
  --ink: #1c1e21;
  --ink-soft: #4d5358;
  --muted: #8a8d91;
  --border: #ddd9d0;
  --border-soft: #ece8df;
  --shadow: 0 1px 2px rgba(27,107,74,0.1);
  --shadow-md: 0 3px 10px rgba(27,107,74,0.15);
  --shadow-lg: 0 8px 24px rgba(27,107,74,0.2);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --nav-h: 56px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--beige);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 700; color: var(--ink); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

code, .mono { font-family: 'DM Mono', monospace; }

/* ============ NAVBAR (Facebook clone) ============ */
.navbar {
  position: sticky; top: 0; z-index: 200;
  background: var(--green);
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-left { display: flex; align-items: center; gap: 0.6rem; flex: 1; }
.nav-brand {
  font-size: 1.6rem; font-weight: 800; color: var(--white);
  letter-spacing: -1px; text-decoration: none;
  display: flex; align-items: center; gap: 0.3rem;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand .logo-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--white); font-weight: 800;
  box-shadow: 0 2px 6px rgba(232,130,28,0.4);
}
.nav-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--green-dark); border-radius: 20px;
  padding: 0.5rem 0.9rem; width: 240px;
}
.nav-search input {
  background: transparent; border: none; color: var(--beige-light);
  font-size: 0.88rem; outline: none; width: 100%;
}
.nav-search input::placeholder { color: rgba(245,239,224,0.5); }
.nav-search .icon { font-size: 0.9rem; opacity: 0.6; }

.nav-center { display: flex; align-items: center; gap: 0.3rem; flex: 1; justify-content: center; }
.nav-tab {
  display: flex; align-items: center; justify-content: center;
  padding: 0.5rem 1.5rem; border-radius: var(--radius);
  color: rgba(255,255,255,0.7); font-size: 1.3rem;
  text-decoration: none; transition: all 0.15s;
  position: relative; height: 48px; min-width: 70px;
}
.nav-tab:hover { background: var(--green-dark); color: var(--white); text-decoration: none; }
.nav-tab.active { color: var(--orange-light); border-bottom: 3px solid var(--orange-light); border-radius: 0; }
.nav-tab .nav-badge {
  position: absolute; top: 4px; right: 8px;
  background: var(--orange); color: var(--white);
  border-radius: 10px; padding: 0 5px; font-size: 0.68rem; font-weight: 700;
  min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
}

.nav-right { display: flex; align-items: center; gap: 0.4rem; flex: 1; justify-content: flex-end; }
.nav-icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--green-dark); display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 1.1rem; cursor: pointer;
  text-decoration: none; transition: background 0.15s;
  position: relative;
}
.nav-icon-btn:hover { background: var(--green-light); text-decoration: none; }
.nav-icon-btn .nav-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--orange); color: var(--white);
  border-radius: 10px; padding: 0 5px; font-size: 0.68rem; font-weight: 700;
  min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
}
.nav-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--orange); cursor: pointer;
}
.nav-avatar-placeholder {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--orange); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  border: 2px solid var(--orange-light);
}

@media (max-width: 768px) {
  .nav-search { display: none; }
  .nav-tab { padding: 0.5rem; min-width: 50px; font-size: 1.1rem; }
}

/* ============ LAYOUT ============ */
.fb-layout {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 1rem;
  max-width: 1400px; margin: 0 auto;
  padding: 1rem;
}
.fb-left { position: sticky; top: calc(var(--nav-h) + 16px); height: fit-content; max-height: calc(100vh - var(--nav-h) - 32px); overflow-y: auto; }
.fb-center { min-width: 0; max-width: 680px; margin: 0 auto; width: 100%; }
.fb-right { position: sticky; top: calc(var(--nav-h) + 16px); height: fit-content; max-height: calc(100vh - var(--nav-h) - 32px); overflow-y: auto; }

@media (max-width: 1100px) {
  .fb-layout { grid-template-columns: 1fr; }
  .fb-left, .fb-right { display: none; }
}

/* ============ LEFT SIDEBAR ============ */
.sidebar-card {
  background: transparent; padding: 0.4rem 0;
}
.sidebar-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.6rem; border-radius: var(--radius);
  color: var(--ink); font-weight: 500; font-size: 0.92rem;
  text-decoration: none; transition: background 0.1s; cursor: pointer;
}
.sidebar-item:hover { background: var(--beige-dark); text-decoration: none; }
.sidebar-item.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.sidebar-item-icon { font-size: 1.3rem; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-item .avatar-mini { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.sidebar-divider { height: 1px; background: var(--border-soft); margin: 0.6rem 0; }
.sidebar-label { font-size: 0.82rem; color: var(--muted); font-weight: 600; padding: 0.4rem 0.6rem; text-transform: none; }

/* ============ STORIES / REELS ROW ============ */
.stories-row {
  display: flex; gap: 0.6rem; padding: 0.5rem 0; margin-bottom: 1rem;
  overflow-x: auto; scrollbar-width: none;
}
.stories-row::-webkit-scrollbar { display: none; }
.story {
  flex-shrink: 0; width: 110px; height: 180px; border-radius: var(--radius-lg);
  position: relative; overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow); transition: transform 0.15s;
}
.story:hover { transform: scale(1.03); }
.story-create {
  background: var(--white); border: 1px solid var(--border-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.story-create-icon {
  width: 40px; height: 40px; border-radius: 50%; background: var(--green);
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 1.5rem; border: 3px solid var(--white);
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
}
.story-create-label { font-size: 0.78rem; font-weight: 600; padding: 0.5rem; text-align: center; }
.story-bg {
  width: 100%; height: 100%; object-fit: cover;
}
.story-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  padding: 0.5rem; color: var(--white); font-size: 0.78rem; font-weight: 600;
}
.story-ring {
  position: absolute; top: 0.5rem; left: 0.5rem;
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--orange); object-fit: cover;
}
.story-ring-placeholder {
  position: absolute; top: 0.5rem; left: 0.5rem;
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--orange); background: var(--green);
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}

/* ============ CREATE POST ============ */
.create-post {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 0.8rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.create-post-top { display: flex; align-items: center; gap: 0.7rem; }
.create-post-input {
  flex: 1; background: var(--beige); border: none; border-radius: 20px;
  padding: 0.6rem 1rem; font-size: 0.92rem; color: var(--ink);
  cursor: pointer; transition: background 0.15s;
}
.create-post-input:hover { background: var(--beige-dark); }
.create-post-divider { height: 1px; background: var(--border-soft); margin: 0.7rem 0; }
.create-post-actions { display: flex; justify-content: space-around; }
.create-post-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem; border-radius: var(--radius);
  background: transparent; border: none; cursor: pointer;
  font-weight: 600; font-size: 0.88rem; color: var(--ink-soft);
  transition: background 0.1s;
}
.create-post-btn:hover { background: var(--beige); }
.create-post-btn .icon { font-size: 1.3rem; }

/* ============ FEED POSTS ============ */
.feed-post {
  background: var(--white); border-radius: var(--radius-lg);
  margin-bottom: 1rem; box-shadow: var(--shadow); overflow: hidden;
}
.feed-post-header { padding: 0.8rem 1rem; display: flex; align-items: center; gap: 0.7rem; }
.feed-post-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.feed-post-avatar-ph {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--white); font-size: 1rem;
}
.feed-post-info { flex: 1; }
.feed-post-author { font-weight: 700; font-size: 0.92rem; color: var(--ink); }
.feed-post-meta { font-size: 0.78rem; color: var(--muted); }
.feed-post-meta a { color: var(--muted); }
.feed-post-body { padding: 0 1rem 0.8rem; font-size: 0.92rem; color: var(--ink); line-height: 1.5; }
.feed-post-image { width: 100%; max-height: 500px; object-fit: cover; display: block; }
.feed-post-stats { padding: 0.5rem 1rem; display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }
.feed-post-stats .reactions-display { display: flex; align-items: center; gap: 0.3rem; }
.feed-post-stats .reaction-emojis { display: flex; }
.reaction-pill {
  width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; border: 2px solid var(--white); margin-left: -4px;
}
.reaction-pill.like { background: var(--green); color: var(--white); }
.reaction-pill.love { background: var(--orange); color: var(--white); }
.reaction-pill.haha { background: var(--yellow); color: var(--ink); }
.feed-post-actions-bar {
  padding: 0.3rem 0.5rem; border-top: 1px solid var(--border-soft);
  display: flex; justify-content: space-around;
}
.feed-action-btn {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.8rem; border-radius: var(--radius);
  background: transparent; border: none; cursor: pointer;
  font-weight: 600; font-size: 0.86rem; color: var(--ink-soft);
  transition: background 0.1s; flex: 1; justify-content: center;
}
.feed-action-btn:hover { background: var(--beige); }
.feed-action-btn .icon { font-size: 1.2rem; }
.feed-action-btn.liked { color: var(--green); }

/* Comments */
.comments-section { padding: 0 1rem 0.8rem; border-top: 1px solid var(--border-soft); padding-top: 0.5rem; }
.comment-item { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-avatar-ph { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--white); flex-shrink: 0; }
.comment-bubble { background: var(--beige); border-radius: var(--radius); padding: 0.5rem 0.8rem; flex: 1; }
.comment-author { font-weight: 600; font-size: 0.82rem; color: var(--ink); }
.comment-text { font-size: 0.88rem; color: var(--ink); }
.comment-time { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.comment-input-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.comment-input-row input {
  flex: 1; background: var(--beige); border: 1px solid var(--border-soft);
  border-radius: 20px; padding: 0.4rem 0.8rem; font-size: 0.86rem;
}

/* ============ CARDS ============ */
.card {
  background: var(--white); border: none; border-radius: var(--radius-lg);
  padding: 1rem; margin-bottom: 0.8rem; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 0.4rem; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.88rem;
  border: none; cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-dark); }
.btn-orange { background: var(--orange); color: var(--white); }
.btn-orange:hover { background: var(--orange-light); }
.btn-success { background: #2d8f5f; color: var(--white); }
.btn-success:hover { background: #247a4f; }
.btn-danger { background: #c0392b; color: var(--white); }
.btn-danger:hover { background: #a93226; }
.btn-secondary { background: var(--beige-dark); color: var(--ink); }
.btn-secondary:hover { background: var(--beige); }
.btn-ghost { background: var(--beige); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--beige-dark); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 0.5rem; width: 38px; height: 38px; justify-content: center; border-radius: 50%; }

/* ============ FORMS ============ */
input, textarea, select {
  width: 100%; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm);
  background: var(--beige-light); border: 1px solid var(--border);
  color: var(--ink); font-family: 'Inter', sans-serif; font-size: 0.92rem;
  transition: all 0.15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); background: var(--white); }
textarea { resize: vertical; min-height: 80px; }
label { display: block; margin-bottom: 0.2rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.form-group { margin-bottom: 0.8rem; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.12rem 0.5rem; border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-admin, .badge-super_admin { background: var(--green-bg); color: var(--green); }
.badge-prof { background: var(--orange-bg); color: var(--orange); }
.badge-parent { background: #e8f5e9; color: #2e7d32; }
.badge-eleve { background: var(--yellow-bg); color: #f57f17; }
.badge-active { background: var(--green-bg); color: #2d8f5f; }
.badge-inactive { background: #ffebee; color: #c0392b; }

/* ============ GRID ============ */
.grid { display: grid; gap: 0.8rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ============ MESSANGER FLOATING WIDGET ============ */
.messenger-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--green); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; cursor: pointer;
  box-shadow: 0 4px 16px rgba(27,107,74,0.4);
  transition: transform 0.2s;
  border: 3px solid var(--white);
}
.messenger-fab:hover { transform: scale(1.08); }
.messenger-fab .fab-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--orange); color: var(--white);
  border-radius: 12px; padding: 0 6px; font-size: 0.72rem; font-weight: 700;
  min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white);
}

.messenger-panel {
  position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 300;
  width: 380px; max-width: calc(100vw - 2rem);
  height: 520px; max-height: calc(100vh - 120px);
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  overflow: hidden; animation: msPop 0.2s ease;
}
@keyframes msPop { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.messenger-header {
  background: var(--green); color: var(--white); padding: 0.8rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.messenger-header h3 { color: var(--white); font-size: 1.05rem; }
.messenger-header .ms-close { background: transparent; border: none; color: var(--white); font-size: 1.3rem; cursor: pointer; padding: 0.2rem; border-radius: 50%; }
.messenger-header .ms-close:hover { background: var(--green-dark); }

.ms-rooms-list { flex: 1; overflow-y: auto; }
.ms-room-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 1rem; cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid var(--border-soft);
}
.ms-room-item:hover { background: var(--beige); }
.ms-room-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.ms-room-info { flex: 1; min-width: 0; }
.ms-room-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-room-meta { font-size: 0.76rem; color: var(--muted); }
.ms-room-toggle { width: 36px; height: 20px; flex-shrink: 0; }

/* Chat view inside messenger */
.ms-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ms-chat-header {
  padding: 0.6rem 0.8rem; background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 0.5rem;
  box-shadow: var(--shadow);
}
.ms-chat-back { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; padding: 0.2rem 0.4rem; border-radius: 50%; color: var(--ink-soft); }
.ms-chat-back:hover { background: var(--beige); }
.ms-chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.ms-chat-title { flex: 1; }
.ms-chat-name { font-weight: 700; font-size: 0.88rem; color: var(--ink); }
.ms-chat-status { font-size: 0.72rem; color: var(--muted); }

.ms-chat-messages {
  flex: 1; overflow-y: auto; padding: 0.6rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  background: var(--beige);
}
.ms-msg-bubble {
  max-width: 75%; padding: 0.45rem 0.8rem; border-radius: 16px;
  font-size: 0.88rem; line-height: 1.35; word-wrap: break-word;
  animation: msMsgIn 0.15s ease; position: relative;
}
@keyframes msMsgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.ms-msg-bubble.from-other {
  align-self: flex-start; background: var(--white); color: var(--ink);
  border-bottom-left-radius: 4px;
}
.ms-msg-bubble.from-me {
  align-self: flex-end; background: var(--green); color: var(--white);
  border-bottom-right-radius: 4px;
}
.ms-msg-bubble.from-other-img { padding: 0; background: transparent; }
.ms-msg-bubble.from-me-img { padding: 0; background: transparent; }
.ms-msg-bubble img { max-width: 100%; border-radius: 16px; display: block; }
.ms-msg-author { font-size: 0.74rem; font-weight: 700; color: var(--green); margin-bottom: 0.1rem; }
.ms-msg-time { font-size: 0.66rem; opacity: 0.6; margin-top: 0.1rem; }

.ms-chat-input {
  padding: 0.5rem; background: var(--white);
  border-top: 1px solid var(--border-soft);
  display: flex; gap: 0.3rem; align-items: center;
}
.ms-chat-input textarea {
  flex: 1; border: none; background: var(--beige); border-radius: 20px;
  padding: 0.4rem 0.8rem; font-size: 0.86rem; resize: none; min-height: 36px; max-height: 80px;
}
.ms-chat-input button {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--green); color: var(--white); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ms-chat-input button:hover { background: var(--green-dark); }

.ms-typing { font-size: 0.76rem; color: var(--muted); padding: 0 0.6rem; font-style: italic; min-height: 18px; }

/* Room management in messenger */
.ms-manage {
  flex: 1; overflow-y: auto; padding: 0.6rem;
}
.ms-manage-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem; border-radius: var(--radius); margin-bottom: 0.4rem;
  background: var(--beige);
}
.ms-manage-item .toggle { margin-left: auto; }

/* ============ CHAT PAGE (full page) ============ */
.chat-layout {
  display: grid; grid-template-columns: 340px 1fr;
  height: calc(100vh - var(--nav-h));
}
.chat-sidebar {
  background: var(--white); border-right: 1px solid var(--border-soft);
  overflow-y: auto;
}
.chat-sidebar-header {
  padding: 1rem; background: var(--green); color: var(--white);
}
.chat-sidebar-header h3 { color: var(--white); }
.chat-sidebar-search { padding: 0.5rem; border-bottom: 1px solid var(--border-soft); }
.chat-sidebar-search input { background: var(--beige); border: none; border-radius: 20px; padding: 0.5rem 1rem; font-size: 0.86rem; }
.chat-room-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 1rem; cursor: pointer; transition: background 0.1s;
}
.chat-room-item:hover { background: var(--beige); }
.chat-room-item.active { background: var(--green-bg); border-left: 3px solid var(--green); }
.chat-room-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.chat-room-info { flex: 1; min-width: 0; }
.chat-room-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room-meta { font-size: 0.75rem; color: var(--muted); }

.chat-main { display: flex; flex-direction: column; overflow: hidden; background: var(--beige); }
.chat-header {
  padding: 0.7rem 1rem; background: var(--white);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
.chat-header-info { display: flex; align-items: center; gap: 0.6rem; }
.chat-header-name { font-weight: 700; font-size: 0.95rem; }
.chat-header-status { font-size: 0.75rem; color: var(--muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.chat-input-bar { padding: 0.6rem 1rem; background: var(--white); border-top: 1px solid var(--border-soft); display: flex; gap: 0.4rem; align-items: flex-end; }
.chat-input-bar textarea { flex: 1; min-height: 40px; max-height: 100px; resize: none; border: none; border-radius: 20px; background: var(--beige); padding: 0.5rem 1rem; font-size: 0.9rem; }

@media (max-width: 768px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
}

/* ============ REELS ============ */
.reels-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.reel-card {
  background: var(--ink); border-radius: var(--radius-lg); overflow: hidden;
  position: relative; aspect-ratio: 9/16; cursor: pointer; box-shadow: var(--shadow-md);
  transition: transform 0.15s;
}
.reel-card:hover { transform: scale(1.02); }
.reel-video { width: 100%; height: 100%; object-fit: cover; }
.reel-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 0.8rem; color: var(--white);
}
.reel-author { font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; gap: 0.3rem; }
.reel-title { font-size: 0.8rem; opacity: 0.9; margin-top: 0.2rem; }
.reel-views { font-size: 0.72rem; opacity: 0.7; margin-top: 0.15rem; }
.reel-actions {
  position: absolute; right: 0.5rem; bottom: 0.8rem;
  display: flex; flex-direction: column; gap: 0.8rem; align-items: center;
}
.reel-action {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  color: var(--white); font-size: 0.75rem; cursor: pointer;
}
.reel-action .icon { font-size: 1.3rem; }

/* ============ MARKETPLACE ============ */
.market-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; }
.market-card {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; box-shadow: var(--shadow); transition: all 0.15s;
}
.market-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.market-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.market-card-ph { width: 100%; aspect-ratio: 1; background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.market-card-body { padding: 0.5rem 0.7rem; }
.market-price { font-weight: 700; color: var(--green); font-size: 0.95rem; }
.market-title { font-size: 0.85rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.market-meta { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 768px) { .market-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============ FRIENDS ============ */
.friends-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.friend-card {
  background: var(--white); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); text-align: center; padding: 1rem;
}
.friend-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin: 0 auto 0.5rem; display: block; }
.friend-avatar-ph { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 0.5rem; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; color: var(--white); }
.friend-name { font-weight: 600; font-size: 0.92rem; }
.friend-role { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.5rem; }

/* ============ EVENT CARD ============ */
.event-card {
  padding: 0.7rem 0.9rem; background: var(--white); border-radius: var(--radius);
  margin-bottom: 0.4rem; border-left: 3px solid var(--orange);
  transition: box-shadow 0.15s;
}
.event-card:hover { box-shadow: var(--shadow-md); }
.event-date { font-family: 'DM Mono', monospace; font-size: 0.8rem; color: var(--orange); font-weight: 600; }

/* ============ CONTACTS SIDEBAR (right) ============ */
.contact-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.5rem; border-radius: var(--radius); cursor: pointer;
  transition: background 0.1s;
}
.contact-item:hover { background: var(--beige); }
.contact-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.contact-avatar-ph { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--white); flex-shrink: 0; }
.contact-name { font-size: 0.86rem; font-weight: 500; color: var(--ink); }
.contact-online { width: 8px; height: 8px; border-radius: 50%; background: #4caf50; border: 2px solid var(--white); margin-left: auto; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 0.8rem; opacity: 0.4; }

/* ============ TABLE ============ */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border-soft); }
th { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
tr:hover { background: var(--beige-light); }

/* ============ ALERT ============ */
.alert { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 0.8rem; font-size: 0.88rem; }
.alert-error { background: #ffebee; color: #c0392b; }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-info { background: var(--green-bg); color: var(--green); }
.alert-warning { background: var(--orange-bg); color: var(--orange); }

/* ============ AVATAR ============ */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 80px; height: 80px; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-ph { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--white); border-radius: 50%; }

/* ============ TOGGLE SWITCH ============ */
.toggle { position: relative; width: 44px; height: 24px; background: var(--beige-dark); border-radius: 24px; cursor: pointer; transition: background 0.2s; display: inline-block; flex-shrink: 0; }
.toggle.active { background: var(--green); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--white); transition: transform 0.2s; box-shadow: var(--shadow); }
.toggle.active::after { transform: translateX(20px); }

/* ============ TABS ============ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-soft); margin-bottom: 1rem; }
.tab { padding: 0.6rem 1.2rem; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.15s; font-weight: 600; font-size: 0.88rem; }
.tab.active { color: var(--green); border-bottom-color: var(--orange); }
.tab:hover { color: var(--ink); background: var(--beige-light); border-radius: var(--radius) var(--radius) 0 0; }

/* ============ FOOTER ============ */
.footer { padding: 1.5rem; text-align: center; color: var(--muted); font-size: 0.82rem; background: var(--white); border-top: 1px solid var(--border-soft); }

/* ============ MISC ============ */
.hidden { display: none; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: #c0392b; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

/* Avatar color classes */
.av-green { background: var(--green); }
.av-orange { background: var(--orange); }
.av-yellow { background: var(--yellow); color: var(--ink) !important; }
.av-dark { background: var(--green-dark); }
.av-light { background: var(--green-light); }
