/* --- Base site styles (from Style.css) --- */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap");

:root {
  /* Core palette */
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --surface-3: #e8ebf4;
  --accent: #3b6ef5;
  --accent-hover: #2b5ce6;
  --accent-light: rgba(59, 110, 245, 0.1);
  --accent-glow: rgba(59, 110, 245, 0.18);
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --online: #2ecc71;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-focus: #3b6ef5;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-accent: 0 4px 16px rgba(59, 110, 245, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 999px;
  --font: "DM Sans", sans-serif;
  --font-mono: "DM Mono", monospace;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 360px;
}

/* Dark mode variables */
body.dark {
  --bg: #0e0e10;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --text-primary: #f5f5f7;
  --text-secondary: #d1d1d6;
  --text-muted: #9fa3a8;
  --border: #3a3a3c;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-accent: 0 4px 16px rgba(59, 110, 245, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure the html element background matches body so gaps above body are not visible */
html { background: var(--bg); }

/* Layout and components (copied from Style.css) */
#wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
#left {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 10;
}
.sidebar-header {
  padding: 20px 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.sidebar-logo span {
  color: var(--text-primary);
}
.header-actions {
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 16px;
}
.icon-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}
.tab-bar {
  display: flex;
  padding: 14px 18px 0;
  gap: 4px;
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.tab-btn.active {
  background: var(--accent-light);
  color: var(--accent);
}
.tab-btn:hover:not(.active) {
  background: var(--surface-2);
  color: var(--text-primary);
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xl);
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.panel.active {
  display: flex;
}
.panel-inner {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.panel-inner::-webkit-scrollbar {
  width: 4px;
}
.panel-inner::-webkit-scrollbar-track {
  background: transparent;
}
.panel-inner::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.panel-top {
  padding: 12px 18px 8px;
  flex-shrink: 0;
}
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.conv-item:hover {
  background: var(--surface-2);
}
.conv-item.active {
  background: var(--accent-light);
}
.conv-avatar {
  width: 40px !important;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  position: relative;
  display: flex
}
.conv-avatar.gc-avatar {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  font-size: 18px;
}

.conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--online);

  border-radius: 50%;
  border: 2px solid var(--surface);
}

.sent-wrapper .bubble-avatar {
  order: 2;
  margin-left: 6px;
  margin-right: 0;
}
.received-wrapper .bubble-avatar {
  order: 0;
  margin-right: 8px;
}
.conv-info {
  flex: 1;
  min-width: 0;
}
.conv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.conv-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.unread-badge {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-xl);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
#create-gc-btn {
  width: 100%;
  padding: 9px 14px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1.5px dashed rgba(59, 110, 245, 0.3);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}
#create-gc-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  border-style: solid;
  box-shadow: var(--shadow-accent);
}
#right {
  flex: 1;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 32px;
  min-width: 0;
}
.right-header {
  margin-bottom: 24px;
  flex-shrink: 0;
}
.right-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.right-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 3px;
}
#Outer-friends-search {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
#user-search {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  padding: 0 20px;
  font-size: 15px;
  color: var(--text-primary);
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

/* --- Landing page rules (extracted) --- */
/* Landing page tweaks (font import already handled at top; global box-sizing already set) */

body {
  font-family: var(--font);
  background: linear-gradient(135deg, var(--bg) 0%, #e3f2fd 100%);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Remove the landing gradient when in dark mode for login and chat pages */
body.dark.login-page,
body.dark.chat-page {
  background: var(--bg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header icon color (use currentColor so SVGs using stroke="currentColor" adapt)
   Ensures icons are dark in light mode and light in dark mode. */
header, .header-icon-btn, header button {
  color: var(--text-secondary);
}

/* Make sure SVGs inherit the color for stroke/fill */
header svg, .header-icon-btn svg, header button svg {
  stroke: currentColor;
  fill: none;
}

/* In dark mode prefer the primary (light) text color for icons */
body.dark header, body.dark .header-icon-btn, body.dark header button {
  color: var(--text-primary);
}
.header {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-icon-btn {
    background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 5px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  transition: ease-in-out 0.2s;
  justify-content: center;
  display: flex;
  align-items: center;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.logo img {
  width: 40px;
  height: 40px;
  transform: rotate(-30deg);
}
.cta-button {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 20px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-block;
}
.hero {
  padding: 80px 0;
}
.hero .container {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 48px;
  align-items: center;
}
.hero-content h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
}
.highlight {
  color: var(--accent);
}
.hero-description {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 26px;
  max-width: 56ch;
}

/* Chat hero demo (CSS-only animated conversation) */
.chat-window {
  width: 500px;
  max-width: 100%;
  background: var(--surface);
  color: #e6eef8;
  padding: 15px;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  position: relative;
  gap: 12px;
}
.chat-window .bubble-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
  opacity: 0;
}
.chat-window .bubble-wrapper {
  width: 100%;
}

.chat-window .received-wrapper {
  justify-content: flex-start;
}
.chat-window .sent-wrapper {
  justify-content: flex-end;
}
.bubble-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.45);
  display: block;
}
.bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.6);
  font-size: 14px;
  line-height: 1.25;
  position: relative;
}
.bubble {
  flex-shrink: 0;
}
.sent-wrapper .bubble {
  margin-right: 6px;
}
.received-wrapper .bubble {
  margin-left: 6px;
}
.bubble.received {
  background: linear-gradient(180deg, #111827 0%, #0f1724 100%);
  color: #e6eef8;
  border-top-left-radius: 6px;
}
.bubble.sent {
  background: linear-gradient(180deg, #2b6ef6 0%, #1f4fe0 100%);
  color: #fff;
  border-top-right-radius: 6px;
  display: block;
  justify-self: flex-end;
}
.bubble .timestamp {
  display: none;
}

/* Embeds and OG cards */
.embed-wrap {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.embed-wrap .yt-embed {
  width: 480px;
  max-width: 100%;
  height: 270px;
  display: block;
  border: 0;
  border-radius: 12px;
}
.og-card {
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  padding: 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  position: relative;
}
.og-card .og-img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.og-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.og-site {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.og-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.og-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* Copy button overlay for embeds/OG cards */
.embed-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  z-index: 5;
}
.embed-copy-btn:hover { background: rgba(0,0,0,0.75) }

/* Make bubble text a bit nicer */
.bubble-text {
  font-size: 15px;
  color: inherit;
  line-height: 1.45;
  word-break: break-word;
}

/* Typing indicator dots */
.typing {
  padding: 8px 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.typing .dot {
  width: 7px;
  height: 7px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}
.typing .dot:nth-child(2) {
  animation-delay: 0.16s;
}
.typing .dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing {
  0% {
    transform: translateY(0);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
}

/* Bubble animation timeline — total loop 12s */
@keyframes bubbleInOut {
  0% {
    opacity: 0;
    transform: translateY(6px) translateX(var(--tx, 0));
  }
  6% {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
  20% {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
  26% {
    opacity: 0;
    transform: translateY(8px) translateX(var(--tx, 0));
  }
  100% {
    opacity: 0;
  }
}

/* Apply per-bubble delays using inline --i index */
.chat-window .bubble-wrapper {
  animation: bubbleInOut 12s linear infinite;
  animation-fill-mode: both;
}
.chat-window .bubble-wrapper:nth-child(1) {
  --i: 0;
  animation-delay: calc(var(--i) * 2s);
  --tx: -6px;
}
.chat-window .bubble-wrapper:nth-child(2) {
  --i: 1;
  animation-delay: calc(var(--i) * 2s);
  --tx: 6px;
}
.chat-window .bubble-wrapper:nth-child(3) {
  --i: 2;
  animation-delay: calc(var(--i) * 2s);
  --tx: -6px;
}
.chat-window .typing-wrapper {
  animation-delay: calc(3 * 2s);
}
.chat-window .bubble-wrapper:nth-child(5) {
  --i: 4;
  animation-delay: calc(var(--i) * 2s);
  --tx: 6px;
}

/* Make received slide from left, sent from right while animating */
.bubble.received {
  transform-origin: left center;
}
.bubble.sent {
  transform-origin: right center;
}
.chat-window .bubble-wrapper .bubble {
  will-change: transform, opacity;
}
.chat-window .bubble-wrapper:nth-child(odd) .bubble {
  transform: translateX(-8px);
}
.chat-window .bubble-wrapper:nth-child(even) .bubble {
  transform: translateX(8px);
}

/* Hero CTA tweaks */
.cta-button.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow-accent);
}

/* Responsive adjustments: stack columns and resize chat */
@media (max-width: 900px) {
  .hero .container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .hero {
    padding: 40px 0;
  }
  .chat-window {
    position: static;
    width: 100%;
    padding: 12px;
    margin-top: 8px;
  }
  .chat-hero {
    margin-top: 10px;
  }
}

/* Reduce motion preference respect */
@media (prefers-reduced-motion: reduce) {
  .chat-window .bubble-wrapper,
  .typing .dot {
    animation: none !important;
    opacity: 1;
  }
}

/* Home profile widgets */
#home-profile { display: block; }
.home-widgets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.widget-card {
  padding: 16px 14px;
  border-radius: 12px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 2px solid transparent;
}
.widget-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.widget-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}
.widget-card.top-lang { border-color: #f5c547; }
.widget-card.discord { border-color: #6b5ce6; background: linear-gradient(180deg,#0f1724,#08101a); color:#fff; }
.widget-card.github { border-color: #7c3aed; background: linear-gradient(180deg,#0b0b0d,#101215); color:#fff; }
.widget-card.spotify { border-color: #1db954; background: linear-gradient(180deg,#07150a,#0c2213); color:#fff; }
.widget-empty, .widget-loading { color: var(--text-secondary); padding: 12px; }

.widget-card .widget-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.widget-card .js-badge {
  background: linear-gradient(180deg,#f7df1e,#f0c000);
  color: #111;
  font-family: var(--font-mono);
  border-radius: 8px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.widget-card .discord-icon { background: linear-gradient(180deg,#4752c4,#5966ff); }
.widget-card .github-icon { background: linear-gradient(180deg,#333,#111); }
.widget-card .spotify-icon { background: linear-gradient(180deg,#1db954,#17a44a); }

.home-widgets-grid .widget-card { display:flex; align-items:center; }
.features {
  padding: 80px 0;
  background: var(--surface);
}
.section-title {
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 50px;
  color: var(--text-primary);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}
.feature-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  padding: 24px;
  border-radius: 14px;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  box-shadow: var(--shadow-xs);
}
.feature-card h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}
.feature-card .feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
}
.feature-card p {
  color: var(--text-secondary);
  margin: 0;
}

.feature-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Tech stack list */
.tech-list {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.tech-item {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.tech-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.tech-item .tech-name {
  font-weight: 700;
  color: var(--text-primary);
}

/* --- Login compatibility rules --- */

/* Redesigned settings card + items (shadcn-like look) */
.settings-card {
  background: var(--surface);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04);
  margin-bottom: 16px;
}
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}
.setting-label {
  font-weight: 600;
  color: var(--text-primary);
}
.setting-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.setting-control {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-control { width: 320px; max-width: 60%; }
.range-value { font-weight:600; color:var(--text-primary); margin-left:8px; min-width:48px; text-align:right }
#font-size-preview { margin-top:10px; color:var(--text-secondary); font-size:0.95rem }

/* small toggle switch */
.toggle-switch { display:inline-block; position:relative }
.toggle-switch input { display:none }
.toggle-slider {
  width:44px; height:24px; background: #e6e9ee; border-radius:999px; display:inline-block; position:relative; transition:all .18s ease; vertical-align:middle
}
.toggle-slider:after{ content:''; width:18px; height:18px; background:#fff; border-radius:50%; position:absolute; left:3px; top:3px; box-shadow:0 1px 2px rgba(0,0,0,0.06); transition:all .18s ease }
.toggle-switch input:checked + .toggle-slider { background: var(--accent) }
.toggle-switch input:checked + .toggle-slider:after { transform:translateX(20px) }

/* swatches */
#color-swatches { display:flex; gap:8px; flex-wrap:wrap; align-items:center }
.swatch { width:34px; height:34px; border-radius:8px; cursor:pointer; border:2px solid transparent }
.swatch:hover { transform:translateY(-2px) }
#custom-color-picker { width:40px; height:34px; padding:0; border:none; background:transparent; cursor:pointer }

/* bubble options */
.bubble-option { padding:8px 12px; border-radius:8px; background:transparent; border:1px solid rgba(0,0,0,0.06); cursor:pointer }
.bubble-option.active-bubble { background: linear-gradient(90deg, rgba(0,0,0,0.03), rgba(0,0,0,0.01)); border-color:rgba(0,0,0,0.1); }

/* Range input improvements */
input[type="range"] { -webkit-appearance:none; appearance:none }
input[type="range"]::-webkit-slider-runnable-track { height:8px; background: linear-gradient(90deg,var(--accent) 0%,var(--accent) 100%); border-radius:6px }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance:none; width:18px; height:18px; margin-top:-5px; background:#fff; border-radius:50%; box-shadow:0 1px 2px rgba(0,0,0,0.15) }

/* Compatibility rules for current login page markup */
.login-box {
  max-width: 400px;
  margin: 80px auto;
  padding: 36px 30px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}
#linebox {
  color: #fff;
}

#headerbox {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

#logov {
  width: 64px;
  height: auto;
}

#venture-login {
  margin: 0;
  font-size: 20px;
  color: black;
}

#userpassfield,
#registerfield,
#signuppage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
}

.login-btn {
  background: linear-gradient(135deg, #00b4d8, #0096c7);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

/* Code block styles for in-chat rendering */
.code-block-wrap {
  position: relative;
  margin: 8px 0;
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13px;
}
.code-block-wrap .code-meta {
  background: rgba(0,0,0,0.04);
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 12px;
}
.code-block-wrap .code-lang { display:none }
.code-block-wrap pre { margin: 0; }
.plain-code { background: var(--surface-2); padding: 12px; white-space: pre; overflow: auto; }
.code-copy-btn { z-index: 12; }

/* Ensure highlighted html from shiki fits */
.code-block-wrap .shiki { display:block; }

/* ChatGPT-like appearance: darker code area with subtle border and copy button */
.code-block-wrap .shiki pre {
  margin: 0 !important;
  background: #0b1220 !important;
  color: #d6deeb !important;
}
.code-block-wrap .shiki {
  background: #0b1220;
  color: #d6deeb;
}
.code-block-wrap .code-lang {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #cbd5e1;
}

/* Improved styling for in-chat code blocks */
.code-block-wrap {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(2,6,23,0.08);
  border: 1px solid rgba(0,0,0,0.06);
  max-width: 680px;
  margin: 6px 0;
  display: block;
  width: 100%;
}
.code-block-wrap .shiki {
  display: block;
  padding: 12px 14px 14px 14px;
  border-radius: 12px;
}
.code-lang {
  position: absolute;
  top: 8px;
  left: 10px;
  background: rgba(255,255,255,0.06);
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  z-index: 20;
}
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: #e6eef8;
  cursor: pointer;
  z-index: 30;
  opacity: 0.95;
}
.code-copy-btn:hover { background: rgba(255,255,255,0.09); }
.code-copy-btn:active { transform: translateY(1px); }

/* Make code content scroll when long */
.code-block-wrap pre { max-height: 320px; overflow: auto; display:block; width:100%; box-sizing:border-box; padding:12px 14px 12px 14px; padding-right:56px; }

/* Ensure code blocks render clearly inside chat bubbles */
.bubble { overflow: visible; }
.bubble .code-block-wrap { display: block; box-sizing: border-box; width: 100%; margin: 8px 0; padding: 0; }
.sent-wrapper .code-block-wrap, .received-wrapper .code-block-wrap { max-width: 100%; width: 100%; }

/* Ensure code inside sent bubbles is left-aligned and fills available space */
.bubble.sent .code-block-wrap { text-align: left; }
.bubble .code-block-wrap pre { text-align: left; }

/* Make sure code text is visible regardless of parent bubble styles */
.code-block-wrap pre, .code-block-wrap code, .code-block-wrap .line { color: #e6eef8 !important; }
.code-block-wrap pre, .code-block-wrap code { font-family: var(--font-mono); font-size: 15px; line-height: 1.6; white-space: pre; word-break: break-word; }

/* inner wrapper so we can position pill/button without overlapping code */
.code-block-wrap .code-inner {
  position: relative;
  padding: 12px 12px 12px 12px;
}
.code-block-wrap pre {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: #0b1220 !important;
  color: #e6eef8 !important;
  padding: 14px 64px 14px 14px !important; /* leave right space for copy button */
  border-radius: 8px;
  margin: 0;
  overflow: auto;
}
.code-block-wrap .code-lang { position: absolute; top: 12px; left: 12px; z-index: 25; }
.code-block-wrap .code-copy-btn { top: 12px; right: 12px; }
.plain-code { color: var(--text-primary); background: var(--surface-2); padding: 12px; border-radius: 8px; }

/* If shiki failed and produced small inline elements, force block layout */
.code-block-wrap .shiki { display: block !important; }




.line {
  height: 2px;
}
/* --- Settings page (scoped) --- */
.settings-page {
  padding: 22px 28px 48px;
  min-height: 100vh;
  background: var(--bg);
  height: 100%;
  width: 100%;
}

/* Settings page: boost contrast for dark mode */
body.dark .settings-page {
  background: var(--bg);
}
body.dark .settings-page .settings-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
}
body.dark .settings-page .settings-main {
  background: transparent;
}
body.dark .settings-tab {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
body.dark .settings-tab.active-tab {
  background: linear-gradient(90deg, rgba(59,110,245,0.12), rgba(59,110,245,0.06));
  color: var(--accent);
}
body.dark .provider-icon {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.settings-page header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
}
.settings-page header img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.settings-page header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

/* container to center settings content */
.settings-container {
  max-width: 980px;
  margin: 0 auto;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 24px);
  padding-bottom: 20px;
}

.settings-header {
  margin-bottom: 18px;
  justify-content: center;
}

#settings-tab-group {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
  /* keep tabs at the top of the container */
  order: 0;
}
.settings-tab {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  width: 33.3%;
  text-align: center;
}
.settings-tab h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.settings-tab:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.settings-tab.active-tab {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.tab-panel {
  display: none;
  
}
.tab-panel.active-panel {
  display: flex !important;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
}

#pfp-section {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
#profile-pic-wrapper {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative;
}
#profile-pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Settings page layout (sidebar + main card) */
.settings-page .settings-container {
  display: flex;
  flex-direction: row;
  gap: 28px;
  align-items: flex-start;
  padding: 28px;
}
.settings-page .settings-sidebar {
  width: 220px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.settings-page .settings-sidebar .sidebar-top {
  display:flex;align-items:center;gap:10px;padding:8px 6px;
}
.settings-page .settings-nav { display:flex;flex-direction:column;gap:8px;padding:6px 0 }
.settings-page .settings-tab { width:100%; display:flex; align-items:center; gap:10px; padding:10px 12px; text-align:left }
.settings-page .settings-tab .tab-icon { font-size:16px }
.settings-page .settings-tab .tab-label { font-weight:600 }
.settings-page .sidebar-bottom { margin-top:auto }

.settings-page .settings-main { flex:1; max-width:980px }
.settings-page .main-header { margin-bottom:16px }
.settings-page .main-header h1 { margin:0;font-size:20px }
.settings-page .muted { color:var(--text-muted); margin:0 }

.profile-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:18px; box-shadow:var(--shadow-xs); display:flex; flex-direction:column; gap:14px }
.card-hero { display:flex; gap:16px; align-items:flex-start }
.settings-page #pfp-section { justify-content:flex-start; flex-direction:row }
#profile-pic-wrapper { width:96px; height:96px; border-radius:14px; overflow:hidden; background:var(--surface-2); display:flex; align-items:center; justify-content:center; border:1px solid var(--border) }
#profile-pic { width:100%; height:100%; object-fit:cover }
.pfp-edit-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  z-index: 3;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  line-height: 1;
}
.card-hero .hero-info { flex:1 }
.profile-title-row { display:flex; align-items:center; justify-content:space-between; gap:10px }
.profile-title-row .hero-actions { display:flex; align-items:center }
.profile-display-name { font-size:18px; font-weight:700; margin:0 0 4px 0 }
.profile-bio-preview { margin:0; color:var(--text-secondary); font-size:13px }
.hero-bio { display: none;}
.hero-bio label { display:block; font-size:13px; color:var(--text-secondary); margin-bottom:6px }
.hero-bio textarea { width:100%; min-height:70px; padding:8px 10px; border-radius:10px; border:1px solid var(--border); background:var(--surface); }
/* Hide the editable hero bio until user enters edit mode */
.profile-card .hero-bio { display: none }
.profile-card.editing .hero-bio { display: block }
/* hide the compact preview while editing to avoid duplication */
.profile-card.editing #profile-bio-preview { display: none }
.bio-meta { margin-top:6px }
.card-body { display:flex; flex-direction:column }
.card-footer { display:flex; justify-content:flex-end }

/* tighten up field-group widths inside card */
.profile-card .field-group { max-width: 520px }

/* make tab panels stack in the new page layout */
.settings-page .tab-panel.active-panel { display:block !important; }

/* Responsive: collapse to vertical on small screens */
@media (max-width: 820px) {
  .settings-page .settings-container { flex-direction:column; padding:16px }
  .settings-page .settings-sidebar { flex-direction:row; gap:8px; align-items:center; width:100%; overflow-x:auto }
  .settings-page .settings-nav { flex-direction:row }
  .settings-page .settings-tab { flex:0 0 auto }
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-width: 720px;
}
.field-group label {
  font-size: 13px;
  color: var(--text-secondary);
}
.field-group input,
.field-group textarea {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 14px;
}
#bio-char-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

#edit-save-btns {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.btn {
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  border: 1px solid transparent;
}
.btn h4 {
  margin: 0;
  font-size: 14px;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-hover);
}
.btn-gray {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Linked accounts rows */
.linked-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-top: 10px;
}
.linked-info { display:flex; align-items:center; gap:12px }
.provider-icon { width:40px; height:40px; border-radius:10px; display:flex; align-items:center; justify-content:center; background:var(--surface); font-weight:700; color:var(--text-primary) }
.linked-actions .btn { min-width:110px }

/* Privacy option rows */
.privacy-option {
  display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px; border-radius:10px; border:1px solid var(--border); background:var(--surface-2); margin-top:10px;
}
.privacy-option .option-desc { color:var(--text-secondary); font-size:13px }

/* Toggle switch */
.toggle-switch { position: relative; display:inline-block; width:46px; height:26px; align-items: center; justify-content: center;}
.toggle-switch input { opacity: 0; width: 0; height: 0 }
.toggle-switch .toggle-slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:var(--surface); border-radius:999px; transition: background 0.18s, border-color 0.18s }
.toggle-switch .toggle-slider::after { content:""; position:absolute; width:18px; height:18px; left:4px; top:4px; background:#fff; border-radius:50%; transition: transform 0.18s }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border:1px solid var(--accent) }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(20px) }

#panel-profile {
  flex-direction: column;
  align-items: center;
}

#change-pfp-btn {
  background: var(--accent);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 10px;
  padding: 6px 10px;
}

.account-section {
  height: fit-content;
}

.account-section,
.appearance-section {
  background: var(--surface);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  max-width: 400px;
  min-width: 49%;
}
.toggle-row,
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Range slider styling (font-size slider) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 320px;
  max-width: 60%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--surface-2) 0%);
  outline: none;
  transition: box-shadow 0.12s ease, background 0.12s ease;
}

input[type="range"]:focus {
  box-shadow: 0 0 0 6px rgba(59,110,245,0.08);
}

/* WebKit track */
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* WebKit thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  margin-top: -5px; /* center the thumb */
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* Mozilla */
input[type="range"]::-moz-range-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* In dark mode make track darker and thumb stand out */
body.dark input[type="range"]::-webkit-slider-runnable-track,
body.dark input[type="range"]::-moz-range-track {
  background: #2a2a2c;
}
body.dark input[type="range"]::-webkit-slider-thumb,
body.dark input[type="range"]::-moz-range-thumb {
  background: var(--accent);
  border: 3px solid var(--surface);
}

/* Preview text color coherent with theme */
#font-size-preview { color: var(--text-secondary); margin-top:8px }

#color-swatches {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow-xs);
}
.swatch:hover {
  transform: scale(1.06);
}

#bubble-style-options {
  display: flex;
  gap: 8px;
}
.bubble-option {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  border: 1px solid var(--border);
}
.bubble-option.active-bubble {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#logout-wrapper {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}
#logout-button {
  width: 160px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  transition: ease-in-out 0.2s;
  margin-bottom: 12px;  
}

#logout-button:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border: var(--danger-hover) solid 1px;
  transition: all 0.2s ease-in-out;

}

#logout-chat {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--danger);
  border-radius: 7px;
  padding: 5px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  transition: ease-in-out 0.2s;
  justify-content: center;
  display: flex;
  align-items: center;
}

.danger-zone {
  gap: 12px;
  display: flex;
  flex-direction: column;
}


/* If inside .settings-container, push logout to bottom */
.settings-container #logout-wrapper {
  margin-top: auto;
  padding-top: 12px;

}
@media (max-width: 855px) {
  .settings-container {
    padding: 0 16px;
  }
  .account-section,
  .appearance-section {
    min-width: 100%;
  }
}



@media (max-width: 720px) {
  .settings-page {
    padding: 16px;
  }
  #profile-pic-wrapper {
    width: 84px;
    height: 84px;
  }
}
#linebox {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
}
#linebox p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 10px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.oauth-btn img {
  width: 20px;
  height: 20px;
}

#oauthbuttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.error {
  color: #ff7b7b;
  min-height: 18px;
}

label {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.line {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  flex: 1;
}

#linebox p {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  color: var(--text-secondary);
}

.oauth-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  width: 100%;
}
/* Container to center the switch and labels */
.toggle-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
}

/* The switch box */
.switch {
  position: relative;
  display: inline-block;
  width: 200px;
  height: 28px;
}

/* Hide default checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}



/* Login page dark-mode polish */
body.dark.login-page {
  background: linear-gradient(180deg, #0b0b0c 0%, #0b0b0c 100%);
}

body.dark.login-page .login-box {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 12px 36px rgba(2,6,23,0.6);
}

body.dark.login-page #venture-login {
  color: var(--text-primary);
}

body.dark.login-page label,
body.dark.login-page #linebox p,
body.dark.login-page .line {
  color: var(--text-secondary);
}

body.dark.login-page input[type="email"],
body.dark.login-page input[type="password"],
body.dark.login-page input[type="text"] {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.04);
}

body.dark.login-page .login-btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(59,110,245,0.18);
}

body.dark.login-page .oauth-btn {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.04);
}

body.dark.login-page #headerbox {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

/* Slightly dim the turnstile widget area on dark page background */
body.dark.login-page #turnstile-widget { filter: brightness(0.9); }

/* Temporary: hide common dev-server / extension overlays that inject a top bar
   These selectors target common tools (LiveReload, BrowserSync, Live Server, VSCode preview).
   Remove this block when you identify the real injector. */
#live-server,
#LiveServer,
#__bs_notify__,
.\__bs_notify,
.livereload,
#livereload,
.browser-sync,
#browser-sync,
.browser-sync-ui,
.vscode-browser-preview-webview-toolbar,
.vscode-browser-preview,
.toolbar-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* If the bar persists, please inspect it in DevTools and paste the element's id/class here. */

/* The sliding track */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--accent);
  transition: 0.4s;
  border-radius: 34px;
  border: 1px solid var(--border);
}

/* The white circle (knob) */
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.slider:hover {
  background-color: var(--accent-hover);
}

/* Move knob when toggled */
input:checked + .slider:before {
  transform: translateX(170px);
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive + mobile sidebar improvements */

/* Mobile menu button (hidden on desktop) */
#mobile-menu-btn {
  display: none; /* hidden by default; shown on small screens in media query */
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 220;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
}

/* Sidebar overlay (click to close on mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 210;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Ensure the sidebar can slide in/out on small screens */
#left {
  transition:
    transform 0.25s ease,
    box-shadow 0.2s ease;
}

#left.sidebar-open {
  transform: translateX(0) !important;
}

/* Empty state helper (centers content) */
.empty-state {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
}

/* User search/result helpers */
.user-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.user-result:hover {
  background: var(--surface-2);
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.pf-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  font-size: 24px;
}

/* Modal/backdrop styles */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  z-index: 300;
  padding: 20px;
}
.modal-backdrop.open {
  display: flex;
}
.modal {
  background: var(--surface);
  padding: 18px;
  border-radius: 12px;
  width: min(840px, 96%);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
}
.modal h2 {
  margin-bottom: 12px;
}
.modal-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Modal internals: lists, rows, actions */
.modal .modal-user-results,
.modal .modal-user-results-af,
.modal #modal-user-results,
.modal #af-results {
  margin-top: 10px;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 6px; /* accommodate scrollbar */
}

.modal-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.12s ease, transform 0.12s ease;
}
.modal-user-row:hover { background: var(--surface-2); transform: translateY(-1px); }

.modal-user-row .user-info { flex: 1; min-width: 0; }
.modal-user-row .user-info h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-user-row .user-info p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.add-btn,
.remove-btn,
.req-accept-btn,
.req-reject-btn {
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.add-btn { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.add-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

.remove-btn { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.remove-btn:hover { background: var(--surface-3); }

.req-accept-btn { background: var(--online); color: #fff; }
.req-accept-btn:hover { filter: brightness(0.95); }
.req-reject-btn { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }

.member-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); margin: 6px 6px 0 0; font-weight: 600; color: var(--text-primary); }
.member-chip .chip-x { background: transparent; border-radius: 6px; padding: 2px 6px; cursor: pointer; margin-left: 6px; color: var(--text-muted); }

.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal button { font-family: var(--font); }

/* Profile/preview buttons */
.pf-search-container { display: flex; flex-direction: column; gap: 12px; }
.pf-detail-row { display: flex; gap: 12px; align-items: center; }
.pf-actions { display: flex; gap: 10px; margin-top: 6px; }
.pf-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; font-weight: 700; border: none; cursor: pointer; margin-right: 8px; font-size: 14px; }
.pf-btn.primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.pf-btn.primary:hover { background: var(--accent-hover); }
.pf-btn.secondary { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border); }

/* Back-to-results and other small profile buttons */
#pf-search-container #pf-search-back,
#pf-search-container button[aria-role="back"] {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
#pf-search-container #pf-search-back:hover { background: var(--surface-3); }

/* Ensure modal action buttons get decent default styling */
.modal .modal-actions button,
.modal button {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
}
.modal .modal-actions button.primary,
.modal button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Friend request rows */
.request-row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; }
.request-avatar { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.request-info { flex: 1; min-width: 0; }
.request-name { font-weight: 700; color: var(--text-primary); }
.request-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.request-actions { display:flex; gap:8px; }

/* Make modal inputs slightly larger and spaced */
.modal-input { font-size: 15px; margin-bottom: 10px; }

/* Ensure small modals look balanced on narrow screens */
@media (max-width: 520px) {
  .modal { padding: 14px; border-radius: 12px; }
  .add-btn, .remove-btn, .pf-btn { padding: 8px 10px; font-size: 13px; }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 300px;
  }
  #mobile-menu-btn {
    display: block;
  }
  #left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transform: translateX(-110%);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    z-index: 220;
  }
  #sidebar-overlay.overlay-visible {
    display: block;
    opacity: 1;
  }
  #right {
    padding: 18px;
  }
  .hero .container {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .hero {
    padding: 40px 0;
  }
  .hero-content h1 {
    font-size: 32px;
  }
  .right-header h2 {
    font-size: 22px;
  }
  .panel-inner {
    padding: 8px;
  }
  #user-search {
    height: 44px;
  }
}

/* 404 page styles */
#wrapper-404 {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  background: linear-gradient(180deg, var(--bg) 0%, #ffffff 60%);
}

#error-container {
  background: var(--surface);
  padding: 42px 36px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 760px;
  width: 100%;
}

#logo-head {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

#logo-error {
  width: 64px;
  height: 64px;
  object-fit: contain;
  transform: rotate(-37deg);
}

#logo-text {
  margin: 0;
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.container .symbol.deep {
  display: block;
  font-size: 96px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 6px 0 6px;
}

#error-message {
  font-size: 18px;
  color: var(--text-secondary);
  margin: 12px 0 20px;
}

#back-home {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: var(--shadow-accent);
  transition:
    transform 0.12s ease,
    background 0.12s ease;
}

#back-home:hover {
  transform: translateY(-3px);
  background: var(--accent-hover);
}

@media (max-width: 520px) {
  .container .symbol.deep {
    font-size: 64px;
  }
  #logo-text {
    font-size: 20px;
  }
  #error-container {
    padding: 28px 16px;
  }
}

/* Chat page styles */
.chat-container {
  max-width: 100%;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.chat-container header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  width: 100%;
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
}

.header-right {
  gap: 12px;
  display:flex;
  align-items:center;
  justify-content: center;
}

.header-center {
  flex: 1;
  flex-direction: column;
  text-align: center;
  gap: 2px;
}
.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  transform: rotate(-30deg);
}

#chat-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
#username {
  font-size: 12px;
  color: var(--text-secondary);
}

#chat {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
}

.bubble-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.received-wrapper {
  justify-content: flex-start;
}
.sent-wrapper {
  justify-content: flex-end;
}

.bubble-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.bubble {
  max-width: 72%;
  padding: 10px 12px;
  border-radius: 12px;
  position: relative;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow-xs);
  flex-direction: column;
}
.bubble .timestamp {
  display: block;
  font-size: 11px;
  color: var(--text-primary);
  margin-top: 8px;
}

.bubble.received {
  background: var(--surface-2);
  color: var(--text-primary);
  border-top-left-radius: 6px;
  text-align: left;
}
.bubble.sent {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  color: #fff;
  border-top-right-radius: 6px;
  text-align: right;
}

.reply-preview {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 6px 8px;
  border-left: 3px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
}

.msg-image,
.msg-video {
  width: 100%;
  max-width: 420px;
  border-radius: 10px;
  display: block;
  margin-top: 8px;
}
.msg-video {
  background: #000;
}
.file-card {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
}
.og-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  max-width: 420px;
}
.og-img {
  width: 96px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.og-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.og-site {
  font-size: 11px;
  color: var(--text-muted);
}
.og-title {
  font-weight: 700;
  font-size: 14px;
}
.og-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

#typingIndicator.typing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 16px;
}
#typingIndicator.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
  animation: chat-typing 1.2s infinite;
}
#typingIndicator.typing-dots span:nth-child(2) {
  animation-delay: 0.12s;
}
#typingIndicator.typing-dots span:nth-child(3) {
  animation-delay: 0.24s;
}
@keyframes chat-typing {
  0% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
}

.chat-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
#uploadBar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
#uploadFill {
  height: 8px;
  background: var(--accent);
  border-radius: 6px;
  width: 0%;
  transition: width 0.2s ease;
}

#replyBar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: 8px;
}
#replyBar #replyText {
  font-size: 13px;
  color: var(--text-primary);
}
#cancelReply {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
}

#input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
#input-row input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  outline: none;
}
#input-row button {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
}

#buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#buttons button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
}
#send {
  background: var(--accent);
  color: #fff;
}
#clearbtn {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

#msgMenu {
  position: fixed;
  display: none;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
}
#msgMenu button {
  background: transparent;
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
}

@media (max-width: 900px) {
  .right-header {
  margin-top: 50px;
  }

  .chat-container {
    padding: 0 8px;
  }
  .bubble {
    max-width: 86%;
  }
  .header-center {
    display: flex;
  }
}

/* Limit search icon and prevent oversized images */
.search-icon-btn .search-button,
.search-button {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: inline-block;
}

/* Prevent any large images from overflowing the right panel */
#right img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Center the empty-state inside results container for better balance */
#results-container .empty-state {
  padding: 24px;
  text-align: center;
  margin: 40px auto;
}

/* Slightly larger empty icon for clarity */
.empty-state .empty-icon {
  font-size: 28px;
}

/* Search layout polish */
#Outer-friends-search {
  justify-content: center;
  margin-bottom: 48px;
}

#Outer-friends-search > input {
  max-width: 820px;
  width: 100%;
  box-shadow: var(--shadow-xs);
  border-radius: 12px;
  padding: 0 48px 0 20px;
  height: 48px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
}

#Outer-friends-search > #search-users {
  margin-left: -52px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#search-users img {
  width: 18px;
  height: 18px;
}

#results-container {
  min-height: calc(100vh - 260px);
}

#results-container .empty-state {
  margin: 0 auto;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* Input focus */
#Outer-friends-search > input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 6px 18px rgba(59, 110, 245, 0.08);
}

#turnstile-widget {
  margin: 12px;
  position: fixed;
  bottom: 0%;
  display: flex;
  justify-self: center;
}

/* End of site.css */
