/* ============================================================
   SomDual - Main Stylesheet
   Mobile-First Social Network
   ============================================================ */

:root {
  --primary: #1877f2;
  --primary-dark: #166fe5;
  --primary-light: #e7f0fd;
  --secondary: #42b72a;
  --danger: #e53935;
  --warning: #fb8c00;
  --success: #2e7d32;
  --text-primary: #1c1e21;
  --text-secondary: #65676b;
  --text-muted: #8a8d91;
  --bg-primary: #f0f2f5;
  --bg-card: #ffffff;
  --bg-hover: #f2f2f2;
  --border: #e4e6eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --nav-height: 56px;
  --bottom-nav-height: 60px;
  --transition: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Mode */
[data-theme="dark"] {
  --primary: #2d88ff;
  --primary-light: #1a2d4d;
  --text-primary: #e4e6eb;
  --text-secondary: #b0b3b8;
  --text-muted: #8a8d91;
  --bg-primary: #18191a;
  --bg-card: #242526;
  --bg-hover: #3a3b3c;
  --border: #3a3b3c;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: var(--bottom-nav-height);
}

body.no-bottom-nav {
  padding-bottom: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

button, .btn {
  cursor: pointer;
  font-family: var(--font);
  border: none;
  outline: none;
  transition: var(--transition);
}

input, textarea, select {
  font-family: var(--font);
  outline: none;
}

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

.nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-search {
  flex: 1;
  max-width: 240px;
  position: relative;
}

.nav-search input {
  width: 100%;
  height: 36px;
  background: var(--bg-primary);
  border: none;
  border-radius: 20px;
  padding: 0 16px 0 38px;
  font-size: 14px;
  color: var(--text-primary);
}

.nav-search input::placeholder {
  color: var(--text-muted);
}

.nav-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 18px;
  position: relative;
  text-decoration: none;
  transition: var(--transition);
}

.nav-btn:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

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

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

/* ============ BOTTOM NAVIGATION ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 22px;
  position: relative;
  transition: var(--transition);
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item:hover {
  color: var(--primary);
  text-decoration: none;
  background: var(--bg-hover);
}

.bottom-nav-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: var(--transition);
}

.bottom-nav-item.active::after {
  transform: scaleX(0.6);
}

/* ============ LAYOUT ============ */
.page-wrapper {
  padding-top: calc(var(--nav-height) + 12px);
  max-width: 680px;
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

.container {
  padding: 0 12px;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 8px;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-success {
  background: var(--secondary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-hover);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-icon {
  padding: 8px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--bg-hover);
}

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control.error {
  border-color: var(--danger);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.input-group {
  position: relative;
}

.input-group i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-group input {
  padding-left: 42px;
}

.input-group .input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-muted);
}

/* ============ ALERTS ============ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-danger { background: #ffebee; color: #c62828; }
.alert-warning { background: #fff8e1; color: #f57f17; }
.alert-info { background: #e3f2fd; color: #1565c0; }

[data-theme="dark"] .alert-success { background: #1b3a1f; color: #69f0ae; }
[data-theme="dark"] .alert-danger { background: #3e1212; color: #ef9a9a; }
[data-theme="dark"] .alert-warning { background: #3d2c00; color: #ffcc80; }
[data-theme="dark"] .alert-info { background: #0d2847; color: #82b1ff; }

/* ============ AUTH PAGES ============ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
}

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo .logo-text {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============ POST CARD ============ */
.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}

.post-header {
  display: flex;
  align-items: center;
  padding: 12px 16px 8px;
  gap: 10px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-user-info {
  flex: 1;
  min-width: 0;
}

.post-username {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-username:hover {
  text-decoration: underline;
  color: var(--text-primary);
}

.verified-badge {
  color: var(--primary);
  font-size: 14px;
}

.post-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-menu {
  margin-left: auto;
  flex-shrink: 0;
}

.post-content {
  padding: 0 16px 8px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-content.expanded { max-height: none; }

.post-media {
  width: 100%;
  cursor: pointer;
}

.post-media-single img,
.post-media-single video {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
}

.post-media-grid {
  display: grid;
  gap: 2px;
}

.post-media-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.post-media-grid.grid-3 { grid-template-columns: 1fr 1fr; }
.post-media-grid.grid-3 .media-item:first-child { grid-column: 1 / -1; }
.post-media-grid.grid-4 { grid-template-columns: 1fr 1fr; }

.media-item {
  position: relative;
  overflow: hidden;
  background: #000;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.media-item.tall img,
.media-item.tall video {
  height: 300px;
}

.media-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 700;
}

.post-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.post-actions {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.post-action-btn:hover {
  background: var(--bg-hover);
}

.post-action-btn.liked {
  color: var(--primary);
}

.post-action-btn i {
  font-size: 18px;
}

/* ============ CREATE POST ============ */
.create-post {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.create-post-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.create-post-input {
  flex: 1;
  background: var(--bg-primary);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
}

.create-post-actions {
  display: flex;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.create-post-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
}

.create-post-action:hover {
  background: var(--bg-hover);
}

.create-post-action i {
  font-size: 18px;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-center {
  align-items: center;
}

.modal-center .modal {
  border-radius: var(--radius);
  max-width: 480px;
  transform: scale(0.95);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 18px;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
}

.modal-body {
  padding: 16px;
}

/* ============ COMMENT SECTION ============ */
.comments-section {
  padding: 8px 16px 12px;
}

.comment-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.comment-input {
  flex: 1;
  background: var(--bg-primary);
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-primary);
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.4;
}

.comment-item {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-bubble {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 8px 12px;
  flex: 1;
}

.comment-author {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
}

.comment-text {
  font-size: 14px;
  margin-top: 2px;
}

.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 40px;
}

.comment-action {
  cursor: pointer;
  font-weight: 600;
}

.comment-action:hover { color: var(--primary); }

/* ============ PROFILE ============ */
.profile-cover {
  height: 200px;
  background: linear-gradient(135deg, var(--primary), #764ba2);
  position: relative;
  overflow: hidden;
}

.profile-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-cover-edit {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-info {
  padding: 0 16px 16px;
  position: relative;
  background: var(--bg-card);
}

.profile-avatar-wrap {
  display: flex;
  align-items: flex-end;
  margin-top: -40px;
  margin-bottom: 12px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow);
}

.profile-avatar-edit {
  position: relative;
  cursor: pointer;
}

.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-name {
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-username {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
}

.profile-bio {
  margin: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.profile-stats {
  display: flex;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 12px 0;
}

.profile-stat {
  text-align: center;
  cursor: pointer;
}

.profile-stat-num {
  font-weight: 700;
  font-size: 16px;
}

.profile-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ USER LIST ============ */
.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  transition: var(--transition);
}

.user-item:hover {
  background: var(--bg-hover);
}

.user-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-item-info {
  flex: 1;
  min-width: 0;
}

.user-item-name {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-item-sub {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary);
  border: 2px solid var(--bg-card);
  position: absolute;
  bottom: 0;
  right: 0;
}

/* ============ AD CARD ============ */
.ad-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  overflow: hidden;
}

.ad-label {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ad-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
}

.ad-sponsor-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 18px;
}

.ad-title {
  font-weight: 700;
  font-size: 14px;
}

.ad-cta-wrap {
  padding: 0 16px 12px;
}

.ad-cta {
  display: block;
  text-align: center;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
}

.ad-cta:hover {
  background: var(--primary-dark);
  color: white;
  text-decoration: none;
}

/* ============ MESSAGES ============ */
.conversation-list { background: var(--bg-card); }

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.conversation-item:hover {
  background: var(--bg-hover);
}

.conversation-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.conversation-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.conversation-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-preview.unread {
  color: var(--text-primary);
  font-weight: 600;
}

.conversation-meta {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.unread-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 7px;
  margin-top: 4px;
  display: inline-block;
}

/* Chat window */
.chat-window {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - var(--bottom-nav-height));
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-height);
  z-index: 100;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-bubble {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.message-bubble.sent {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  background: var(--bg-primary);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message-time {
  font-size: 11px;
  margin-top: 2px;
  opacity: 0.7;
}

.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.chat-send-btn:hover { background: var(--primary-dark); }

/* ============ NOTIFICATIONS ============ */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.notification-item.unread {
  background: var(--primary-light);
}

.notification-item:hover { background: var(--bg-hover); }

.notification-icon-wrap {
  position: relative;
  flex-shrink: 0;
}

.notification-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.notification-type-icon {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 2px solid var(--bg-card);
  color: white;
}

.notification-type-icon.like { background: var(--danger); }
.notification-type-icon.comment { background: var(--primary); }
.notification-type-icon.follow { background: var(--secondary); }
.notification-type-icon.message { background: var(--primary); }

.notification-text {
  flex: 1;
  font-size: 14px;
}

.notification-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============ SEARCH ============ */
.search-bar {
  padding: 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border: none;
  border-radius: 20px;
  background: var(--bg-primary);
  font-size: 15px;
  color: var(--text-primary);
}

/* ============ ADMIN ============ */
.admin-sidebar {
  display: none;
}

.admin-main {
  padding: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 8px;
}

.stat-card .stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-tab {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.admin-tab-btn {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
}

.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============ DROPDOWN ============ */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  min-width: 180px;
  z-index: 500;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95) translateY(-5px);
  transform-origin: top right;
  transition: all 0.15s ease;
}

.dropdown-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: scale(1) translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  text-decoration: none;
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
}

/* ============ LOADING ============ */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-posts {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
}

/* ============ SKELETON ============ */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-hover) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-xs);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-img { height: 200px; border-radius: 0; }

/* ============ TOAST ============ */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  background: #323232;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  max-width: 400px;
  text-align: center;
  pointer-events: all;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ SETTINGS ============ */
.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
  overflow: hidden;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px 4px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--bg-hover); }

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 16px;
}

.settings-item-label {
  font-weight: 600;
  font-size: 15px;
}

.settings-item-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ============ PAGE TABS ============ */
.page-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-height);
  z-index: 100;
}

.page-tab {
  flex: 1;
  padding: 14px 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  border: none;
  background: none;
}

.page-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============ MEDIA VIEWER ============ */
.media-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-viewer img,
.media-viewer video {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
}

.media-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  color: white;
  font-size: 28px;
  cursor: pointer;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ RESPONSIVE ============ */
@media (min-width: 768px) {
  .page-wrapper {
    padding-left: 24px;
    padding-right: 24px;
  }

  .modal {
    border-radius: var(--radius);
    margin-bottom: 20px;
    max-width: 520px;
  }

  .modal-overlay {
    align-items: center;
  }

  .auth-card {
    padding: 40px;
  }
}

@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  
  .bottom-nav { display: none; }
  
  .top-nav {
    padding: 0 24px;
    justify-content: center;
    gap: 0;
  }
  
  .nav-logo {
    margin-right: auto;
    flex: 1;
  }
  
  .nav-actions { flex: 1; justify-content: flex-end; }
  
  .nav-search { max-width: 300px; margin: 0 16px; }
  
  .page-wrapper {
    padding-top: calc(var(--nav-height) + 24px);
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    max-width: 1100px;
    padding-left: 24px;
    padding-right: 24px;
    align-items: start;
  }
  
  .desktop-sidebar {
    display: block;
    position: sticky;
    top: calc(var(--nav-height) + 24px);
  }
  
  .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 2px;
  }
  
  .sidebar-nav-item:hover {
    background: var(--bg-hover);
    text-decoration: none;
    color: var(--text-primary);
  }
  
  .sidebar-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
  }
  
  .sidebar-nav-item i {
    font-size: 22px;
    width: 28px;
    text-align: center;
  }
  
  .admin-sidebar {
    display: block;
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - var(--nav-height));
    padding: 16px 0;
  }
  
  .admin-layout {
    display: flex;
    padding-top: var(--nav-height);
  }
  
  .admin-main {
    flex: 1;
    padding: 24px;
    overflow: auto;
  }
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }
.hidden { display: none !important; }
.flex-1 { flex: 1; }
