/* ============================================
   TerraGrow Demo — Design System Marcassin
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* --- Tokens --- */
:root {
  /* Brand */
  --brand-1000: #051538;
  --brand-300: #367cff;
  --brand-50: #f4f9fb;
  --brand-25: #fbfefc;

  /* Neutral */
  --neutral-50: #ffffff;
  --neutral-300: #e5e5e5;
  --neutral-600: #707872;
  --neutral-800: #525954;
  --neutral-900: #2a2d2a;
  --neutral-950: #1d241d;

  /* Transparency */
  --dark-10: rgba(4, 16, 4, 0.1);

  /* Shadows */
  --shadow-sm: 0px 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0px 20px 25px -5px rgba(0, 0, 0, 0.1), 0px 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-inner: inset 0px 2px 0px rgba(255, 255, 255, 0.15);

  /* Border radius */
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 20px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-9: 36px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- Typography utilities --- */
.heading-md {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.75px;
}

.heading-sm {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.6px;
}

.label-base {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.32px;
}

.label-sm {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.1;
  letter-spacing: -0.14px;
}

.paragraph-base {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: -0.16px;
}

.paragraph-sm {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.1;
  letter-spacing: -0.14px;
}

/* --- Auth pages (index, login, confirm) shared --- */
.auth-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brand-1000);
  padding: var(--space-4);
  overflow: hidden;
}

.auth-card {
  background: var(--neutral-50);
  border: 4px solid var(--brand-50);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 20px var(--space-6);
  width: 100%;
  max-width: 512px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.auth-card__title {
  color: var(--neutral-950);
  margin-bottom: var(--space-4);
}

.auth-card__title .highlight {
  color: var(--brand-300);
}

/* --- Form elements --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group + .form-group {
  margin-top: var(--space-3);
}

.form-label {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.1;
  letter-spacing: -0.14px;
  color: var(--neutral-900);
}

.form-input,
.form-select {
  height: 40px;
  padding: 6px 12px;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: -0.16px;
  color: var(--neutral-900);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-input::placeholder {
  color: var(--neutral-600);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--brand-300);
}

.required {
  color: #dc2626;
}

.form-helper {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.1;
  letter-spacing: -0.14px;
  color: var(--neutral-600);
}

/* Input with icon (email @) */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .form-input {
  padding-left: 36px;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--neutral-600);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity 0.15s;
  width: 100%;
  text-align: center;
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  opacity: 0.8;
}

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

.btn-primary-auth {
  background: var(--brand-1000);
  color: var(--neutral-50);
  border: 1px solid var(--brand-1000);
  box-shadow: var(--shadow-inner);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.32px;
}

.btn-primary-demo {
  background: var(--brand-300);
  color: var(--neutral-50);
  border: 1px solid var(--brand-300);
  box-shadow: var(--shadow-inner);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.32px;
}

.btn-secondary {
  background: var(--brand-50);
  color: var(--brand-1000);
  border: 1px solid var(--dark-10);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 11px 7px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.1;
  letter-spacing: -0.14px;
}

/* --- Auth page specifics --- */
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.auth-logo {
  margin-top: var(--space-4);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.auth-logo img {
  height: 26px;
  width: auto;
}

/* --- Confirm page --- */
.confirm-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff 0%, rgba(54, 124, 255, 0.1) 100%);
  padding: var(--space-6);
  overflow: hidden;
}

.confirm-card {
  border: 1px solid var(--dark-10);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--neutral-50);
  padding: 48px 40px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.confirm-card__spinner {
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

.confirm-card__check {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-4);
}

#confirm-state-pending,
#confirm-state-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

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

.confirm-card__title {
  color: var(--neutral-950);
}

.confirm-card__text {
  color: var(--neutral-600);
  line-height: 1.5;
}

/* --- Demo page --- */
.demo-page {
  height: 100vh;
  background: var(--brand-25);
  padding: var(--space-2);
  overflow: hidden;
}

.demo-container {
  border: 1px solid var(--dark-10);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, rgba(54, 124, 255, 0.1) 100%);
  height: calc(100vh - 16px);
  display: flex;
  overflow: hidden;
}

/* Left panel — video zone */
.demo-left {
  flex: 1;
  padding: 36px 48px 28px 72px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.demo-left__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
  flex-shrink: 0;
}

.demo-left__header-text {
  flex: 1;
}

.demo-left__title {
  color: var(--neutral-950);
  margin-bottom: var(--space-3);
}

.demo-left__title .highlight {
  color: var(--brand-300);
}

.demo-left__description {
  color: var(--neutral-600);
  line-height: 1.5;
}

.demo-left__controls {
  flex-shrink: 0;
}

.demo-select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Custom select */
.custom-select {
  position: relative;
  width: 180px;
}

.custom-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 6px 12px;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: -0.16px;
  color: var(--neutral-900);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.custom-select__trigger:focus,
.custom-select.open .custom-select__trigger {
  border-color: var(--brand-300);
}

.custom-select__icon {
  flex-shrink: 0;
}

.custom-select__dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  list-style: none;
  padding: 4px;
  z-index: 100;
  overflow: hidden;
}

.custom-select.open .custom-select__dropdown {
  display: block;
}

.custom-select__option {
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.14px;
  color: var(--neutral-900);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.custom-select__option:hover {
  background: var(--brand-50);
}

.custom-select__option.selected {
  color: var(--brand-300);
  font-weight: 600;
}

/* Video player */
.demo-video-wrapper {
  flex: 1;
  min-height: 0;
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-xl);
  border: 1px solid var(--neutral-300);
}

/* Logos banner — infinite marquee */
.demo-logos {
  height: 56px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  margin-bottom: var(--space-4);
  mask-image: linear-gradient(90deg, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 10%, black 90%, transparent 100%);
}

.demo-logos__track {
  display: flex;
  align-items: center;
  gap: 48px;
  animation: marquee 30s linear infinite;
  will-change: transform;
}

.demo-logos__track img {
  height: 30px;
  width: auto;
  flex-shrink: 0;
  opacity: 0.6;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Confidentiality */
.demo-confidentiality {
  text-align: center;
  color: var(--neutral-600);
  line-height: 1.4;
  max-width: 700px;
  margin: 0 auto;
  flex-shrink: 0;
  font-size: 12px;
}

/* Right panel — Calendly */
.demo-right {
  width: 529px;
  flex-shrink: 0;
  background: var(--neutral-50);
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-right__calendly {
  flex: 1;
  min-height: 0;
  margin-bottom: var(--space-3);
}

.demo-right__calendly iframe {
  height: 100% !important;
  width: 100% !important;
}

.demo-right__actions {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  flex-shrink: 0;
}

.demo-right__actions .btn-sm {
  height: 36px;
  font-size: 13px;
  flex: 1;
}

/* Logout button (top-left of left panel) */
.btn-logout {
  width: 143px;
  margin-bottom: var(--space-6);
  flex-shrink: 0;
}

/* Toast / feedback */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--brand-1000);
  color: var(--neutral-50);
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
  pointer-events: none;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Error message */
.form-error {
  color: #dc2626;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  margin-top: var(--space-2);
  display: none;
}

.form-error.visible {
  display: block;
}

/* Loading state for buttons */
.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-primary-auth.loading::after {
  border-top-color: var(--neutral-50);
}

.btn-primary-demo.loading::after {
  border-top-color: var(--neutral-50);
}

.btn-secondary.loading::after {
  border-top-color: var(--brand-1000);
}
