/* ============================================================
   MySuperFriends — Shared Stylesheet
   ============================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  --color-primary:       #7c3aed;   /* violet-700 */
  --color-primary-light: #8b5cf6;   /* violet-500 */
  --color-primary-dark:  #6d28d9;   /* violet-800 */
  --color-primary-bg:    #f5f3ff;   /* violet-50 */
  --color-accent:        #ec4899;   /* pink-500 */
  --color-accent-light:  #f9a8d4;   /* pink-300 */

  --color-text:          #111827;   /* gray-900 */
  --color-text-muted:    #6b7280;   /* gray-500 */
  --color-text-light:    #9ca3af;   /* gray-400 */

  --color-bg:            #ffffff;
  --color-bg-soft:       #f9fafb;   /* gray-50 */
  --color-bg-muted:      #f3f4f6;   /* gray-100 */

  --color-border:        #e5e7eb;   /* gray-200 */
  --color-border-dark:   #d1d5db;   /* gray-300 */

  --color-success:       #10b981;   /* emerald-500 */
  --color-warning:       #f59e0b;   /* amber-500 */
  --color-danger:        #ef4444;   /* red-500 */
  --color-info:          #3b82f6;   /* blue-500 */

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 25px rgba(0,0,0,0.10), 0 10px 10px rgba(0,0,0,0.04);

  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --transition-fast: 0.1s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-primary-bg);
  text-decoration: none;
}

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

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
}

.btn-block { width: 100%; justify-content: center; }

.btn[disabled], .btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

input::placeholder, textarea::placeholder {
  color: var(--color-text-light);
}

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

.form-error {
  font-size: 0.8125rem;
  color: var(--color-danger);
  margin-top: 4px;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-primary   { background: var(--color-primary-bg); color: var(--color-primary); }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-muted     { background: var(--color-bg-muted); color: var(--color-text-muted); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-success { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.alert-warning { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.alert-danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alert-info    { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }

/* ── Loading Spinner ────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ── Persona Cards ──────────────────────────────────────────── */
.persona-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

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

.persona-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.persona-card .persona-emoji {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
}

.persona-card .persona-name {
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 4px;
  color: var(--color-text);
}

.persona-card .persona-tagline {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.persona-card .check-indicator {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.persona-card.selected .check-indicator {
  display: flex;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  border-bottom: 2px solid var(--color-border);
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}

.tab {
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--color-primary); }

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Navigation ─────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand:hover { text-decoration: none; }

.nav-logo {
  height: 44px;
  width: auto;
}

.footer-logo {
  height: 38px;
  width: auto;
}

.topbar-logo {
  height: 30px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Utility Classes ────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--color-text-muted); }
.text-small  { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }

.w-full { width: 100%; }
.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 560px; }
.max-w-lg { max-width: 720px; }
.max-w-xl { max-width: 960px; }
.max-w-2xl { max-width: 1200px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.hidden { display: none !important; }
.visible { display: block !important; }

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

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

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  position: relative;
}

.modal-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--color-bg-muted);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

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

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .nav {
    padding: 12px 16px;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 1rem;
  }
}
