/* CSS Custom Properties for consistent theming */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --background-color: #f8fafc;
  --card-background: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (min-width: 1280px) {
  html {
    font-size: 17px;
  }
}

body {
  font-family: var(--font-sans);
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 1280px) {
  .container {
    max-width: 1400px;
    padding: 0 1.25rem;
  }
}

/* Header */
.header {
  background-color: var(--card-background);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.logo a:hover {
  color: var(--primary-hover);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
  background-color: #f1f5f9;
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem 0;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.hero-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.patient-search-panel {
  margin-bottom: 1.5rem;
}

.patient-search-empty {
  background: linear-gradient(135deg, #f8fafc 0%, #eef6ff 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.patient-search-empty h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.patient-search-empty p {
  color: var(--text-secondary);
  max-width: 46rem;
  margin-bottom: 1rem;
}

.patient-search-empty-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-container {
  max-width: 600px;
  margin: 0 auto;
}

.search-bar {
  display: flex;
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.search-input {
  flex: 1;
  padding: 1rem;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
}

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

.search-btn {
  padding: 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

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

.search-icon {
  font-size: 1.2rem;
}

/* Content Layout */
.content-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 1280px) {
  .content-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 2.5rem;
  }
}

/* Filters Sidebar */
.filters-sidebar {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 100px;
}

.filters-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.filter-group {
  margin-bottom: 2rem;
}

.filter-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.25rem 0;
}

.filter-option input[type="radio"] {
  margin-right: 0.5rem;
}

.filter-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.filter-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--card-background);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.filter-multi-select {
  min-height: 9rem;
}

.filter-help {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  line-height: 1.4;
}

.clear-filters-btn {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--secondary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.clear-filters-btn:hover {
  background-color: #475569;
}

/* Main Content Area */
.main-content {
  min-height: 500px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.results-count {
  font-weight: 600;
  color: var(--text-primary);
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.sort-select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--card-background);
  color: var(--text-primary);
  font-size: 0.875rem;
}

/* Loading and No Results */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.no-results {
  text-align: center;
  padding: 3rem;
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.no-results h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.no-results p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.reset-btn {
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

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

/* About Page */
.about-section {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.about-title {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.about-text {
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.about-list {
  margin: 0 0 1rem 1.25rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.about-org-list {
  columns: 2;
  column-gap: 2rem;
}

/* Physician Community Mock Page */
.community-hero {
  margin-bottom: 2rem;
}

.community-hero-content {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 55%, #ecfeff 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-bottom: 1rem;
}

.community-identity {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.community-disclaimer {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warning-color);
  border-radius: var(--border-radius);
  padding: 0.875rem 1rem;
}

.community-disclaimer-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #854d0e;
  margin-bottom: 0.25rem;
}

.community-disclaimer-text {
  font-size: 0.875rem;
  color: #92400e;
  margin: 0;
}

.community-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.community-panel {
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
}

.community-step {
  width: 100%;
}

.community-step-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.community-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  text-transform: uppercase;
}

.community-step-selection {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 0.84rem;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
}

.community-step-selection,
.community-feed-meta,
.community-thread-toggle,
.community-trial-selector-head h4,
.community-trial-head h4 {
  overflow-wrap: anywhere;
}

.community-panel-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.community-panel-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.community-group-list {
  display: grid;
  gap: 0.75rem;
}

.community-group-card {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  padding: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.community-group-card.is-active {
  border-color: var(--primary-color);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.community-group-card:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.community-group-meta {
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.community-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.community-group-head h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0;
}

.community-group-card p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.community-unread-badge {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.community-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.community-feed-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.community-toolbar-control {
  display: grid;
  gap: 0.35rem;
}

.community-toolbar-control span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.community-toolbar-select {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--card-background);
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.5rem 0.6rem;
  min-height: 2.25rem;
}

.community-toolbar-select:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.community-toolbar-btn {
  align-self: end;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  min-height: 2.25rem;
  cursor: pointer;
}

.community-toolbar-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.community-thread-list {
  display: grid;
  gap: 1rem;
}

.community-feed-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.community-thread {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #fbfdff;
  padding: 1rem;
  margin-bottom: 1rem;
}

.community-thread:last-child {
  margin-bottom: 0;
}

.community-thread.is-expanded {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.2);
}

.community-thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.community-thread-toggle {
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

.community-thread-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.community-thread-author {
  font-size: 0.8rem;
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.community-thread-body {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.community-thread-details {
  margin: 0.5rem 0 0.8rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.75rem;
}

.community-thread-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.community-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.community-tag-btn {
  font-size: 0.75rem;
  color: var(--primary-color);
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.community-tag-btn.is-active {
  background: #bfdbfe;
  border-color: #93c5fd;
}

.community-thread-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.community-action-toggle {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.community-action-toggle.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--primary-color);
}

.community-thread-replies {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.community-trial-selector-list {
  display: grid;
  gap: 0.75rem;
}

.community-trial-selector-item {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.community-trial-selector-item:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.community-trial-selector-item.is-active {
  border-color: var(--primary-color);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.community-trial-selector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.community-trial-selector-head h4 {
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0;
}

.community-trial-selector-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0.2rem 0 0;
}

.community-trial-grid {
  display: grid;
  gap: 0.875rem;
}

.community-trial-item {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f8fafc;
  padding: 0.9rem;
}

.community-trial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.community-trial-head h4 {
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0;
}

.community-trial-item p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.45;
  margin-bottom: 0.5rem;
}

.community-trial-site {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.community-trial-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.community-status-chip {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.community-status-chip.recruiting {
  background: #dcfce7;
  color: #166534;
}

.community-status-chip.active {
  background: #dbeafe;
  color: #1e40af;
}

.community-status-chip.upcoming {
  background: #fef3c7;
  color: #92400e;
}

.community-status-chip.completed {
  background: #f3f4f6;
  color: #374151;
}

.community-trial-link {
  width: 100%;
  margin-top: 0.35rem;
}

.community-trial-link.is-disabled {
  opacity: 0.65;
  pointer-events: none;
}

.community-reference-card {
  margin-top: 1rem;
  border: 1px solid #d1d5db;
  border-radius: var(--border-radius);
  background: #f9fafb;
  padding: 0.9rem;
}

.community-reference-card h4 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.community-reference-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.community-composer {
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.community-composer-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.community-composer-input {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.875rem;
  resize: vertical;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}

.community-composer-input:disabled {
  cursor: not-allowed;
}

.community-composer-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.community-composer-help {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.community-state-info,
.community-state-warning {
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  line-height: 1.45;
  padding: 0.75rem;
}

.community-state-info {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.community-state-warning {
  margin-bottom: 0.75rem;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.community-group-card:focus-visible,
.community-trial-selector-item:focus-visible,
.community-thread-toggle:focus-visible,
.community-tag-btn:focus-visible,
.community-action-toggle:focus-visible,
.community-toolbar-select:focus-visible,
.community-toolbar-btn:focus-visible,
.community-trial-link:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Footer */
.footer {
  background-color: var(--card-background);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-content {
  text-align: center;
}

.footer-icon {
  width: 6rem;
  height: 6rem;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.footer-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.footer-disclaimer {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .community-trial-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .logo {
    text-align: center;
  }

  .nav {
    width: 100%;
  }

  .nav-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .nav-link {
    display: block;
    text-align: center;
    padding: 0.5rem 0.6rem;
    line-height: 1.25;
    min-height: 2.5rem;
    overflow-wrap: anywhere;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .content-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .filters-sidebar {
    position: static;
    order: 2;
  }

  .main-content {
    order: 1;
  }

  .results-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .community-hero-content {
    padding: 1.5rem;
  }

  .community-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .community-feed-header,
  .community-thread-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .community-feed-toolbar {
    grid-template-columns: 1fr;
  }

  .community-thread-replies {
    width: 100%;
    margin-left: 0;
  }

  .container {
    padding: 0 0.75rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-btn {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
  }

  .filters-sidebar {
    padding: 1rem;
  }

  .about-org-list {
    columns: 1;
  }

  .community-hero-content {
    padding: 1.25rem;
  }

  .community-panel,
  .community-group-card,
  .community-thread,
  .community-trial-item,
  .community-reference-card {
    padding: 0.875rem;
  }

  .community-disclaimer {
    padding: 0.75rem;
  }

  .community-composer {
    padding-top: 0.875rem;
  }
}
