/* ===================================================================
   Family Portal - Modern Facebook-Inspired Styling System
   Pure CSS, Responsive, Dark/Light Themes, Admin & Auth
   =================================================================== */

:root {
  --primary: #1877F2;
  --primary-hover: #166fe5;
  --primary-light: #e7f3ff;
  --primary-text: #1877F2;
  
  --bg-main: #f0f2f5;
  --bg-card: #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-hover: #f2f2f2;
  --border-color: #e4e6eb;
  --border-subtle: #f0f2f5;
  
  --text-primary: #050505;
  --text-secondary: #65676b;
  --text-muted: #8a8d91;
  --text-on-primary: #ffffff;
  
  --love-color: #f3425f;
  --warn-color: #f59e0b;
  --success-color: #10b981;
  --admin-badge: #d97706;
  --admin-badge-bg: #fef3c7;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --header-height: 58px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --primary: #2d88ff;
  --primary-hover: #3b90ff;
  --primary-light: #182739;
  --primary-text: #4599ff;
  
  --bg-main: #18191a;
  --bg-card: #242526;
  --bg-subtle: #303031;
  --bg-hover: #3a3b3c;
  --border-color: #393a3b;
  --border-subtle: #2d2e2f;
  
  --text-primary: #e4e6eb;
  --text-secondary: #b0b3b8;
  --text-muted: #8a8d91;
  
  --admin-badge-bg: #3f2e06;
  --admin-badge: #fcd34d;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.7);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===================================================================
   Top Navigation Bar
   =================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 320px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary);
  cursor: pointer;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #1877F2, #4F46E5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 2px 6px rgba(24, 119, 242, 0.35);
}

.nav-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  width: 100%;
}

.nav-search-box svg {
  fill: var(--text-secondary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-search-box input {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  color: var(--text-primary);
  width: 100%;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  flex: 2;
}

.nav-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 20px;
  position: relative;
  color: var(--text-secondary);
  transition: var(--transition);
  border-bottom: 3px solid transparent;
  font-weight: 600;
  font-size: 0.85rem;
  gap: 4px;
}

.nav-tab-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-tab-btn:hover {
  background-color: var(--bg-hover);
  border-radius: var(--radius-sm);
  color: var(--primary);
}

.nav-tab-btn.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
}

.nav-tab-badge {
  position: absolute;
  top: 6px;
  right: 14px;
  background-color: var(--love-color);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
}

.nav-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: var(--transition);
  position: relative;
}

.nav-icon-btn:hover {
  background-color: var(--bg-hover);
  transform: translateY(-1px);
}

.nav-icon-btn svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.user-profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  background-color: var(--bg-main);
  cursor: pointer;
  transition: var(--transition);
}

.user-profile-chip:hover {
  background-color: var(--bg-hover);
}

.user-dropdown-card {
  position: absolute;
  right: 0;
  top: 50px;
  width: 280px;
  z-index: 1000;
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
}

.user-dropdown-card.open {
  display: block;
}

.user-switch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.user-switch-item.active {
  background-color: var(--primary-light);
}

.badge-admin {
  background: var(--admin-badge-bg);
  color: var(--admin-badge);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1.5px solid var(--border-color);
}

.avatar-lg {
  width: 44px;
  height: 44px;
}

.avatar-xl {
  width: 60px;
  height: 60px;
}

.user-name-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================================================
   Cover Banner & Group Header
   =================================================================== */
.group-header-wrapper {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.group-header-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.cover-photo-container {
  position: relative;
  width: 100%;
  height: 260px;
  overflow: hidden;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  background: #2b3945;
}

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

.cover-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.65) 100%);
}

.group-details-bar {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.group-meta-title h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-meta-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--text-secondary);
}

.members-avatar-stack {
  display: flex;
  align-items: center;
}

.members-avatar-stack img {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-card);
  margin-left: -7px;
}

.members-avatar-stack img:first-child {
  margin-left: 0;
}

.group-action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

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

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

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

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-pill {
  border-radius: var(--radius-full);
}

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

/* ===================================================================
   Main 3-Column Layout
   =================================================================== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: grid;
  grid-template-columns: 280px 1fr 310px;
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===================================================================
   Cards & Widgets
   =================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.92rem;
  transition: var(--transition);
  cursor: pointer;
}

.sidebar-menu-item:hover, .sidebar-menu-item.active {
  background-color: var(--bg-hover);
  color: var(--primary);
}

.sidebar-menu-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Birthday Widget */
.birthday-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.birthday-item:last-child {
  border-bottom: none;
}

.birthday-cake-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: #fef3c7;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.birthday-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
}

.birthday-info p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ===================================================================
   Center Wall / Feed Components
   =================================================================== */
.feed-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Pinned Announcement Banner */
.pinned-banner {
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.08), rgba(79, 70, 229, 0.08));
  border: 1.5px solid rgba(24, 119, 242, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  gap: 14px;
  position: relative;
}

.pinned-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.pinned-banner-content h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--primary-text);
  margin-bottom: 4px;
}

.pinned-banner-content p {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.45;
}

/* Create Post Box */
.create-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.create-post-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.create-post-prompt-btn {
  background: var(--bg-main);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: left;
  flex: 1;
  transition: var(--transition);
  cursor: pointer;
}

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

.create-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-top: 10px;
}

.create-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}

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

.create-action-btn.photo-action { color: #45bd62; }
.create-action-btn.event-action { color: #f7b125; }
.create-action-btn.poll-action  { color: #2e89ff; }
.create-action-btn.feeling-action { color: #eab308; }

/* Filter Tabs on Feed */
.feed-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: var(--transition);
}

.filter-chip:hover, .filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===================================================================
   Post Cards
   =================================================================== */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.post-author-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-meta h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.relation-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
}

.post-time-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.feeling-badge {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.82rem;
}

.post-pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(24, 119, 242, 0.1);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.post-content {
  padding: 4px 16px 12px;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.post-photos-grid {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  background: #000;
}

.post-photos-grid.count-1 { grid-template-columns: 1fr; }
.post-photos-grid.count-2 { grid-template-columns: 1fr 1fr; }
.post-photos-grid.count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }

.post-photo-item {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.2s;
}

.post-photo-item:hover {
  opacity: 0.95;
}

/* Post Stats Row */
.post-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.reactions-preview {
  display: flex;
  align-items: center;
  gap: 4px;
}

.reaction-bubble {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

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

.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  transition: var(--transition);
}

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

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

.post-action-btn.active-love {
  color: var(--love-color);
}

/* Comments Section */
.comments-section {
  padding: 12px 16px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.comment-bubble {
  background: var(--bg-main);
  padding: 8px 14px;
  border-radius: 16px;
  max-width: 85%;
  position: relative;
}

.comment-author-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.comment-text {
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-primary);
}

.comment-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.comment-input-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border-radius: var(--radius-full);
  padding: 6px 14px;
}

.comment-input-box input {
  background: transparent;
  border: none;
  font-size: 0.88rem;
  color: var(--text-primary);
  width: 100%;
}

.comment-send-btn {
  color: var(--primary);
  padding: 4px 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===================================================================
   Events View Styling
   =================================================================== */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.event-banner {
  position: relative;
  height: 160px;
  background: #2b3945;
}

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

.event-date-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.event-date-badge .month {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--love-color);
  text-transform: uppercase;
}

.event-date-badge .day {
  font-size: 1.35rem;
  font-weight: 800;
  color: #111;
  line-height: 1;
}

.event-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.event-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.event-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.event-meta-line svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.event-rsvp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 8px;
}

.rsvp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rsvp-btn {
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--text-secondary);
  transition: var(--transition);
}

.rsvp-btn.selected-going {
  background: var(--success-color);
  color: #fff;
}

.rsvp-btn.selected-maybe {
  background: var(--warn-color);
  color: #fff;
}

.rsvp-btn.selected-cantGo {
  background: var(--text-muted);
  color: #fff;
}

/* ===================================================================
   Photos & Albums View Styling
   =================================================================== */
.album-nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.photos-masonry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.photo-thumb-wrapper {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
}

.photo-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.photo-thumb-wrapper:hover img {
  transform: scale(1.04);
}

.photo-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.7) 100%);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-thumb-wrapper:hover .photo-thumb-overlay {
  opacity: 1;
}

/* ===================================================================
   Members Directory View Styling
   =================================================================== */
.members-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.member-card .avatar-xl {
  margin-bottom: 12px;
  border: 3px solid var(--primary-light);
}

.member-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.member-card .member-role {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}

.member-card .member-bio {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin: 8px 0 14px;
  line-height: 1.4;
}

.member-contact-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: auto;
}

/* ===================================================================
   Polls View Styling
   =================================================================== */
.poll-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.poll-question {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.poll-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.poll-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.poll-option-row {
  position: relative;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--transition);
}

.poll-option-row:hover {
  border-color: var(--primary);
}

.poll-option-row.voted {
  border-color: var(--primary);
  background: var(--primary-light);
}

.poll-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(24, 119, 242, 0.2);
  transition: width 0.4s ease;
}

.poll-option-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 600;
}

/* ===================================================================
   Admin Panel View Styling
   =================================================================== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.admin-table th, .admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.admin-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.admin-table tr:hover {
  background: var(--bg-hover);
}

.admin-action-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===================================================================
   Modal Components
   =================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-container-lg {
  max-width: 760px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-secondary);
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.92rem;
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--bg-card);
}

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

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-container {
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-container img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-caption {
  color: #fff;
  margin-top: 12px;
  font-size: 1rem;
  text-align: center;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===================================================================
   Initial Screen: Dedicated Sign-In / Welcome Screen
   =================================================================== */
.auth-screen-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-color: var(--bg-main);
}

.auth-screen-container {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.auth-hero-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-logo-icon {
  width: 50px;
  height: 50px;
  font-size: 1.6rem;
}

.auth-brand-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.auth-hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.auth-hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-info-card {
  background: var(--admin-badge-bg);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 8px;
}

.auth-info-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--admin-badge);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.auth-info-creds {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.auth-code {
  background: var(--bg-card);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-card-wrapper {
  width: 100%;
}

.auth-card {
  box-shadow: var(--shadow-lg);
  padding: 24px;
  border-radius: var(--radius-lg);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.auth-tab-btn {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

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

.auth-error-box {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 14px;
}

[data-theme="dark"] .auth-error-box {
  background: #3c1618;
  color: #fca5a5;
  border-color: #5c1d24;
}

/* ===================================================================
   Mobile Bottom Navigation Bar
   =================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    z-index: 999;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    gap: 3px;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  .mobile-nav-btn.active {
    color: var(--primary);
  }

  .mobile-nav-btn:active {
    transform: scale(0.92);
  }
}

/* ===================================================================
   Responsive Mobile Adjustments
   =================================================================== */
@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 240px 1fr;
  }
  .right-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Prevent iOS zoom on input focus */
  input, textarea, select {
    font-size: 16px !important;
  }

  .top-nav {
    padding: 0 12px;
    height: 54px;
  }

  .nav-left {
    max-width: none;
    flex: 1;
  }

  .nav-search-box {
    display: none; /* Accessible in full feed or search overlay */
  }

  .nav-center {
    display: none; /* Moved to bottom navigation bar */
  }

  .nav-right {
    gap: 6px;
  }

  .user-name-label {
    display: none; /* Keep avatar and crown on mobile top bar */
  }

  .user-profile-chip {
    padding: 3px;
  }

  .main-container {
    grid-template-columns: 1fr;
    padding: 0 8px 30px;
    gap: 14px;
  }

  .left-sidebar {
    display: none;
  }

  /* Cover Banner on mobile */
  .cover-photo-container {
    height: 160px;
    border-radius: 0;
  }

  .group-details-bar {
    padding: 12px 14px;
  }

  .group-meta-title h1 {
    font-size: 1.25rem;
  }

  .group-action-buttons {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-top: 4px;
  }

  .group-action-buttons::-webkit-scrollbar {
    display: none;
  }

  .group-action-buttons .btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 7px 14px;
    font-size: 0.85rem;
  }

  /* Feed on mobile */
  .feed-column {
    gap: 12px;
  }

  .card, .post-card {
    border-radius: var(--radius-sm);
    padding: 12px;
  }

  .create-post-actions {
    overflow-x: auto;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 8px;
  }

  .create-action-btn {
    padding: 6px 10px;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  .feed-filter-bar {
    padding-bottom: 2px;
  }

  .filter-chip {
    padding: 5px 12px;
    font-size: 0.8rem;
  }

  .post-header {
    padding: 10px 12px 6px;
  }

  .post-content {
    padding: 4px 12px 10px;
    font-size: 0.92rem;
  }

  .post-actions-row {
    padding: 2px;
  }

  .post-action-btn {
    font-size: 0.82rem;
    padding: 10px 0;
  }

  .comments-section {
    padding: 10px 12px;
  }

  /* Events on mobile */
  .events-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .event-banner {
    height: 140px;
  }

  /* Photos on mobile */
  .photos-masonry-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Members directory on mobile */
  .members-directory-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .member-card {
    padding: 16px;
  }

  /* Admin Table converted to responsive cards on mobile */
  .admin-table {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .admin-table tr {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    gap: 8px;
  }

  .admin-table td {
    padding: 2px 0;
    border-bottom: none;
  }

  .admin-action-btns {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-action-btns .btn {
    flex: 1;
    min-width: 90px;
  }

  /* Modals on mobile (bottom sheet feel) */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    max-height: 88vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    animation: slideUpModal 0.25s ease;
  }

  @keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
    gap: 12px;
  }

  .modal-footer {
    padding: 12px 16px;
  }
}
