/* ============================================================
   PeachAI — main.css
   Design System: Tokens, Resets, Base Components
   ============================================================ */

/* Google Fonts loaded in HTML head */

/* ===== Design Tokens ===== */
:root {
  /* Brand Colors */
  --peach-50:  #fff5ef;
  --peach-100: #ffe8d8;
  --peach-200: #ffcba4;
  --peach-300: #ffaa78;
  --peach-400: #ff8c69;
  --peach-500: #ff6b47;
  --peach-600: #e85530;

  /* Neutrals — Dark Palette */
  --neutral-0:   #ffffff;
  --neutral-50:  #f8f8f8;
  --neutral-100: #f0f0f0;
  --neutral-200: #e0e0e0;
  --neutral-300: #b0b0b0;
  --neutral-400: #808080;
  --neutral-500: #606060;
  --neutral-600: #404040;
  --neutral-700: #2a2a2a;
  --neutral-800: #1a1a1a;
  --neutral-900: #111111;
  --neutral-950: #090909;

  /* Semantic Colors */
  --bg-primary:   #0d0d0d;
  --bg-secondary: #141414;
  --bg-tertiary:  #1c1c1c;
  --bg-elevated:  #222222;
  --bg-glass:     rgba(255,255,255,0.04);

  --surface-1: #181818;
  --surface-2: #1f1f1f;
  --surface-3: #282828;

  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.1);
  --border-strong:  rgba(255,255,255,0.18);

  --text-primary:   #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-tertiary:  #606060;
  --text-peach:     #FF9272;

  --success: #34c78b;
  --warning: #f5a623;
  --error:   #ff5a5a;

  /* LinkedIn */
  --linkedin: #0A66C2;

  /* Typography */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;
  --text-6xl:  3.75rem;

  --weight-light:    300;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-extrabold:800;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

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

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-xl:  0 24px 64px rgba(0,0,0,0.7);
  --shadow-peach: 0 0 30px rgba(255, 140, 105, 0.15);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Z-index scale */
  --z-base:    1;
  --z-sticky:  10;
  --z-overlay: 100;
  --z-dialog:  200;
  --z-toast:   300;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Page Switching ===== */
.page {
  display: none;
  min-height: 100vh;
}
.page.active {
  display: block;
}

/* ===== View Transitions ===== */
@keyframes slide-to-left {
  to { transform: translateX(-40px); opacity: 0; }
}
@keyframes slide-from-right {
  from { transform: translateX(40px); opacity: 0; }
}
@keyframes slide-to-right {
  to { transform: translateX(40px); opacity: 0; }
}
@keyframes slide-from-left {
  from { transform: translateX(-40px); opacity: 0; }
}

::view-transition-group(root) {
  animation: 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

html:active-view-transition-type(forward)::view-transition-old(root) {
  animation-name: slide-to-left;
}
html:active-view-transition-type(forward)::view-transition-new(root) {
  animation-name: slide-from-right;
}
html:active-view-transition-type(backward)::view-transition-old(root) {
  animation-name: slide-to-right;
}
html:active-view-transition-type(backward)::view-transition-new(root) {
  animation-name: slide-from-left;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root) {
    animation: none !important;
  }
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

p { color: var(--text-secondary); }

a {
  color: var(--text-peach);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul, ol { list-style: none; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ===== Gradient Text ===== */
.gradient-text {
  background: linear-gradient(135deg, var(--peach-200) 0%, var(--peach-500) 60%, #ff4f6a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== Brand ===== */
.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(255, 140, 105, 0.3));
}

.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.brand-ai {
  color: var(--peach-300);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-family: var(--font-sans);
  transition: all var(--transition-normal);
  white-space: nowrap;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after { opacity: 0.05; }
.btn:active::after { opacity: 0.1; }

.btn-primary {
  background: linear-gradient(135deg, var(--peach-400) 0%, var(--peach-500) 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 71, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255, 107, 71, 0.4);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-glass);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-peach);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: var(--weight-medium);
  transition: opacity var(--transition-fast);
}

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

/* ===== Form Fields ===== */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="url"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-field input:focus {
  border-color: var(--peach-400);
  box-shadow: 0 0 0 3px rgba(255, 140, 105, 0.15);
}

.form-field input:user-valid {
  border-color: var(--success);
}

.form-field input:user-invalid {
  border-color: var(--error);
}

.form-field input::placeholder {
  color: var(--text-tertiary);
}

.field-error {
  font-size: var(--text-xs);
  color: var(--error);
  min-height: 16px;
  display: block;
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  accent-color: var(--peach-400);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 48px !important;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.password-toggle:hover { color: var(--text-secondary); }

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 40px !important;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  z-index: var(--z-toast);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: 360px;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.toast-success { border-color: var(--success); }
.toast.toast-error   { border-color: var(--error); }
