/* ============================================
   Invokable Portal — Design System & Shared Styles
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
  /* Brand Colors */
  --color-navy: #1a2660;
  --color-dark: #1e1e1e;
  --color-orange: #f38f39;
  --color-orange-deep: #8d4023;
  --color-purple: #692abf;
  --color-purple-light: #c8a4da;
  --color-white: #ffffff;
  --color-off-white: #f5f2ee;

  /* Warm palette */
  --color-cream: #faf7f2;
  --color-sand: #f2ede5;
  --color-warm-gray: #8a7e72;

  /* Surfaces */
  --surface-bg: #faf7f2;
  --surface-card: var(--color-white);
  --surface-card-border: rgba(141, 64, 35, 0.08);
  --surface-input: var(--color-sand);
  --surface-input-border: rgba(141, 64, 35, 0.1);
  --surface-input-focus: var(--color-white);
  --surface-input-focus-border: var(--color-orange);

  /* Text */
  --text-primary: var(--color-dark);
  --text-secondary: var(--color-warm-gray);
  --text-tertiary: #b0a89e;
  --text-accent: #f38f39;
  --text-error: #c0392b;
  --text-success: #27ae60;

  /* Gradients */
  --gradient-orange: linear-gradient(179deg, #f38f39 3.5%, #8d4023 94%);
  --gradient-purple: linear-gradient(179deg, #692abf 3.5%, #c8a4da 94%);
  --gradient-orange-hover: linear-gradient(179deg, #ffa050 3.5%, #a04a28 94%);

  /* Typography */
  --font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-glow-orange: 0 0 40px rgba(243, 143, 57, 0.15);
  --shadow-glow-purple: 0 0 60px rgba(105, 42, 191, 0.12);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-weight: var(--font-weight-regular);
  color: var(--color-dark);
  background: var(--color-cream);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.8;
}

/* --- Portal Layout Shell --- */
.portal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}


/* --- Shared Components --- */

/* Logo / Wordmark */
.portal-logo {
  font-size: 22px;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  letter-spacing: -0.02em;
  user-select: none;
}

.portal-logo .logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  font-weight: var(--font-weight-extrabold);
}

/* Card */
.portal-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
}

/* Form Elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 14px var(--space-md);
  background: var(--surface-input);
  border: 1px solid var(--surface-input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: var(--font-weight-regular);
  outline: none;
  transition: all var(--transition-base);
}

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

.form-input:focus {
  background: var(--surface-input-focus);
  border-color: var(--surface-input-focus-border);
  box-shadow: 0 0 0 3px rgba(243, 143, 57, 0.08);
}

.form-input.input-error {
  border-color: var(--text-error);
  box-shadow: 0 0 0 3px rgba(232, 84, 84, 0.08);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px var(--space-xl);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--gradient-orange);
  color: var(--color-white);
  box-shadow: 0 2px 12px rgba(243, 143, 57, 0.25);
}

.btn-primary:hover {
  background: var(--gradient-orange-hover);
  box-shadow: 0 4px 20px rgba(243, 143, 57, 0.35);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-full {
  width: 100%;
}

/* Loading spinner */
.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Alerts / Messages */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  display: none;
  align-items: flex-start;
  gap: var(--space-sm);
  line-height: 1.4;
}

.alert.visible {
  display: flex;
}

.alert-error {
  background: rgba(232, 84, 84, 0.1);
  border: 1px solid rgba(232, 84, 84, 0.2);
  color: var(--text-error);
}

.alert-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: var(--text-success);
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-tertiary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface-card-border);
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }

/* --- Responsive --- */
@media (max-width: 480px) {
  .portal-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
  }

  .btn {
    padding: 12px var(--space-lg);
    font-size: 14px;
  }

  .form-input {
    padding: 12px 14px;
    font-size: 14px;
  }
}
