/* CHIDOL App Shell, Auth, Profile, Invites & Admin Styles
   Built on top of /app/theme.css tokens and components. */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.loading-screen {
  margin: auto;
  padding: var(--s7) var(--s5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  color: var(--text-muted);
  font-weight: 500;
}

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.narrow-card-wrap {
  max-width: 560px;
  margin: var(--s5) auto;
}

/* Navbar Shell Extensions */
.nav-user-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.avatar-trigger {
  padding: 2px;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform 0.14s var(--ease), border-color 0.15s, box-shadow 0.15s;
}

.avatar-trigger:hover,
.avatar-trigger[aria-expanded='true'] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.25);
}

.nav-dropdown {
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
}

.menu-user-header {
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-user-name {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}

.nav-hamburger {
  display: none;
}

.mobile-drawer {
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: rgba(17, 20, 28, 0.98);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-strong);
  padding: var(--s3) var(--s4) var(--s4);
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.18s var(--ease);
  z-index: 55;
}

.mobile-drawer-user {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
}

/* Split Hero Auth Layout (/login, /register, /reset) */
.auth-split-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: stretch;
}

.auth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s7) var(--s6);
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(91, 124, 255, 0.25), transparent 65%),
    radial-gradient(700px 500px at 80% 85%, rgba(160, 92, 255, 0.22), transparent 65%),
    linear-gradient(160deg, #0b0e18 0%, #111628 100%);
  border-right: 1px solid var(--border);
}

.auth-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(109, 124, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 124, 255, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9) 25%, transparent 80%);
  pointer-events: none;
}

.auth-hero-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 124, 255, 0.22), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.auth-hero-content {
  position: relative;
  z-index: 1;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.auth-brand-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
}

.brand-mark-lg {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 14px;
}

.auth-logo-text {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 26px);
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #ffffff 20%, #a9b8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-tagline {
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-lead {
  font-size: 16px;
  line-height: 1.65;
}

.ps-symbols-row {
  display: flex;
  gap: var(--s3);
}

.ps-sym {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ps-sym-triangle { color: var(--ps-triangle); border-color: rgba(47, 211, 160, 0.35); }
.ps-sym-circle { color: var(--ps-circle); border-color: rgba(255, 92, 122, 0.35); }
.ps-sym-cross { color: var(--ps-cross); border-color: rgba(91, 157, 255, 0.35); }
.ps-sym-square { color: var(--ps-square); border-color: rgba(224, 123, 255, 0.35); }

.auth-feature-list {
  list-style: none;
  margin: var(--s2) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  color: var(--text-muted);
  font-size: 14px;
}

.auth-feature-list li {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.auth-feature-list .icon {
  color: var(--primary-hover);
  flex: none;
}

.auth-card-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6) var(--s5);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: var(--s6);
  animation: fade-up 0.3s var(--ease);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary-hover);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.link-btn:hover {
  text-decoration: underline;
}

.active-eye {
  color: var(--primary-hover) !important;
}

.strength-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: -6px;
}

.strength-bar {
  height: 6px;
}

/* Avatar Color Swatches */
.avatar-picker-row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  --swatch-color: var(--primary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, var(--swatch-color), color-mix(in srgb, var(--swatch-color) 60%, #000));
  cursor: pointer;
  padding: 0;
  transition: transform 0.14s var(--ease), border-color 0.14s, box-shadow 0.14s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(109, 124, 255, 0.45);
  transform: scale(1.08);
}

/* Profile Page */
.profile-hero-top {
  display: flex;
  align-items: center;
  gap: var(--s6);
  flex-wrap: wrap;
}

.profile-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
}

.profile-avatar-click {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(9, 11, 16, 0.72);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}

.profile-avatar-click:hover .profile-avatar-overlay,
.profile-avatar-click:focus-visible .profile-avatar-overlay {
  opacity: 1;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s4);
}

.profile-meta-row {
  gap: var(--s2);
}

/* Tables, Member Cards & Invite Tree */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14px;
}

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

.data-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td { white-space: nowrap; }

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.members-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.member-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.invite-url-large {
  height: 50px;
  font-size: 14px;
  background: var(--bg);
  border-color: var(--primary);
}

.invite-tree-root {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.invite-tree-node {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.invite-tree-card {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.invite-tree-children {
  margin-left: var(--s5);
  padding-left: var(--s4);
  border-left: 2px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .auth-split-page {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    padding: var(--s6) var(--s5);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .auth-card-col {
    padding: var(--s5) var(--s4) var(--s7);
  }
}

@media (max-width: 640px) {
  .nav-hamburger {
    display: inline-flex;
  }

  .nav-invite-btn,
  .nav-extra-actions {
    display: none;
  }

  .auth-hero {
    padding: var(--s5) var(--s4);
  }

  .auth-feature-list {
    display: none;
  }

  .auth-card {
    padding: var(--s5) var(--s4);
  }

  .profile-hero-top {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s4);
  }

  .avatar-picker-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .invite-tree-children {
    margin-left: var(--s3);
    padding-left: var(--s3);
  }
}
