/* ========== Base Styles ========== */

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

:root {
  --bg-color: #0f1117;
  --bg-surface: #161822;
  --bg-card: #1c1f2e;
  --bg-card-hover: #232740;
  --accent: #6c63ff;
  --accent-light: #8b83ff;
  --accent-soft: rgba(108, 99, 255, 0.12);
  --accent-glow: rgba(108, 99, 255, 0.25);
  --text-main: #e4e6f0;
  --text-muted: #8a8ea8;
  --text-dim: #5a5e78;
  --border-soft: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(108, 99, 255, 0.3);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.15);
  --radius-card: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --transition-fast: 0.2s ease;
  --font-main: "Inter", system-ui, -apple-system, sans-serif;
  --line-color: rgba(108, 99, 255, 0.35);
  --sidebar-width: 220px;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --success: #22c55e;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg-color);
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

/* ========== Auth Page ========== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 30% 20%, rgba(108, 99, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(99, 179, 255, 0.05), transparent 50%),
    var(--bg-color);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  padding: 36px 32px 32px;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  font-size: 1.8rem;
  margin: 0 0 4px;
  font-weight: 800;
}

.auth-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 24px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.forgot-link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
}

.forgot-link {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.82rem;
  font-family: var(--font-main);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.forgot-link:hover {
  opacity: 1;
}

/* ========== Welcome Page ========== */

.welcome-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 40%, rgba(108, 99, 255, 0.1), transparent 60%),
    var(--bg-color);
}

.welcome-card {
  text-align: center;
  max-width: 500px;
}

.welcome-emoji {
  font-size: 5rem;
  margin-bottom: 20px;
}

.welcome-title {
  font-size: 2.8rem;
  font-weight: 800;
  margin: 0 0 16px;
}

.welcome-text {
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1.7;
  margin: 0 0 32px;
}

/* ========== New Tree Page ========== */

.new-tree-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 50%, rgba(108, 99, 255, 0.06), transparent 50%),
    var(--bg-color);
}

.new-tree-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 32px;
  width: 100%;
  max-width: 440px;
}

.new-tree-card h2 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.new-tree-hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 20px;
}

.new-tree-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ========== Shared Form ========== */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
  outline: none;
  color: var(--text-main);
  background: var(--bg-surface);
  font-family: var(--font-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

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

.hint {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.form-message {
  margin: 4px 0 0;
  min-height: 16px;
  font-size: 0.82rem;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--success);
}

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

.btn-primary {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 6px 20px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.btn-full {
  width: 100%;
}

.btn-primary.btn-large {
  padding: 14px 32px;
  font-size: 1rem;
}

.btn-secondary {
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
  font-family: var(--font-main);
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

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

.btn-danger {
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px var(--danger-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--danger-glow);
}

.btn-danger:active {
  transform: translateY(0);
}

/* ========== Dashboard & Tree View ========== */

.dashboard {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--bg-body);
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 0;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-logo {
  font-size: 1.3rem;
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}

.sidebar-tree-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

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

.sidebar-tree-item.active {
  background: var(--accent-soft);
  color: var(--accent-light);
  border-color: var(--border-accent);
  font-weight: 600;
}

.sidebar-new-btn {
  margin: 4px 8px 8px;
  padding: 9px 0;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all var(--transition-fast);
}

.sidebar-new-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent-light);
  background: var(--accent-soft);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--danger);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  padding: 4px 6px;
  border-radius: 6px;
  transition: background var(--transition-fast);
}

.sidebar-logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 32px;
  overflow-y: auto;
  position: relative;
}

.main-header {
  margin-bottom: 20px;
}

.main-header h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
}

.family-name-bar {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  display: inline-block;
}

.family-name-bar label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.family-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.family-name-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  outline: none;
  width: 250px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.family-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* When set (readonly), remove the input background to look "locked" */
.family-name-input[readonly] {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.family-name-input[readonly]:focus {
  border-color: transparent;
  box-shadow: none;
}

.btn-fn {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  font-family: var(--font-main);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.btn-fn-edit {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.btn-fn-edit:hover {
  border-color: var(--border-accent);
  background: var(--accent-soft);
  color: var(--accent-light);
}

.btn-fn-save {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-fn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.family-name-row button {
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 500;
}

/* ========== Search Bar ========== */

.search-bar-container {
  display: flex;
  gap: 12px;
  padding: 0 16px 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  max-width: 300px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  color: var(--text-base);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--border-accent);
}

/* Main Panel Layout (restored) */
.main-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

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

.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 20px 18px 22px;
  border: 1px solid var(--border-soft);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

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

.tree-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tree-scroll {
  width: 100%;
  overflow: auto;
  padding-bottom: 8px;
  flex: 1;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(108, 99, 255, 0.03), transparent);
}

.tree-canvas {
  position: relative;
  width: max-content;
  min-width: 100%;
  padding: 14px 8px 10px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* Transition for smooth zooming via JS transform */
  transition: transform 0.1s ease-out;
  transform-origin: top center;
}

.connections-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tree-root {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 0;
  transform: rotate(180deg);
}

.tree {
  padding-left: 0;
  margin: 0;
}

.tree ul {
  padding-top: 26px;
  position: relative;
  margin: 0;
  padding-left: 0;
}

.tree li {
  list-style-type: none;
  text-align: center;
  position: relative;
  padding: 18px 12px 0 12px;
  display: inline-block;
  vertical-align: top;
}

.family-node {
  display: inline-flex;
  gap: 12px;
  justify-content: center;
  position: relative;
  z-index: 2;
}

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

.member-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 4px 6px 3px 5px;
  /* Irregular hand-drawn corners */
  min-width: 130px;
  background: #fdfbf7;
  /* Off-white parchment */
  color: #171513;
  /* Dark ink text */
  border: 1.5px solid #a89f8d;
  box-shadow: 2px 4px 6px rgba(100, 85, 70, 0.4);
  /* Sketched drop shadow */
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
  transform: rotate(180deg);
}

.member-card:hover {
  transform: rotate(180deg) translateY(2px);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.6);
  border-color: #8c7e6b;
}

/* Give text explicit shadow overrides so it reads clearly inside the light box */
.member-card .member-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1c1c1c;
}

.member-card .member-meta {
  font-size: 0.8rem;
  color: #5c5c5c;
  background: transparent;
  padding: 2px 0 0 0;
  border-radius: 0;
}

.member-card.gender-male {
  border-width: 2px;
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 2px 4px 6px rgba(59, 130, 246, 0.3);
}

.member-card.gender-female {
  border-width: 2px;
  border-color: rgba(236, 72, 153, 0.8);
  box-shadow: 2px 4px 6px rgba(236, 72, 153, 0.3);
}

/* Generation Aesthetics */
.node-root {
  background: #eae3d3;
  /* Darker paper for roots */
  border-color: #a89f8d;
}

.node-branch {
  background: #fdfbf7;
}

.node-leaf {
  background: #f2f7ed;
  /* Very slight green leafy tint */
  border-color: #bcd4b4;
}

.member-meta.root {
  background: transparent !important;
  color: #5c5c5c !important;
}

/* ========== Tree Banner / Ribbon ========== */

.tree-banner {
  position: absolute;
  top: -40px;
  /* absolute positioned relative to the tree-root which is rotated 180deg */
  z-index: 10;
  background: #f4ecdc;
  color: #2c251d;
  padding: 12px 60px;
  border: 1px solid #c2b6a3;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
  font-family: serif;
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: 2px;
  transform: rotate(180deg);
  /* Text needs to be upright */

  /* Ribbon cutouts effect using clip-path or simple borders */
}

/* Search Highlight Glow */
@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.7);
  }

  70% {
    box-shadow: 0 0 0 20px rgba(234, 179, 8, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0);
  }
}

.highlight-glow {
  border-color: #eab308 !important;
  /* Yellow accent */
  animation: pulseGlow 1.5s infinite;
  z-index: 10;
}

.member-name {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Zoom Level Visibility Rules */
.zoom-low .member-name {
  display: none;
}

.zoom-mid .member-name {
  font-size: 0.7rem;
  opacity: 0.8;
}

.member-meta {
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--accent-light);
  background: var(--accent-soft);
}

.member-meta.root {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

/* ========== Person Detail Page ========== */

.person-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.person-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.person-title {
  margin: 0;
  font-size: 1.2rem;
}

.person-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.person-layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 22px;
  align-items: flex-start;
}

.person-edit-panel h3,
.person-info-panel h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.25rem;
  font-weight: 700;
}

.person-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.info-stroke-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.info-stroke {
  padding: 20px 22px;
  border-radius: 14px;
  background: rgba(108, 99, 255, 0.05);
  border: 1px solid var(--border-soft);
}

.info-stroke-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-light);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.info-stroke-content {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.6;
  word-break: break-word;
}

.info-stroke-multiline {
  white-space: pre-wrap;
  font-weight: 500;
  font-size: 1.15rem;
}

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

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px 24px;
  }

  .main-content {
    padding: 16px 12px 24px;
  }

  .member-card {
    min-width: 100px;
    padding: 8px 10px;
  }

  .btn-add-member-text {
    display: none;
  }
}

@media (max-width: 839px) {
  .sidebar {
    width: 56px;
    min-width: 56px;
  }

  .sidebar-title,
  .sidebar-user {
    display: none;
  }

  .sidebar-header {
    justify-content: center;
    padding: 14px 6px;
  }

  .sidebar-tree-item {
    font-size: 0;
    padding: 10px 6px;
    text-align: center;
  }

  .sidebar-tree-item::first-letter {
    font-size: 0.9rem;
  }

  .sidebar-new-btn {
    font-size: 1rem;
    margin: 4px 4px 8px;
  }

  .sidebar-logout {
    font-size: 0;
    padding: 6px;
  }

  .sidebar-logout::after {
    content: "↗";
    font-size: 0.9rem;
  }

  .sidebar-footer {
    justify-content: center;
  }

  .main-panels {
    grid-template-columns: 1fr;
  }

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

  .tree-card {
    order: -1;
  }

  .tree-scroll {
    min-height: 55vh;
  }
}

@media (min-width: 840px) {
  .tree-card {
    min-height: calc(100vh - 200px);
  }
}

/* ========== Context Menu ========== */

.context-menu {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  padding: 6px 0;
  min-width: 160px;
  z-index: 1000;
}

.context-menu.hidden {
  display: none;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.menu-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 6px 0;
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.hidden {
  display: none;
}

/* "+ Add Member" step overlay: allow clicking the tree behind it. */
#add-step-overlay {
  pointer-events: none;
}

#add-step-overlay .modal-content {
  pointer-events: auto;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

/* Step 2 Top Tip Mode */
.modal-overlay.step-2-active {
  background: transparent;
  backdrop-filter: none;
  align-items: flex-start;
  padding-top: 40px;
  pointer-events: none;
}

.modal-overlay.step-2-active .modal-content {
  max-width: fit-content;
  min-width: 300px;
  padding: 16px 48px 16px 20px;
  border: 2px solid var(--accent);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.modal-overlay.step-2-active #add-step-title {
  display: none;
}

.modal-overlay.step-2-active .modal-close {
  top: 12px;
  right: 12px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

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

/* ========== Language Switcher ========== */

.lang-switcher {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
}

/* Dashboard language switcher */
.dash-lang-switcher {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 1200;
}

.lang-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-main);
  transition: all var(--transition-fast);
}

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

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 160px;
  box-shadow: var(--shadow-soft);
}

.lang-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}

.lang-option:hover {
  background: var(--accent-soft);
}

/* ========== + Add Member Button ========== */

.btn-add-member {
  width: auto;
  height: auto;
  border-radius: var(--radius-pill);
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-light);
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1;
  min-width: 140px;
}

.btn-add-member-plus {
  font-size: 1.25rem;
  line-height: 1;
}

.btn-add-member-text {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.btn-add-member:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ========== Step Select ========== */

.step-select {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
}

.step-select:focus {
  border-color: var(--accent);
  outline: none;
}