/* ============================================================
   ex-muslim — Design System
   Dark, warm, safe. Not corporate. Not clinical.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Satoshi:wght@400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-primary: #0c0c0f;
  --bg-secondary: #141418;
  --bg-card: #1a1a20;
  --bg-card-hover: #22222a;
  --bg-input: #1a1a20;

  --text-primary: #e8e6e1;
  --text-secondary: #9a9690;
  --text-muted: #5c5955;

  --accent: #d4a053;
  --accent-hover: #e0b06a;
  --accent-dim: rgba(212, 160, 83, 0.15);

  --success: #4ade80;
  --danger: #ef4444;
  --warning: #f59e0b;

  --border: #2a2a30;
  --border-light: #333338;

  /* Typography */
  --font-display: 'Instrument Serif', serif;
  --font-body: 'Satoshi', -apple-system, sans-serif;

  /* Spacing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

html {
  scroll-behavior: smooth;
}

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

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 32px 20px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.sidebar-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 40px;
  line-height: 1.4;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-nav a .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 40px;
  min-height: 100vh;
}

/* ============================================================
   Typography
   ============================================================ */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.5px;
}

h1 { font-size: 48px; line-height: 1.1; }
h2 { font-size: 32px; line-height: 1.2; }
h3 { font-size: 24px; line-height: 1.3; }

.section-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 160, 83, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--accent-dim);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9690' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

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

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

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s ease;
}

.card-hover:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

/* ============================================================
   Avatar
   ============================================================ */

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--bg-primary);
  flex-shrink: 0;
  font-weight: 600;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 16px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  font-size: 32px;
}

/* ============================================================
   Member Card
   ============================================================ */

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.member-card {
  cursor: pointer;
}

.member-card .member-name {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-primary);
}

.member-card .member-region {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.member-card .member-bio {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   Badges & Tags
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.badge-accepted {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.badge-declined {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 3px 10px;
  border-radius: 100px;
}

/* ============================================================
   Connection Request Card
   ============================================================ */

.request-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.request-card .request-info {
  flex: 1;
}

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

.request-message {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-secondary);
}

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

.tab-count {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 100px;
  margin-left: 6px;
}

/* ============================================================
   Empty States
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-family: var(--font-display);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 320px;
  margin: 0 auto;
}

/* ============================================================
   Alerts / Toasts
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.alert-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: var(--success);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  animation: slideUp 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast-success {
  background: var(--success);
  color: var(--bg-primary);
}

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

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

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 480px;
  animation: scaleIn 0.2s ease;
}

.modal h2 {
  margin-bottom: 8px;
}

.modal .modal-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

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

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================================
   Filters Bar
   ============================================================ */

.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filters-bar .form-select {
  width: auto;
  min-width: 200px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

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

.search-input-wrap .form-input {
  padding-left: 40px;
}

/* ============================================================
   Landing Page
   ============================================================ */

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
}

.landing-logo {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--accent);
  text-decoration: none;
}

.landing-nav-links {
  display: flex;
  gap: 12px;
}

.hero {
  padding: 100px 0 80px;
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero h1 {
  font-size: 64px;
  line-height: 1.05;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero .hero-sub {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 40px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

.hero .hero-cta {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 16px;
  justify-content: center;
}

.features {
  padding: 80px 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  padding: 32px;
}

.feature-card .feature-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   Auth Pages
   ============================================================ */

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

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card .auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .auth-brand h1 {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--accent);
}

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

.auth-card .auth-form {
  padding: 32px;
}

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

.auth-card .auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

.auth-card .auth-footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   Reddit OAuth Button
   ============================================================ */

.reddit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 24px;
  background: #FF4500;
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.reddit-btn:hover {
  background: #e63e00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
}

/* ============================================================
   Profile Page
   ============================================================ */

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.profile-header .profile-info h2 {
  margin-bottom: 4px;
}

.profile-header .profile-info .profile-meta {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  gap: 16px;
}

/* ============================================================
   Visibility Toggle
   ============================================================ */

.visibility-toggle {
  display: flex;
  gap: 8px;
}

.visibility-option {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.visibility-option:hover {
  border-color: var(--border-light);
}

.visibility-option.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.visibility-option .vis-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.visibility-option .vis-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   Loading
   ============================================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Mobile Sidebar
   ============================================================ */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.mobile-header .mobile-brand {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 45;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 72px 16px 24px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero .hero-sub {
    font-size: 16px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .member-grid {
    grid-template-columns: 1fr;
  }

  .hero .hero-cta {
    flex-direction: column;
    align-items: center;
  }

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

  .filters-bar .form-select,
  .search-input-wrap {
    width: 100%;
    min-width: unset;
  }
}
