/* ===================================================
   FreeFlow — فري فلو | Main Stylesheet
   Dark mode + RTL + Arabic-first
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ──────────────────────────────────────
   CSS Variables
────────────────────────────────────── */
:root {
  --primary:       #7C3AED;
  --primary-light: #9D60F8;
  --primary-dark:  #5B21B6;
  --primary-glow:  rgba(124, 58, 237, 0.25);

  --bg:            #0F0F0F;
  --bg-2:          #141414;
  --card:          #1A1A1A;
  --card-hover:    #202020;
  --border:        #2A2A2A;
  --border-light:  #333333;

  --text:          #F0F0F0;
  --text-muted:    #888;
  --text-dim:      #555;

  --green:         #22C55E;
  --green-dim:     rgba(34, 197, 94, 0.15);
  --gold:          #F59E0B;
  --gold-dim:      rgba(245, 158, 11, 0.15);
  --blue:          #3B82F6;
  --blue-dim:      rgba(59, 130, 246, 0.15);
  --red:           #EF4444;

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     18px;
  --radius-xl:     24px;

  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.3);
  --shadow-glow:   0 0 30px rgba(124, 58, 237, 0.2);

  --transition:    0.2s ease;
  --font:          'Cairo', 'Tajawal', sans-serif;

  /* ── Bootstrap 5 dark-theme overrides ── */
  --bs-body-color:              #F0F0F0;
  --bs-body-bg:                 #0F0F0F;
  --bs-secondary-color:         rgba(240,240,240,0.65);
  --bs-tertiary-color:          rgba(240,240,240,0.38);
  --bs-emphasis-color:          #ffffff;
  --bs-secondary-bg:            #1A1A1A;
  --bs-tertiary-bg:             #141414;
  --bs-border-color:            #2A2A2A;
  --bs-border-color-translucent:rgba(255,255,255,0.1);
  --bs-link-color:              #9D60F8;
  --bs-link-hover-color:        #7C3AED;
  --bs-card-color:              #F0F0F0;
  --bs-card-bg:                 #1A1A1A;
  --bs-card-cap-bg:             #141414;
  --bs-table-color:             #F0F0F0;
  --bs-table-bg:                transparent;
  --bs-table-border-color:      #2A2A2A;
  --bs-table-striped-bg:        rgba(255,255,255,0.03);
  --bs-table-hover-bg:          rgba(255,255,255,0.05);
  --bs-dropdown-bg:             #1A1A1A;
  --bs-dropdown-color:          #F0F0F0;
  --bs-dropdown-border-color:   #2A2A2A;
  --bs-dropdown-link-color:     #F0F0F0;
  --bs-dropdown-link-hover-bg:  #202020;
  --bs-input-bg:                #141414;
  --bs-input-color:             #F0F0F0;
  --bs-input-border-color:      #2A2A2A;
  --bs-input-placeholder-color: #555;
  --bs-modal-bg:                #1A1A1A;
  --bs-modal-color:             #F0F0F0;
  --bs-modal-border-color:      #2A2A2A;
}

/* ──────────────────────────────────────
   Light Mode Variables
────────────────────────────────────── */
html[data-theme="light"] {
  --bg:            #F1F3F6;
  --bg-2:          #E7E9ED;
  --card:          #FFFFFF;
  --card-hover:    #F5F6F8;
  --border:        #DDE0E6;
  --border-light:  #C8CDD6;

  --text:          #111111;
  --text-muted:    #5A6070;
  --text-dim:      #9AA0AD;

  --primary-glow:  rgba(124, 58, 237, 0.10);
  --shadow:        0 4px 24px rgba(0,0,0,0.10);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.07);

  --bs-body-color:               #111111;
  --bs-body-bg:                  #F1F3F6;
  --bs-secondary-color:          rgba(17,17,17,0.65);
  --bs-tertiary-color:           rgba(17,17,17,0.38);
  --bs-emphasis-color:           #000000;
  --bs-secondary-bg:             #FFFFFF;
  --bs-tertiary-bg:              #E7E9ED;
  --bs-border-color:             #DDE0E6;
  --bs-border-color-translucent: rgba(0,0,0,0.10);
  --bs-link-color:               #7C3AED;
  --bs-link-hover-color:         #5B21B6;
  --bs-card-color:               #111111;
  --bs-card-bg:                  #FFFFFF;
  --bs-card-cap-bg:              #F1F3F6;
  --bs-table-color:              #111111;
  --bs-table-bg:                 transparent;
  --bs-table-border-color:       #DDE0E6;
  --bs-table-striped-bg:         rgba(0,0,0,0.025);
  --bs-table-hover-bg:           rgba(0,0,0,0.04);
  --bs-dropdown-bg:              #FFFFFF;
  --bs-dropdown-color:           #111111;
  --bs-dropdown-border-color:    #DDE0E6;
  --bs-dropdown-link-color:      #111111;
  --bs-dropdown-link-hover-bg:   #F5F6F8;
  --bs-input-bg:                 #FFFFFF;
  --bs-input-color:              #111111;
  --bs-input-border-color:       #DDE0E6;
  --bs-input-placeholder-color:  #9AA0AD;
  --bs-modal-bg:                 #FFFFFF;
  --bs-modal-color:              #111111;
  --bs-modal-border-color:       #DDE0E6;
}

html[data-theme="light"] ::-webkit-scrollbar-track { background: #F1F3F6; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #C0C4CD; }

/* Light mode overrides for elements that use hard-coded colours */
html[data-theme="light"] .card                { background: #fff; color: #111; }
html[data-theme="light"] .sidebar             { background: #fff; border-color: #DDE0E6; }
html[data-theme="light"] .sidebar-user        { background: #F5F6F8; }
html[data-theme="light"] .sidebar-logo        { border-color: #DDE0E6; }
html[data-theme="light"] .mobile-header       { background: #fff; border-color: #DDE0E6; }
html[data-theme="light"] .nav-link            { color: #5A6070; }
html[data-theme="light"] .nav-link:hover      { background: #F0F1F5; color: #111; }
html[data-theme="light"] .nav-link.active     { background: rgba(124,58,237,0.10); color: #7C3AED; }
html[data-theme="light"] .nav-link.nav-sub    { color: #7A8090; }
html[data-theme="light"] .form-control        { background: #fff; color: #111; border-color: #DDE0E6; }
html[data-theme="light"] .form-control:focus  { border-color: #7C3AED; box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
html[data-theme="light"] .btn-ghost           { color: #5A6070; border-color: #DDE0E6; background: #fff; }
html[data-theme="light"] .btn-ghost:hover     { background: #F0F1F5; color: #111; }
html[data-theme="light"] .tab-bar             { background: #F0F1F5; border-color: #DDE0E6; }
html[data-theme="light"] .tab-btn             { color: #5A6070; }
html[data-theme="light"] .tab-btn.active      { background: #fff; color: #7C3AED; }
html[data-theme="light"] .msg-bubble          { background: #F0F1F5; color: #111; }
html[data-theme="light"] .chat-message.own .msg-bubble { background: #7C3AED; color: #fff; }
html[data-theme="light"] .chat-area           { background: #F5F6F8; }
html[data-theme="light"] .chat-header         { background: #fff; border-color: #DDE0E6; }
html[data-theme="light"] .chat-input-area     { background: #fff; border-color: #DDE0E6; }
html[data-theme="light"] .rooms-list          { background: #fff; border-color: #DDE0E6; }
html[data-theme="light"] .room-item           { color: #111; border-color: #DDE0E6; }
html[data-theme="light"] .room-item:hover,
html[data-theme="light"] .room-item.active    { background: rgba(124,58,237,0.08); }
html[data-theme="light"] .profile-hero        { background: #F0F1F5; border-color: #DDE0E6; }
html[data-theme="light"] .toast               { background: #fff; color: #111; border-color: #DDE0E6; }
html[data-theme="light"] select.form-control  { background: #fff; color: #111; }

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

html {
  direction: rtl;
  scroll-behavior: smooth;
}

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

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

img { max-width: 100%; height: auto; }

/* ──────────────────────────────────────
   Scrollbar
────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ──────────────────────────────────────
   Sidebar Navigation
────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo .brand-dot {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--primary);
}

/* Theme toggle button */
.theme-toggle-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary-light);
}

.sidebar-logo .tagline {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* User Mini Card in Sidebar */
.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

.sidebar-user .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

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

.sidebar-user .user-info .name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  display: block;
  unicode-bidi: plaintext;
}

.sidebar-user .user-info .meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  margin-top: 2px;
}

/* Points bar */
.points-mini {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.points-mini .pts-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.points-mini .progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.points-mini .progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* Nav Links */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-section-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--card-hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--primary-glow);
  color: var(--primary-light);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 2px 0 0 2px;
}

.nav-link .bi {
  font-size: 18px;
  flex-shrink: 0;
}

.nav-link .pro-lock {
  font-size: 10px;
  background: var(--gold);
  color: #000;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: auto;
  font-weight: 700;
}

/* Sub-nav items (below الرئيسية) */
.nav-link.nav-sub {
  font-size: 12px;
  padding: 7px 12px 7px 12px;
  margin-bottom: 1px;
  color: var(--text-dim);
  padding-right: 32px;
  position: relative;
}
.nav-link.nav-sub::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
}
.nav-link.nav-sub.active::after {
  background: var(--primary);
}
.nav-link.nav-sub .bi {
  font-size: 14px;
}
.nav-link.nav-sub:hover {
  color: var(--text);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

/* ──────────────────────────────────────
   Main Content
────────────────────────────────────── */
.main-content {
  margin-right: 260px;
  min-height: 100vh;
  padding: 24px;
}

/* ──────────────────────────────────────
   Page Header
────────────────────────────────────── */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* ──────────────────────────────────────
   Cards
────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition), transform var(--transition);
}

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

.card-sm { padding: 14px 16px; }
.card-lg { padding: 28px 32px; }

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-outline {
  background: transparent;
  color: var(--primary-light);
  border: 1px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-glow);
  color: var(--primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--border-light);
}

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

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.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-muted);
  margin-bottom: 6px;
}

.form-label .req { color: var(--red); margin-right: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
}

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

.form-control::placeholder { color: var(--text-dim); }

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}

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

/* Checkbox / Radio */
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
  background: var(--bg-2);
}

.check-item:hover { border-color: var(--primary); color: var(--primary-light); }
.check-item.selected { border-color: var(--primary); background: var(--primary-glow); color: var(--primary-light); }
.check-item input { display: none; }

/* ──────────────────────────────────────
   Alert / Flash
────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.alert-error   { background: rgba(239,68,68,0.1); border-color: var(--red); color: var(--red); }
.alert-info    { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.alert-warning { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* ──────────────────────────────────────
   Badges
────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-pro {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--gold), #F97316);
  color: #000 !important;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-free {
  background: var(--border);
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.badge-level {
  background: var(--primary-glow);
  color: var(--primary-light);
  border: 1px solid var(--primary-dark);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
}

.badge-green  { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.badge-gold   { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold); }
.badge-purple { background: var(--primary-glow); color: var(--primary-light); border: 1px solid var(--primary); }

/* ──────────────────────────────────────
   Avatar
────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.avatar-xs  { width: 28px;  height: 28px;  }
.avatar-sm  { width: 36px;  height: 36px;  }
.avatar-md  { width: 48px;  height: 48px;  }
.avatar-lg  { width: 64px;  height: 64px;  }
.avatar-xl  { width: 96px;  height: 96px;  border: 3px solid var(--primary); }
.avatar-xxl { width: 128px; height: 128px; border: 4px solid var(--primary); }

.avatar-placeholder {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

/* ──────────────────────────────────────
   Stats Cards
────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

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

.stat-card .stat-change {
  font-size: 12px;
  color: var(--green);
}

/* ──────────────────────────────────────
   Feed Post Cards
────────────────────────────────────── */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.post-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

/* Standup card: green accent */
.post-card.standup-card {
  border-right: 3px solid var(--green);
}

.post-card.standup-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--green-dim), transparent 40%);
  pointer-events: none;
}

/* Win card: gold accent */
.post-card.win-card {
  border-right: 3px solid var(--gold);
}

.post-card.win-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--gold-dim), transparent 40%);
  pointer-events: none;
}

/* Collab card: purple accent */
.post-card.collab-card {
  border-right: 3px solid var(--primary);
}

.post-card.collab-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary-glow), transparent 40%);
  pointer-events: none;
}

.post-card .card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  position: relative;
}

.post-card .card-meta {
  flex: 1;
  min-width: 0;
}

.post-card .user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-card .post-time {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 1px;
}

.post-card .post-type-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: auto;
  margin-left: 8px;
  margin-top: 0;
  align-self: center;
}

.badge-standup { background: var(--green-dim); color: var(--green); }
.badge-win     { background: var(--gold-dim);  color: var(--gold);  }
.badge-collab  { background: var(--primary-glow); color: var(--primary-light); }

.post-card .card-content {
  position: relative;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 16px;
}

.standup-field {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  border-right: 2px solid var(--border-light);
}

.standup-field .field-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.standup-field .field-value {
  font-size: 14px;
  color: var(--text);
}

/* ──────────────────────────────────────
   Reaction Bar
────────────────────────────────────── */
.reaction-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
  transition: all var(--transition);
  color: var(--text-muted);
}

.reaction-btn:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary-light);
  transform: scale(1.05);
}

.reaction-btn.reacted {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary-light);
  font-weight: 700;
}

.reaction-btn .count {
  font-size: 12px;
  font-weight: 600;
}

/* ──────────────────────────────────────
   Tabs
────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); background: var(--card-hover); }
.tab-btn.active { background: var(--primary); color: #fff; }

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

.auth-bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.3;
  pointer-events: none;
}

.auth-bg-glow {
  position: fixed;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--primary-glow), transparent 60%);
  pointer-events: none;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow);
}

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

.auth-logo .brand-name {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-light), #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.auth-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.auth-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: 12px;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { right: 0; }
.auth-divider::after  { left: 0; }

/* ──────────────────────────────────────
   Setup Wizard
────────────────────────────────────── */
.setup-page {
  min-height: 100vh;
  background: var(--bg);
  padding: 24px;
}

.setup-container {
  max-width: 720px;
  margin: 0 auto;
}

.setup-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px;
}

.setup-brand {
  font-size: 26px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary-light), #C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.setup-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.step-circle {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  transition: all 0.3s;
  position: relative;
  z-index: 1;
}

.step-item.done .step-circle {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.step-item.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.step-label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
}

.step-item.active .step-label { color: var(--primary-light); font-weight: 600; }
.step-item.done .step-label  { color: var(--green); }

.step-connector {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 0 -1px;
  margin-bottom: 20px;
  transition: background 0.3s;
}

.step-connector.done { background: var(--green); }

.setup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow);
}

.setup-card .step-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 4px;
}

.setup-card .step-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.setup-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ──────────────────────────────────────
   Room / Chat
────────────────────────────────────── */
.rooms-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  height: calc(100vh - 120px);
}

.rooms-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.rooms-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
}

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

.room-item:hover { background: var(--card-hover); }
.room-item.active { background: var(--primary-glow); }

.room-item .room-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.room-item .room-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.room-item .room-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-area {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

.chat-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-message.own { flex-direction: row-reverse; }

/* Wrapper div inside each message — constrains bubble to 70% of chat area */
.chat-message > div {
  max-width: 70%;
  min-width: 0;
}

.chat-message .msg-bubble {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 0;
  padding: 10px 14px;
  max-width: 100%;   /* 100% of wrapper, which is already 70% of chat area */
  width: fit-content;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-message.own .msg-bubble {
  background: var(--primary-dark);
  border-color: var(--primary);
  border-radius: 12px 12px 0 12px;
  color: #fff;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.msg-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

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

.chat-input-area .form-control {
  flex: 1;
  border-radius: 20px;
  padding: 10px 16px;
}

.typing-indicator {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 20px;
  font-style: italic;
  min-height: 20px;
}

/* ──────────────────────────────────────
   Profile Page
────────────────────────────────────── */
.profile-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100%; height: 80px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

/* ── Cover strip: sits ABOVE the profile card, never overlaps content ── */
.profile-cover-strip {
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  flex-shrink: 0;
}

/* Profile card when cover exists: connect seamlessly below the strip */
.has-cover {
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  border-top: none;
}

/* Hide gradient ::before — cover strip provides the visual header */
.has-cover::before { display: none; }

/* Reset hero-body top margin (no extra push needed) */
.has-cover .profile-hero-body { margin-top: 20px; }

.profile-hero-body {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-top: 40px;
  z-index: 1;
}

.profile-hero .user-details { flex: 1; }

.profile-hero .user-name {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-hero .user-specialty {
  color: var(--primary-light);
  font-size: 14px;
  margin-bottom: 8px;
}

.profile-hero .user-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

.profile-stat .value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-light);
}

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

/* Skills Tags */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-2);
  transition: all var(--transition);
}

.skill-tag:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ──────────────────────────────────────
   Admin Panel
────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}

.admin-sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
}

.admin-nav-link:hover  { background: var(--card-hover); color: var(--text); }
.admin-nav-link.active { background: var(--primary-glow); color: var(--primary-light); }

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: right;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--card-hover); }
.data-table tr:last-child td { border-bottom: none; }

/* ──────────────────────────────────────
   Welcome / Pricing
────────────────────────────────────── */
.welcome-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.hero-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  position: relative;
}

.hero-title {
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 30%, var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 900px;
  width: 100%;
  margin-top: 60px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.feature-card .feature-icon {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
}

.feature-card .feature-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.feature-card .feature-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ──────────────────────────────────────
   Congrats Modal
────────────────────────────────────── */
.congrats-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.congrats-box {
  background: var(--card);
  border: 1px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: 48px;
  text-align: center;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-glow);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.congrats-emoji { font-size: 64px; margin-bottom: 16px; }
.congrats-title {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

/* ──────────────────────────────────────
   Utilities
────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-primary { color: var(--primary-light); }
.text-green  { color: var(--green); }
.text-gold   { color: var(--gold); }
.text-red    { color: var(--red); }

.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.d-flex  { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

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

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .title { font-size: 18px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.empty-state .desc  { font-size: 14px; }

.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 30px;
}

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

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: .8; }
}

/* ──────────────────────────────────────
   Responsive (Mobile)
────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.mobile-header .brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-light);
}

.mobile-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* Share card glow pulse (feed page) */
@keyframes shareGlowPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(124,58,237,.35); }
  50%      { box-shadow: 0 0 0 6px rgba(124,58,237,.55); }
}

@media (max-width: 768px) {
  .hide-on-mobile { display: none !important; }
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 150;
    top: 56px;                    /* start below mobile header */
    height: calc(100vh - 56px);  /* fill rest of screen */
  }

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

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

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

  .rooms-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  /* ── Profile: full mobile redesign ───────────────────────── */

  /* Cover: same width as card, shorter on mobile */
  .profile-cover-strip {
    height: 160px;
    border-radius: 14px 14px 0 0;
  }

  /* Card: zero top padding so avatar can overlap cover edge */
  .profile-hero {
    padding: 0 16px 20px;
    overflow: visible;        /* let avatar peek over the top */
  }

  /* When cover exists: no top border */
  .has-cover {
    border-top: none;
    border-radius: 0 0 14px 14px;
  }

  /* Hero body: column, centered */
  .profile-hero-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin-top: 0;
  }

  /* Avatar overlaps the cover bottom edge */
  .has-cover .profile-hero-body {
    margin-top: -52px;       /* pull avatar up over the cover strip */
  }

  /* Avatar ring: card-colored border + primary glow */
  .profile-hero-body .avatar-xxl,
  .profile-hero-body .avatar-placeholder {
    border: 4px solid var(--card) !important;
    box-shadow: 0 0 0 3px var(--primary);
    width: 96px;
    height: 96px;
    font-size: 32px;
  }

  /* No-cover case: avatar sits below the gradient band */
  .profile-hero:not(.has-cover) .profile-hero-body {
    margin-top: 56px;        /* let ::before gradient show */
  }

  /* Text blocks: center-aligned */
  .profile-hero .user-details {
    flex: unset;
    width: 100%;
    text-align: center;
  }

  .profile-hero .user-name {
    justify-content: center;
    font-size: 20px;
  }

  .profile-hero .user-specialty {
    text-align: center;
  }

  .profile-hero .user-badges {
    justify-content: center;
  }

  /* Buttons row below avatar info: center */
  .profile-hero-body > div:last-child {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  /* Stats: smaller text */
  .profile-stat .value { font-size: 18px; }
  .profile-stat .label { font-size: 11px; }

  /* Music player: keep left, lift above stats */
  #musicPlayerBtn {
    bottom: 16px !important;
    left: 16px !important;
    width: 42px !important;
    height: 42px !important;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .setup-card {
    padding: 24px 20px;
  }

  .step-connector { width: 30px; }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .tab-bar { flex-wrap: wrap; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); }
}
