/* GestaltPath Team Management — Styles
   Extracted from team-legacy.html prototype */

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

:root {
  --teal-600: #3D8B8B;
  --teal-700: #2D6E6E;
  --teal-800: #2D5E5E;
  --sage-50: #F0F6F6;
  --sage-100: #D8ECEC;
  --sage-400: #5A9E8F;
  --text-900: #1A1A2E;
  --text-700: #3D3D56;
  --text-500: #6B6B80;
  --text-300: #A0A0B0;
  --white: #FFFFFF;
  --border: #E8E8EE;
  --warm-50: #FDF8F0;
  --s1: #3D8B8B;
  --s2: #5A9E8F;
  --s3: #7BAF8A;
  --s4: #A8B87A;
  --s5: #D4B86A;
  --s6: #E8C8A0;
  --green: #34C759;
  --green-light: #E8F5E9;
  --orange: #FF9500;
  --orange-light: #FFF3E0;
  --red: #FF3B30;
  --red-light: #FFEBEE;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--sage-50);
  color: var(--text-900);
  line-height: 1.6;
}

.hidden { display: none !important; }

/* Navigation */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: 68px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
}

.nav-left { display: flex; align-items: center; gap: 50px; }
.logo {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; text-decoration: none;
  color: var(--text-900); font-weight: 600; font-size: 16px;
}
.nav-links { display: flex; gap: 35px; list-style: none; }
.nav-links a {
  text-decoration: none; color: var(--text-700);
  font-size: 14px; font-weight: 500;
  transition: color 0.2s; padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--teal-600); }
.nav-links a.active { color: var(--teal-600); border-bottom-color: var(--teal-600); }
.nav-cta {
  background: var(--teal-600); color: var(--white); border: none;
  padding: 10px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.nav-cta:hover { background: var(--teal-700); }

/* Main Content */
main { margin-top: 68px; padding-bottom: 100px; }
.view { display: none; }
.view.active { display: block; }

/* Setup State */
.setup-container {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 68px - 100px); padding: 40px 20px;
}
.setup-card {
  background: var(--white); border-radius: 16px; padding: 60px 40px;
  max-width: 500px; width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); text-align: center;
}
.setup-illustration {
  width: 120px; height: 120px; margin: 0 auto 32px;
  background: linear-gradient(135deg, var(--sage-100) 0%, var(--sage-50) 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.setup-heading { font-size: 28px; font-weight: 700; color: var(--text-900); margin-bottom: 12px; }
.setup-subtitle { font-size: 16px; color: var(--text-500); margin-bottom: 32px; line-height: 1.6; }

/* Forms */
.setup-form, .login-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; text-align: left; margin-bottom: 20px; }
.form-group:last-of-type { margin-bottom: 24px; }
.form-label { font-size: 14px; font-weight: 600; color: var(--text-700); }
.form-input {
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus { outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(61, 139, 139, 0.1); }
.form-input::placeholder { color: var(--text-300); }

/* Team Management View */
.content-wrapper { max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.team-header-section { margin-bottom: 40px; padding-top: 40px; }
.team-title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.team-title { font-size: 36px; font-weight: 700; color: var(--text-900); }
.team-name-input {
  font-size: 36px; font-weight: 700; color: var(--text-900);
  border: 2px solid var(--teal-600); border-radius: 8px; padding: 4px 12px;
  font-family: inherit; background: var(--white);
}
.edit-team-btn {
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  color: var(--text-500); font-size: 18px; transition: color 0.2s;
}
.edit-team-btn:hover { color: var(--teal-600); }
.team-subtitle { font-size: 14px; color: var(--text-500); }

/* Tabs */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.tab {
  padding: 16px 0; font-size: 14px; font-weight: 500; color: var(--text-500);
  cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s;
  background: none; border-top: none; border-left: none; border-right: none;
}
.tab.active { color: var(--teal-600); border-bottom-color: var(--teal-600); }
.tab:hover { color: var(--text-900); }

/* Section Header */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.section-header h2 { font-size: 22px; font-weight: 600; color: var(--text-900); }

/* Buttons */
.btn-primary {
  background: var(--teal-600); color: var(--white); border: none;
  padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: var(--teal-700); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-small { padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-small-primary { background: var(--teal-600); color: var(--white); }
.btn-small-primary:hover { background: var(--teal-700); }
.btn-small-secondary { background: var(--sage-100); color: var(--text-700); }
.btn-small-secondary:hover { background: var(--border); }
.btn-cancel {
  background: var(--sage-100); color: var(--text-700); border: none;
  padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-cancel:hover { background: var(--border); }
.btn-submit {
  background: var(--teal-600); color: var(--white); border: none;
  padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-submit:hover { background: var(--teal-700); }
.btn-close {
  background: none; border: none; font-size: 24px; color: var(--text-500); cursor: pointer;
  padding: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; transition: color 0.2s;
}
.btn-close:hover { color: var(--text-900); }

/* SP Table */
.sp-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.sp-table thead { background: var(--sage-50); }
.sp-table th { padding: 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-700); border-bottom: 1px solid var(--border); }
.sp-table td { padding: 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.sp-table tr:last-child td { border-bottom: none; }
.sp-name { font-weight: 600; color: var(--text-900); }
.sp-email { color: var(--text-500); font-size: 13px; }
.sp-last-active { color: var(--text-500); font-size: 13px; }
.sp-actions { position: relative; }

/* Badges */
.badge { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge-owner { background: rgba(61, 139, 139, 0.1); color: var(--teal-600); }
.badge-member { background: rgba(90, 158, 143, 0.1); color: var(--sage-400); }
.badge-active { background: var(--green-light); color: var(--green); }
.badge-deactivated { background: var(--red-light); color: var(--red); }

/* Dropdown */
.dropdown-toggle {
  background: var(--border); border: none; padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-700); cursor: pointer; transition: background 0.2s;
}
.dropdown-toggle:hover { background: var(--teal-600); color: var(--white); }
.dropdown-menu {
  display: none; position: absolute; top: 100%; right: 0;
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); z-index: 100; min-width: 160px; margin-top: 4px;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: block; width: 100%; padding: 12px 16px; border: none; background: none;
  text-align: left; font-size: 13px; color: var(--text-700); cursor: pointer; transition: background 0.2s;
}
.dropdown-item:first-child { border-radius: 8px 8px 0 0; }
.dropdown-item:last-child { border-radius: 0 0 8px 8px; }
.dropdown-item:hover { background: var(--sage-50); }
.dropdown-item.danger:hover { background: var(--red-light); color: var(--red); }

/* Client Cards Grid */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.client-card {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; transition: all 0.2s;
}
.client-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border-color: var(--teal-600); }
.client-header { display: flex; gap: 12px; margin-bottom: 16px; }
.client-avatar {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--teal-600) 0%, var(--sage-400) 100%);
  color: var(--white); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.client-info { flex: 1; }
.client-name { font-size: 14px; font-weight: 600; color: var(--text-900); margin-bottom: 4px; }
.client-age { font-size: 12px; color: var(--text-500); }
.client-meta { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.client-meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 8px; }
.client-meta-row:last-child { margin-bottom: 0; }
.client-meta-label { color: var(--text-500); }
.client-meta-value { color: var(--text-900); font-weight: 600; }
.stage-badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--white); }
.stage-1 { background: var(--s1); }
.stage-2 { background: var(--s2); }
.stage-3 { background: var(--s3); }
.stage-4 { background: var(--s4); }
.stage-5 { background: var(--s5); }
.stage-6 { background: var(--s6); }
.stage-distribution { display: flex; gap: 2px; margin-bottom: 12px; height: 6px; border-radius: 3px; overflow: hidden; }
.stage-bar { flex: 0 0 auto; border-radius: 3px; }
.client-actions { display: flex; gap: 8px; }
.client-actions .btn-small { flex: 1; padding: 8px 12px; font-size: 12px; }

/* Modal */
.modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5); z-index: 2000;
  justify-content: center; align-items: center; padding: 20px;
}
.modal.show { display: flex; }
.modal-content {
  background: var(--white); border-radius: 12px; padding: 32px;
  max-width: 450px; width: 100%;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
}
.modal-header { margin-bottom: 24px; }
.modal-header h2 { font-size: 22px; font-weight: 700; color: var(--text-900); margin-bottom: 8px; }
.modal-header p { font-size: 14px; color: var(--text-500); }
.info-callout {
  background: var(--warm-50); border: 1px solid #FFE4D0; border-radius: 8px;
  padding: 12px 14px; font-size: 13px; color: var(--text-700); margin-bottom: 24px;
}
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* Side Panel */
.side-panel {
  position: fixed; right: -400px; top: 0; bottom: 0; width: 400px;
  background: var(--white); box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 1500; transition: right 0.3s ease; overflow-y: auto;
}
.side-panel.show { right: 0; }
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--white); z-index: 10;
}
.panel-header h2 { font-size: 20px; font-weight: 700; color: var(--text-900); }
.panel-body { padding: 24px; }
.detail-section { margin-bottom: 32px; }
.detail-section h3 { font-size: 14px; font-weight: 600; color: var(--text-900); margin-bottom: 12px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-500); }
.detail-value { color: var(--text-900); font-weight: 600; }
.client-detail-avatar {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--teal-600) 0%, var(--sage-400) 100%);
  color: var(--white); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; margin-bottom: 24px;
}
.utterance-item { padding: 12px; background: var(--sage-50); border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.utterance-text { color: var(--text-900); font-weight: 500; margin-bottom: 6px; }
.utterance-meta { display: flex; gap: 8px; font-size: 11px; align-items: center; }
.utterance-stage { padding: 2px 6px; }
.utterance-date { color: var(--text-500); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
  padding: 12px 24px; border-radius: 8px;
  font-size: 14px; font-weight: 500; z-index: 3000;
  transition: transform 0.3s ease;
  background: var(--text-900); color: var(--white);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--red); }
.toast-info { background: var(--teal-600); }

/* Loading Spinner */
#loading-spinner {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  background: var(--teal-600); color: var(--white);
  padding: 8px 20px; border-radius: 20px;
  font-size: 13px; z-index: 2500;
}

/* ─── Team Picker ─────────────────────────────────────────────────────────── */

.team-picker-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.team-picker-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-200, #e5e7eb);
  background: var(--bg-50, #fff);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.team-picker-card:hover {
  border-color: var(--teal-600, #3D8B8B);
  box-shadow: 0 2px 8px rgba(61, 139, 139, 0.12);
}

.team-picker-icon {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-50, #f0f9f9);
  border-radius: 10px;
  flex-shrink: 0;
}

.team-picker-info { flex: 1; }

.team-picker-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-900, #111);
  margin-bottom: 4px;
}

.team-picker-badges {
  display: flex;
  gap: 6px;
}

.team-picker-arrow {
  font-size: 24px;
  color: var(--text-400, #9ca3af);
  flex-shrink: 0;
}

.badge-personal {
  background: var(--text-100, #f3f4f6);
  color: var(--text-500, #6b7280);
}

/* ─── Team Switcher (nav dropdown) ───────────────────────────────────────── */

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-switcher {
  position: relative;
}

.team-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-200, #e5e7eb);
  border-radius: 8px;
  background: var(--bg-50, #fff);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-700, #374151);
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-switcher-btn:hover {
  border-color: var(--teal-600, #3D8B8B);
}

.team-switcher-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--bg-50, #fff);
  border: 1px solid var(--border-200, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 100;
  overflow: hidden;
}

.team-switcher-menu.show { display: block; }

.team-switcher-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text-700, #374151);
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.team-switcher-item:hover {
  background: var(--teal-50, #f0f9f9);
}

.team-switcher-item.active {
  font-weight: 600;
  color: var(--teal-600, #3D8B8B);
  background: var(--teal-50, #f0f9f9);
}

/* Footer */
.site-footer {
  background: #1A1A2E; color: rgba(255,255,255,0.6);
  padding: 48px 40px 32px; margin-top: 60px;
}
.footer-inner { max-width: 1140px; margin: 0 auto; }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 32px;
}
.footer-brand h3 { color: white; font-size: 18px; margin-bottom: 12px; }
.footer-brand p { font-size: 14px; line-height: 1.7; }
.footer-col h4 { color: white; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: rgba(255,255,255,0.6); text-decoration: none; font-size: 14px; transition: color 0.2s; }
.footer-col a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1); padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; flex-wrap: wrap; gap: 12px;
}
.footer-bottom a { color: rgba(255,255,255,0.5); text-decoration: none; }
.footer-bottom a:hover { color: white; }

/* Responsive */
@media (max-width: 768px) {
  nav { padding: 0 20px; }
  .nav-links { display: none; }
  .content-wrapper { padding: 0 20px; }
  .clients-grid { grid-template-columns: 1fr; }
  .side-panel { width: 100%; right: -100%; }
  .team-title { font-size: 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
