/* ==========================================================================
   Communitaz Web App Stylesheet
   Modern, Fully Fluid & Responsive Single-Page Application Design
   Dynamically adapts to any window size from 320px mobile to ultra-wide
   ========================================================================== */

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --primary-gradient: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #DB2777 100%);
  --secondary: #0D9488;
  --secondary-light: #F0FDFA;
  --accent: #DB2777;
  --gold: #F59E0B;
  --gold-light: #FEF3C7;
  --success: #10B981;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-sub: #64748B;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-hover: #F1F5F9;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  --sidebar-width: 240px;
  --header-height: 60px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 10px 30px rgba(79, 70, 229, 0.22);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #818CF8;
    --primary-hover: #6366F1;
    --primary-light: #1E1B4B;
    --secondary: #2DD4BF;
    --secondary-light: #134E4A;
    --accent: #F472B6;
    --text-main: #F8FAFC;
    --text-muted: #CBD5E1;
    --text-sub: #94A3B8;
    --bg-page: #0B0F19;
    --bg-card: #141C2E;
    --bg-hover: #1E293B;
    --border: #232E42;
    --border-light: #1A2333;
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 10px 30px rgba(99, 102, 241, 0.28);
  }
}

/* ==========================================================================
   Universal Reset & Fluid Box Model
   ========================================================================== */
html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

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

/* ==========================================================================
   App Header (Dynamic & Fluid)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 12px;
}

@media (prefers-color-scheme: dark) {
  .app-header {
    background: rgba(20, 28, 46, 0.94);
  }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-main);
  flex-shrink: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.brand-text span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 280px;
  min-width: 0;
}

.header-search input {
  width: 100%;
  min-width: 0;
  padding: 7px 12px 7px 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.header-search svg {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--text-sub);
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Auth-dependent visibility */
body.user-logged-out .auth-only,
body:not(.user-logged-in) .auth-only,
body.user-logged-out #btn-create-header,
body:not(.user-logged-in) #btn-create-header,
body.user-logged-out .btn-create-header,
body:not(.user-logged-in) .btn-create-header {
  display: none !important;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF !important;
  box-shadow: 0 3px 12px rgba(79, 70, 229, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(79, 70, 229, 0.32);
}

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

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-sub);
}

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

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

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   User Profile Pill in Header
   ========================================================================== */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

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

.user-avatar-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-display-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Layout: App Shell (Sidebar + Main Content)
   ========================================================================== */
.app-shell {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: hidden;
  min-width: 0;
  min-height: calc(100vh - var(--header-height));
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-sub);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

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

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

.sidebar-footer-card {
  background: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 16px;
  text-align: center;
}

.sidebar-footer-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.sidebar-footer-card p {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ==========================================================================
   Main Content Area (Fluid & Constrained)
   ========================================================================== */
.app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 24px 28px;
  overflow-x: hidden;
}

.app-main > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* View Header */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.view-title-group {
  flex: 1;
  min-width: 200px;
}

.view-title-group h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.25;
}

.view-title-group p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Segmented View Mode Toggle */
.tab-pill-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.toggle-pill {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.toggle-pill:hover {
  color: var(--text-main);
}

.toggle-pill.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Filter Bar Container & Sleek Horizontal Scrolling */
.filter-bar-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 22px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 4px 4px 8px;
  margin-bottom: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-bar.grabbing {
  cursor: grabbing;
  user-select: none;
}

.filter-pill {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.filter-pill:hover {
  background: var(--bg-hover);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--text-main);
  transform: translateY(-1px);
}

.filter-pill.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  font-weight: 700;
  transform: translateY(-1px);
}

/* Hierarchical Filter Bar (Community Types / Groups & Sub-communities) */
.filter-bar-hierarchy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.filter-bar-groups {
  margin-bottom: 0;
}

.filter-bar-subcategories {
  margin-bottom: 0;
  padding-top: 0;
}

.filter-pill.sub-pill {
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--bg-page);
  border-color: var(--border);
}

.filter-pill.sub-pill:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.filter-pill.sub-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  font-weight: 700;
}

/* Community Group Chip on Card Cover */
.community-group-chip {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Distinct Community Type / Group Badge */
.community-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .community-group-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
    color: #A5B4FC;
    border-color: rgba(165, 180, 252, 0.35);
  }
}

/* ==========================================================================
   Grids & Cards (Fluid Responsive Matrix)
   ========================================================================== */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Community Card */
.community-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  cursor: pointer;
}

.community-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(0, 0, 0, 0.12);
  border-color: rgba(99, 102, 241, 0.4);
}

.community-cover {
  height: 124px;
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  position: relative;
  overflow: hidden;
}

.community-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.community-card:hover .community-cover img {
  transform: scale(1.04);
}

.community-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

.community-city-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.community-privacy-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.community-privacy-badge.badge-closed {
  background: rgba(180, 83, 9, 0.85);
  border-color: rgba(253, 230, 138, 0.45);
  color: #FEF3C7;
}

.community-privacy-badge.badge-open {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.community-privacy-badge.badge-hidden {
  background: rgba(67, 56, 202, 0.9);
  border-color: rgba(199, 210, 254, 0.5);
  color: #EEF2FF;
}

.btn-pending {
  background: #F3F4F6 !important;
  color: #6B7280 !important;
  border: 1px solid #D1D5DB !important;
  cursor: not-allowed !important;
  opacity: 0.95;
}

.community-privacy-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.community-privacy-tag.tag-open {
  background: var(--primary-light);
  color: var(--primary);
}

.community-privacy-tag.tag-closed {
  background: #FEF3C7;
  color: #92400E;
}

.community-privacy-tag.tag-hidden {
  background: #EEF2FF;
  color: #4338CA;
}

@media (prefers-color-scheme: dark) {
  .btn-pending {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #9CA3AF !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
  }
  .community-privacy-tag.tag-closed {
    background: rgba(245, 158, 11, 0.2);
    color: #FCD34D;
  }
  .community-privacy-tag.tag-hidden {
    background: rgba(99, 102, 241, 0.25);
    color: #C7D2FE;
  }
}

/* Card Header Bar with Unclipped Avatar + Member counter */
.community-card-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 16px;
  margin-top: -24px;
  position: relative;
  z-index: 3;
}

.community-avatar-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  border: 3px solid var(--bg-card);
  background: var(--bg-card);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.community-avatar-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.community-members-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
}

.community-body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.community-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 5px;
  line-height: 1.32;
  word-break: break-word;
}

.community-tagline {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 12px;
  min-height: 38px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  min-height: 24px;
}

.category-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  color: var(--text-sub);
}

.community-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.community-footer .btn-details {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 12.5px;
}

.community-footer .btn-join {
  flex: 1;
  min-width: 0;
  padding: 6px 14px;
  font-size: 12.5px;
  white-space: nowrap;
}

/* Event Card */
.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.event-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -6px rgba(0, 0, 0, 0.12);
  border-color: rgba(99, 102, 241, 0.4);
}

.event-cover {
  height: 130px;
  width: 100%;
  background: linear-gradient(135deg, #0D9488 0%, #3B82F6 100%);
  position: relative;
  overflow: hidden;
}

.event-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.event-card:hover .event-cover img {
  transform: scale(1.04);
}

.event-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

.event-date-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 4px 9px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.event-date-month {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.event-date-day {
  font-size: 16px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.1;
}

.event-price-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.event-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.event-community-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.event-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.35;
  word-break: break-word;
}

.event-meta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.event-meta-row svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-sub);
}

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

.event-spots-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
}

/* ==========================================================================
   Feed & Posts View
   ========================================================================== */
.feed-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.post-composer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.composer-row {
  display: flex;
  gap: 12px;
}

.composer-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--bg-page);
  color: var(--text-main);
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border 0.2s ease;
}

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

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.post-author-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
}

.post-time {
  font-size: 11.5px;
  color: var(--text-sub);
}

.post-community-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 7px;
  border-radius: 6px;
}

.post-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.post-content {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-line;
  margin-bottom: 14px;
  word-break: break-word;
}

.post-footer {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
}

.post-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

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

.comments-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-item {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
}

.comment-bubble {
  background: var(--bg-page);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  flex: 1;
}

/* ==========================================================================
   Chat / Messages View
   ========================================================================== */
.chat-container {
  display: flex;
  height: calc(100vh - var(--header-height) - 60px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.chat-sidebar {
  width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid var(--border-light);
}

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

.conversation-item.active {
  background: var(--primary-light);
}

.conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

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

.conv-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-last-msg {
  font-size: 11.5px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-window {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
}

.chat-window-header {
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.message-bubble {
  max-width: 75%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}

.message-bubble.incoming {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

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

.message-sender-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.message-time {
  font-size: 10px;
  opacity: 0.75;
  text-align: right;
  margin-top: 3px;
}

.chat-input-area {
  padding: 12px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
}

.chat-input-area input:focus {
  border-color: var(--primary);
}

/* ==========================================================================
   Profile View
   ========================================================================== */
.profile-container {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  width: 100%;
}

.profile-cover {
  height: 120px;
  background: var(--primary-gradient);
  position: relative;
}

.profile-info-row {
  padding: 0 20px 20px;
  position: relative;
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--bg-card);
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
  margin-top: -36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  overflow: hidden;
}

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

.profile-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 10px;
}

.profile-email {
  font-size: 12.5px;
  color: var(--text-sub);
}

.profile-bio {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: 12px;
  word-break: break-word;
}

.profile-stats-row {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.stat-box {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-sub);
}

/* ==========================================================================
   Modals (Mobile-Responsive & Scrollable)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 0.22s ease;
  position: relative;
  box-sizing: border-box;
}

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

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

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s ease;
}

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

.modal-body {
  padding: 20px;
}

/* Form Groups */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Modal Tabs (Sign In vs Sign Up) */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.modal-tab-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  background: none;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

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

/* 6-Digit OTP Verification Component */
.otp-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 22px;
}

.otp-digit {
  width: 44px;
  height: 52px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  caret-color: var(--primary);
  box-sizing: border-box;
}

.otp-digit:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.otp-digit.filled {
  border-color: var(--primary);
  background: var(--bg-card);
}

.btn-link-action {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-link-action:hover {
  text-decoration: underline;
  background: var(--primary-light);
}

.btn-link-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: none;
}

/* ==========================================================================
   30-Day Verification & Account Policy (matches Flutter app)
   ========================================================================== */

/* Signup Policy Notice Box */
.signup-policy-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md, 12px);
  padding: 13px 15px;
  margin: 14px 0 12px;
  box-sizing: border-box;
}

.signup-policy-box .policy-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #D97706;
}

.signup-policy-box .policy-title {
  font-size: 13px;
  font-weight: 700;
  color: #78350F;
}

.signup-policy-box p {
  font-size: 12.5px;
  color: #78350F;
  line-height: 1.45;
  margin: 0;
}

/* Signup Policy Checkbox Row */
.signup-policy-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 16px;
  cursor: pointer;
  user-select: none;
}

.signup-policy-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.signup-policy-check span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}

/* Post-Signup Confirmation View in Modal */
.signup-success-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  background: #ECFDF5;
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
}

/* Verification Warning Banner (Top of shell) */
.verification-banner {
  margin: 16px 24px 0;
  padding: 14px 18px;
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.08);
  box-sizing: border-box;
  animation: bannerSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bannerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.verification-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.verification-banner-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.15);
  color: #D97706;
  display: flex;
  align-items: center;
  justify-content: center;
}

.verification-banner-content {
  flex: 1;
  min-width: 0;
}

.verification-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.verification-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
}

.verification-banner-dismiss {
  background: transparent;
  border: none;
  color: #92400E;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.verification-banner-dismiss:hover {
  background: rgba(217, 119, 6, 0.15);
}

.verification-banner-desc {
  font-size: 12.5px;
  color: #78350F;
  line-height: 1.45;
  margin: 0 0 10px 0;
}

.verification-banner-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-resend-verification {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #78350F;
  background: #FDE68A;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-resend-verification:hover:not(:disabled) {
  background: #FBBF24;
  transform: translateY(-1px);
}

.btn-resend-verification:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 768px) {
  .verification-banner {
    margin: 12px 14px 0;
    padding: 12px 14px;
  }
  .verification-banner-inner {
    gap: 10px;
  }
  .verification-banner-icon {
    width: 32px;
    height: 32px;
  }
  .verification-banner-icon svg {
    width: 16px;
    height: 16px;
  }
  .verification-banner-title {
    font-size: 13px;
  }
  .verification-banner-desc {
    font-size: 12px;
  }
}

@media (prefers-color-scheme: dark) {
  .signup-policy-box {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
  }
  .signup-policy-box .policy-header {
    color: #FCD34D;
  }
  .signup-policy-box .policy-title {
    color: #FCD34D;
  }
  .signup-policy-box p {
    color: #FDE68A;
  }
  .verification-banner {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }
  .verification-banner-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #FCD34D;
  }
  .verification-banner-title {
    color: #FCD34D;
  }
  .verification-banner-desc {
    color: #FDE68A;
  }
  .verification-banner-dismiss {
    color: #FCD34D;
  }
  .btn-resend-verification {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.45);
    color: #FEF3C7;
  }
  .btn-resend-verification:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.38);
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 90vw;
}

.toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: #0F172A;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s ease;
}

.toast.success {
  background: #065F46;
}

.toast.error {
  background: #991B1B;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  max-width: 480px;
  margin: 30px auto;
  width: 100%;
  box-sizing: border-box;
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ==========================================================================
   Mobile Bottom Navigation Bar
   ========================================================================== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  .mobile-nav {
    background: rgba(20, 28, 46, 0.96);
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-sub);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
  text-decoration: none;
  flex: 1;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

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

/* ==========================================================================
   Community Detail Workspace (matches Flutter app's CommunityDetailScreen)
   ========================================================================== */

.community-detail-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 0 40px;
  width: 100%;
}

.community-detail-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.btn-back-community {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-full);
}

.community-detail-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.community-detail-cover {
  height: 220px;
  width: 100%;
  position: relative;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  overflow: hidden;
}

.community-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.community-detail-body {
  padding: 0 24px 24px;
  position: relative;
}

.community-detail-avatar-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: -42px;
  margin-bottom: 16px;
  position: relative;
  z-index: 4;
}

.community-detail-avatar {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  border: 4px solid var(--bg-card);
  background: var(--bg-card);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
}

.community-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-detail-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.community-detail-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.25;
}

.community-detail-tagline {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.community-detail-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.community-detail-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.community-detail-stat-item strong {
  color: var(--text-main);
  font-weight: 700;
}

/* Community Detail Workspace Tabs Bar */
.community-detail-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cd-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
  margin-bottom: -2px;
  font-family: inherit;
}

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

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

.cd-panel {
  display: none;
}

.cd-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Post Composer Prompt Card */
.community-post-prompt {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.community-post-prompt-text {
  font-size: 14px;
  color: var(--text-sub);
}

/* Members Grid */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.member-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.member-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.member-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-card-role {
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 2px;
}

.role-owner {
  background: #FEF3C7;
  color: #B45309;
}

.role-admin {
  background: #E0E7FF;
  color: #4338CA;
}

.role-member {
  background: var(--bg-page);
  color: var(--text-sub);
}

/* Rules list */
.community-rules-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-item {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.rule-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.rule-text {
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.5;
  align-self: center;
}

@media (max-width: 768px) {
  .community-detail-cover {
    height: 140px;
  }
  .community-detail-body {
    padding: 0 16px 20px;
  }
  .community-detail-avatar {
    width: 64px;
    height: 64px;
    margin-top: -32px;
    border-radius: 16px;
    font-size: 24px;
  }
  .community-detail-title {
    font-size: 21px;
  }
  .community-detail-avatar-bar {
    margin-bottom: 12px;
  }
  .cd-tab-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* ==========================================================================
   Responsive Breakpoints & Window Resize Adaptation
   ========================================================================== */

/* Tablet & Medium Screen (<= 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 200px;
  }
  .app-main {
    padding: 20px 20px;
  }
  .grid-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 16px;
  }
}

/* Tablet Small / Large Mobile (<= 860px) */
@media (max-width: 860px) {
  .app-sidebar {
    display: none;
  }
  
  .mobile-nav {
    display: flex;
  }

  .app-main {
    padding: 18px 16px 80px;
  }

  .header-search {
    max-width: 220px;
  }

  .grid-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  }
}

/* Standard Mobile (<= 640px) */
@media (max-width: 640px) {
  .app-header {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-text {
    font-size: 16px;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
  }

  .header-search {
    max-width: 140px;
  }

  .header-search input {
    font-size: 12px;
    padding: 6px 8px 6px 28px;
  }

  .header-search svg {
    left: 8px;
    width: 13px;
    height: 13px;
  }

  .btn-create-header span {
    display: none;
  }

  .btn-create-header::after {
    content: '+';
    font-size: 17px;
    font-weight: 700;
  }

  .grid-cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .view-header {
    margin-bottom: 14px;
  }

  .view-title-group h1 {
    font-size: 21px;
  }

  .view-title-group p {
    font-size: 13px;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .chat-container {
    height: calc(100vh - var(--header-height) - 80px);
    flex-direction: column;
  }

  .chat-sidebar {
    width: 100%;
    height: 140px;
  }

  .message-bubble {
    max-width: 85%;
  }

  .toast-container {
    right: 12px;
    left: 12px;
    bottom: 64px;
  }

  .toast {
    max-width: 100%;
    justify-content: center;
  }
}

/* Extra Small Mobile (<= 400px) */
@media (max-width: 400px) {
  .app-header {
    padding: 0 8px;
  }

  .brand-text span {
    display: inline;
  }

  .header-search {
    max-width: 105px;
  }

  .header-search input {
    font-size: 11px;
    padding: 5px 6px 5px 24px;
  }

  .header-search svg {
    left: 6px;
    width: 12px;
    height: 12px;
  }

  .btn-sm {
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .user-display-name {
    max-width: 65px;
  }
}

/* ==========================================================================
   New Feature Alignment: Event Detail, Invite Code, City & Date Filters, Requests
   ========================================================================== */

/* Large Modal Card */
.modal-card-lg {
  max-width: 620px;
}

/* Clickable Event Cards */
.event-card {
  cursor: pointer;
}

/* Event Detail Modal */
.event-detail-cover {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
  margin-bottom: 18px;
}

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

.event-detail-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.65) 100%);
}

.event-detail-badges {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.event-detail-price {
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.event-detail-date-badge {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  border-radius: 12px;
  padding: 6px 14px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 2;
}

.event-detail-date-badge .month {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
}

.event-detail-date-badge .day {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.event-detail-community-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.event-detail-community-link:hover {
  opacity: 0.85;
}

.event-detail-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 16px;
}

.event-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.event-info-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.event-info-box-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.event-info-box-text h5 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 2px;
}

.event-info-box-text p {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.event-detail-section {
  margin-bottom: 20px;
}

.event-detail-section h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.event-detail-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-sub);
  white-space: pre-line;
}

.event-detail-attendees-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.event-attendees-avatars {
  display: flex;
  margin-left: 6px;
}

.event-attendees-avatars .avatar-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  margin-left: -8px;
  object-fit: cover;
  background: var(--primary-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}

.event-detail-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Discover City Selector */
.city-selector-wrapper {
  display: inline-flex;
  align-items: center;
  position: relative;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px 2px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-left: 8px;
}

.city-selector-wrapper svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
  margin-right: 6px;
  flex-shrink: 0;
}

.city-select {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  padding: 6px 18px 6px 0;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.city-selector-wrapper::after {
  content: '▼';
  font-size: 8px;
  color: var(--text-sub);
  position: absolute;
  right: 10px;
  pointer-events: none;
}

/* Event Date Filter Chips (All, Today, This Weekend) */
.event-date-filters {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}

.event-date-chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s ease;
}

.event-date-chip:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.event-date-chip.active {
  background: #EEF2FF;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* Join via Invite Code Button (Key) */
.btn-invite-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid rgba(79, 70, 229, 0.3);
  background: rgba(79, 70, 229, 0.06);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-invite-key:hover {
  background: rgba(79, 70, 229, 0.14);
  border-color: var(--primary);
}

/* Pending Requests in Members Tab */
.pending-requests-card {
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.pending-requests-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: #92400E;
  margin-bottom: 12px;
}

.pending-request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  margin-bottom: 8px;
}

.pending-request-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pending-request-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.pending-request-user .info h5 {
  font-size: 13.5px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.pending-request-user .info p {
  font-size: 11.5px;
  color: #6B7280;
  margin: 0;
}

.pending-request-actions {
  display: flex;
  gap: 8px;
}

/* Pending Badge on Community Card */
.pending-requests-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #EF4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
}

/* Invite Code Box in About Tab */
.invite-code-box {
  background: #F3F4F6;
  border: 1px dashed #9CA3AF;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.invite-code-text {
  font-family: monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary);
}

/* Confirmation Dialog & Safety Report Modals */
.report-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-main);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-card);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.report-radio-label:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.report-radio-label input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
}

/* Post Action & Menu Buttons */
.post-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.post-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.post-menu-btn.btn-delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

.post-menu-btn.btn-report:hover {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

