/* CFI International — Clean UI + Interactive Layers */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --cfi-bg: #050810;
  --cfi-surface: rgba(10, 14, 24, 0.92);
  --cfi-border: rgba(255, 255, 255, 0.08);
  --cfi-border-hover: rgba(45, 212, 191, 0.35);
  --cfi-teal: #2dd4bf;
  --cfi-indigo: #6366f1;
  --cfi-text: #f8fafc;
  --cfi-muted: #8b95a8;
  --cfi-btn-bg: #0c1018;
  --cfi-btn-bg-hover: #121820;
  --cfi-btn-border: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: var(--cfi-bg);
  color: var(--cfi-text);
  -webkit-font-smoothing: antialiased;
}

.cfi-login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  perspective: 1200px;
}

/* Interactive canvas layers */
.cfi-bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(45, 212, 191, 0.04) 0%, transparent 65%),
              linear-gradient(180deg, #050810 0%, #070b12 100%);
  pointer-events: none;
}

#cfi-three-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#cfi-three-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.cfi-d3-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

.cfi-d3-layer .cfi-node {
  fill: var(--cfi-teal);
  filter: drop-shadow(0 0 6px rgba(45, 212, 191, 0.6));
}

.cfi-d3-layer .cfi-arc {
  fill: none;
  stroke: url(#cfiArcGrad);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.55;
}

.cfi-d3-layer .cfi-arc-glow {
  fill: none;
  stroke: rgba(45, 212, 191, 0.25);
  stroke-width: 3;
  filter: blur(2px);
}

/* Card — GSAP controls entrance & 3D tilt */
.cfi-login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  border-radius: 20px;
  background: var(--cfi-surface);
  border: 1px solid var(--cfi-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  transform-style: preserve-3d;
  will-change: transform;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  visibility: hidden;
}

.cfi-login-card__inner {
  padding: 36px 32px 32px;
  transform: translateZ(30px);
}

.cfi-logo-wrap {
  text-align: center;
  margin-bottom: 24px;
  transform-style: preserve-3d;
}

.cfi-logo-wrap img {
  width: 100%;
  max-width: 200px;
  height: auto;
}

.cfi-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--cfi-border);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cfi-muted);
  margin-bottom: 16px;
}

.cfi-badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cfi-teal);
}

.cfi-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  color: var(--cfi-text);
}

.cfi-subtitle {
  font-size: 0.9rem;
  color: var(--cfi-muted);
  margin: 0 0 28px;
  font-weight: 400;
  line-height: 1.55;
}

.cfi-field {
  margin-bottom: 20px;
}

.cfi-field__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cfi-muted);
  margin-bottom: 8px;
}

.cfi-field__input-wrap {
  position: relative;
}

.cfi-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--cfi-muted);
  pointer-events: none;
}

.cfi-field__input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border-radius: 12px;
  border: 1px solid var(--cfi-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cfi-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  outline: none;
}

.cfi-field__input::placeholder {
  color: rgba(139, 149, 168, 0.55);
}

.cfi-field__input:focus {
  border-color: var(--cfi-border-hover);
  background: rgba(0, 0, 0, 0.5);
}

.cfi-field__input--error {
  border-color: rgba(248, 113, 113, 0.55) !important;
  background: rgba(248, 113, 113, 0.06) !important;
}

.cfi-field__error {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #f87171;
}

.cfi-field__error[hidden] {
  display: none;
}

.cfi-field:focus-within .cfi-field__icon {
  color: var(--cfi-teal);
}

.cfi-field__glow { display: none; }

.cfi-btn-signin {
  position: relative;
  width: 100%;
  padding: 14px 24px;
  margin-top: 4px;
  border-radius: 12px;
  border: 1px solid var(--cfi-btn-border);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cfi-text);
  cursor: pointer;
  background: var(--cfi-btn-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.cfi-btn-signin__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cfi-btn-signin__arrow {
  color: var(--cfi-teal);
}

.cfi-btn-signin--loading {
  pointer-events: none;
  opacity: 0.85;
}

.cfi-btn-signin--loading .cfi-btn-signin__arrow {
  display: none;
}

.cfi-btn-signin__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--cfi-teal);
  border-radius: 50%;
  animation: cfiSpin 0.7s linear infinite;
}

.cfi-btn-signin--loading .cfi-btn-signin__spinner {
  display: inline-block;
}

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

.cfi-btn-signin__ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(45, 212, 191, 0.25);
  transform: scale(0);
  pointer-events: none;
}

.cfi-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--cfi-border);
}

.cfi-footer__text {
  font-size: 11px;
  color: var(--cfi-muted);
  letter-spacing: 0.02em;
  margin: 0;
}

.cfi-footer__brand {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
}

.cfi-login-page #preloader { display: none !important; }

.cfi-anim-item {
  opacity: 0;
  transform: translateY(16px);
}

@media (max-width: 480px) {
  .cfi-login-card__inner {
    padding: 28px 22px 24px;
  }

  .cfi-title {
    font-size: 1.35rem;
  }

  .cfi-d3-layer {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cfi-d3-layer,
  #cfi-three-canvas {
    display: none;
  }

  .cfi-toast {
    animation: none !important;
  }
}

/* Toast notifications — single unified system */
.cfi-toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.cfi-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 14px;
  background: rgba(10, 14, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.cfi-toast--visible {
  opacity: 1;
  transform: translateX(0);
}

.cfi-toast--exit {
  opacity: 0;
  transform: translateX(24px);
}

.cfi-toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.cfi-toast__icon svg {
  width: 20px;
  height: 20px;
}

.cfi-toast--success .cfi-toast__icon { color: #2dd4bf; }
.cfi-toast--error .cfi-toast__icon { color: #f87171; }
.cfi-toast--warning .cfi-toast__icon { color: #fbbf24; }
.cfi-toast--info .cfi-toast__icon { color: #6366f1; }

.cfi-toast--success { border-left: 3px solid #2dd4bf; }
.cfi-toast--error { border-left: 3px solid #f87171; }
.cfi-toast--warning { border-left: 3px solid #fbbf24; }
.cfi-toast--info { border-left: 3px solid #6366f1; }

.cfi-toast__body {
  flex: 1;
  min-width: 0;
}

.cfi-toast__title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 2px;
}

.cfi-toast__msg {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: #8b95a8;
}

.cfi-toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #8b95a8;
  font-size: 18px;
  line-height: 1;
  padding: 0 0 0 4px;
  cursor: pointer;
  transition: color 0.15s;
}

.cfi-toast__close:hover {
  color: #f8fafc;
}

@media (max-width: 480px) {
  .cfi-toast-root {
    top: auto;
    bottom: 20px;
    left: 16px;
    right: 16px;
    width: auto;
  }
}
