/* ============================================================================
   KRIOLIS Multi-AI CRM System — premium auth experience v2
   Branded entry pages (login / register / reset): 3D floating wordmark, live
   motion, mouse parallax. Loaded only on auth pages.
   ========================================================================== */

:root {
  --k-green:       #0a6b3b;
  --k-green-2:     #0e7d46;
  --k-green-deep:  #063f26;
  --k-green-night: #052b1a;
  --k-mint:        #e8f3ec;
  --k-ink:         #14241c;
  --k-ink-soft:    #4b5c52;
  --k-line:        #d8e4dc;
  --k-paper:       #f6faf7;
  --k-white:       #ffffff;
  --auth-radius:   18px;
  --auth-shadow:   0 24px 60px -28px rgba(6, 63, 38, .45);
  --auth-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body.auth-page { height: 100%; }

body.auth-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--auth-font);
  color: var(--k-ink);
  background: radial-gradient(1200px 800px at 85% -10%, var(--k-mint) 0%, var(--k-paper) 55%, #eef5f0 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---- animated aurora (livelier drifting green glow) ----------------------- */
.auth-aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.auth-aurora span { position: absolute; display: block; border-radius: 50%; filter: blur(58px); will-change: transform; }
.auth-aurora span:nth-child(1){ width:48vw;height:48vw;left:-8vw;top:-12vw; background:radial-gradient(circle at 30% 30%, #1fb56b, transparent 60%); opacity:.6; animation:drift1 18s ease-in-out infinite; }
.auth-aurora span:nth-child(2){ width:40vw;height:40vw;right:-8vw;top:24vh; background:radial-gradient(circle at 60% 40%, #0a6b3b, transparent 62%); opacity:.45; animation:drift2 24s ease-in-out infinite; }
.auth-aurora span:nth-child(3){ width:32vw;height:32vw;left:30vw;bottom:-16vw; background:radial-gradient(circle at 50% 50%, #7ce0aa, transparent 60%); opacity:.4; animation:drift3 21s ease-in-out infinite; }
@keyframes drift1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(7vw,5vh) scale(1.12)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-6vw,-4vh) scale(1.16)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(4vw,-6vh) scale(1.1)} }

/* ============================================================================
   SPLIT LAYOUT (login)
   ========================================================================== */
.auth-split {
  position: relative; z-index: 1; flex: 1 1 auto;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding: clamp(16px, 3vw, 40px); align-items: stretch;
}

/* ---- HERO ------------------------------------------------------------------ */
.auth-hero {
  position: relative; overflow: hidden;
  border-radius: var(--auth-radius);
  padding: clamp(28px, 4vw, 52px);
  color: #eaf6ee;
  background:
    radial-gradient(900px 500px at 18% 8%, rgba(40,180,105,.45), transparent 55%),
    radial-gradient(700px 600px at 95% 100%, rgba(13,125,70,.55), transparent 60%),
    linear-gradient(160deg, var(--k-green-deep) 0%, var(--k-green-night) 100%);
  box-shadow: var(--auth-shadow);
  display: flex; flex-direction: column; gap: 18px; isolation: isolate;
}
/* faint tech grid */
.auth-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(120% 100% at 20% 0%, #000 30%, transparent 78%);
  z-index: -2;
}
/* breathing inner glow */
.auth-hero::after {
  content: ""; position: absolute; width: 70%; height: 60%; right: -10%; bottom: -18%;
  background: radial-gradient(circle, rgba(124,224,170,.32), transparent 60%);
  filter: blur(42px); z-index: -2; animation: heroGlow 8s ease-in-out infinite;
}
@keyframes heroGlow { 0%,100%{opacity:.5;transform:scale(1)} 50%{opacity:.9;transform:scale(1.14)} }

/* diagonal light sheen sweeping across the hero */
.hero-sheen {
  position: absolute; inset: -40% -10%; z-index: -1; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.10) 48%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.10) 52%, transparent 62%);
  transform: translateX(-30%); animation: sheen 8.5s ease-in-out infinite;
}
@keyframes sheen { 0%,100%{transform:translateX(-35%)} 50%{transform:translateX(35%)} }

/* floating particles */
.hero-particles { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-particles i {
  position: absolute; display: block; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle, #aef3cd, rgba(174,243,205,0) 70%);
  opacity: .7; animation: floatUp linear infinite;
}
.hero-particles i:nth-child(1){ left:12%; bottom:-10px; animation-duration:14s; animation-delay:0s; }
.hero-particles i:nth-child(2){ left:28%; bottom:-10px; width:5px;height:5px; animation-duration:18s; animation-delay:2s; }
.hero-particles i:nth-child(3){ left:46%; bottom:-10px; animation-duration:16s; animation-delay:5s; }
.hero-particles i:nth-child(4){ left:64%; bottom:-10px; width:4px;height:4px; animation-duration:20s; animation-delay:1s; }
.hero-particles i:nth-child(5){ left:80%; bottom:-10px; animation-duration:15s; animation-delay:7s; }
.hero-particles i:nth-child(6){ left:90%; bottom:-10px; width:6px;height:6px; animation-duration:22s; animation-delay:3s; }
@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: .7; }
  90%  { opacity: .5; }
  100% { transform: translateY(-95vh) translateX(20px); opacity: 0; }
}

/* ---- 3D FLOATING KRIOLIS WORDMARK (no white box) -------------------------- */
.kx-logo {
  perspective: 720px;
  display: inline-block;
  transform: rotateX(calc(var(--py, 0) * -9deg)) rotateY(calc(var(--px, 0) * 14deg));
  transition: transform .25s ease;
  transform-style: preserve-3d;
  margin-bottom: 2px;
}
.kx-word {
  display: inline-flex;
  font-weight: 900;
  font-size: clamp(40px, 6vw, 68px);
  letter-spacing: .015em;
  line-height: 1;
  color: #f1fff8;
  transform-style: preserve-3d;
  text-shadow:
    0 1px 0 #aef3cd,           /* top highlight */
    0 -1px 0 #0c8a4e,
    0 2px 0 #0a7d46, 0 3px 0 #097040, 0 4px 0 #086539,
    0 5px 0 #075a33, 0 6px 0 #064f2d, 0 7px 0 #05421f,
    0 8px 2px rgba(0,0,0,.18),
    0 10px 14px rgba(0,0,0,.30), 0 18px 28px rgba(0,0,0,.32);
  animation: kxFloat 5.6s ease-in-out infinite;
}
.kx-word span {
  display: inline-block;
  transform-origin: 50% 100%;
  animation: kxLetterIn .8s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i) * .075s);
}
@keyframes kxFloat {
  0%,100% { transform: rotate(0deg) translateY(0); }
  50%     { transform: rotate(0deg) translateY(-9px); }
}
@keyframes kxLetterIn {
  0%   { opacity: 0; transform: translateY(-22px) rotateX(55deg); }
  100% { opacity: 1; transform: translateY(0) rotateX(0); }
}
.kx-tag {
  margin-top: 12px;
  font-size: 11px; letter-spacing: .30em; text-transform: uppercase;
  color: #bfe9cf; opacity: .85;
  animation: fadeUp .7s .5s both;
}

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: #bfe9cf; animation: fadeUp .7s .14s both;
}
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: #6fd3a0; animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(111,211,160,.6)} 70%{box-shadow:0 0 0 11px rgba(111,211,160,0)} 100%{box-shadow:0 0 0 0 rgba(111,211,160,0)} }

.hero-title {
  margin: 2px 0 0; font-size: clamp(28px, 3.6vw, 44px); line-height: 1.06;
  font-weight: 800; letter-spacing: -.01em; color: #ffffff;
  animation: fadeUp .7s .2s both;
}
.hero-title .accent {
  background: linear-gradient(90deg, #c4ffdd, #6fe3a6);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub {
  margin: 0; max-width: 46ch; font-size: clamp(14px, 1.3vw, 16px); line-height: 1.6;
  color: #d3ecdd; animation: fadeUp .7s .28s both;
}

.hero-manuals { margin-top: 2px; animation: fadeUp .7s .36s both; }
.hero-manuals .hm-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #bfe9cf; margin-bottom: 10px; }
.hm-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.hm-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 11px;
  font-size: 13px; font-weight: 600; text-decoration: none; color: #eaf6ee;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(6px);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.hm-btn .flag { font-size: 10px; font-weight: 800; letter-spacing: .03em; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); padding: 2px 5px; border-radius: 5px; line-height: 1; }
.hm-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); border-color: rgba(159,240,194,.55); box-shadow: 0 12px 24px -14px rgba(0,0,0,.6); }

.hero-badges {
  margin-top: auto; display: flex; flex-wrap: wrap; gap: 16px;
  padding-top: 18px; border-top: 1px solid rgba(255,255,255,.10);
  animation: fadeUp .7s .44s both;
}
.hero-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #cfe8d8; }
.hero-badge svg { width: 16px; height: 16px; opacity: .85; }

.auth-panel { display: grid; place-items: center; padding: clamp(16px, 3vw, 40px); }

/* ============================================================================
   CENTERED WRAP (register / reset)
   ========================================================================== */
.auth-wrap {
  position: relative; z-index: 1; flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(24px, 5vw, 56px) 20px;
}
.auth-mini-brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; margin-bottom: 22px; animation: fadeUp .6s .05s both; }
.auth-mini-brand .kx-mini {
  font-weight: 900; font-size: 30px; letter-spacing: .01em; color: var(--k-green-deep);
  transform: rotate(0deg); display: inline-block;
  text-shadow: 0 1px 0 #cdeede, 0 2px 0 #b6dcc4, 0 3px 6px rgba(6,63,38,.25);
}
.auth-mini-brand small { color: var(--k-green-2); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; }

/* ============================================================================
   CARD
   ========================================================================== */
.auth-card {
  position: relative; width: 100%; max-width: 400px;
  padding: clamp(26px, 3vw, 38px); border-radius: var(--auth-radius);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255,255,255,.7);
  animation: cardIn .65s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes cardIn { from{opacity:0; transform:translateY(16px) scale(.985)} to{opacity:1; transform:none} }
.auth-card::before {
  content: ""; position: absolute; left: 26px; right: 26px; top: 0; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--k-green-2), transparent); opacity: .85;
}
.auth-card h1 { margin: 4px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.01em; color: var(--k-ink); }
.auth-card .card-kicker { margin: 0 0 18px; font-size: 12.5px; color: var(--k-ink-soft); }

.auth-form { display: flex; flex-direction: column; gap: 15px; margin-top: 6px; }
.auth-form label { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--k-ink-soft); }
.auth-form input {
  font: inherit; padding: 12px 14px; border-radius: 11px;
  border: 1.5px solid var(--k-line); background: rgba(255,255,255,.9); color: var(--k-ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; outline: none;
}
.auth-form input::placeholder { color: #9babA1; }
.auth-form input:hover { border-color: #bcd3c5; }
.auth-form input:focus { border-color: var(--k-green-2); background: #fff; box-shadow: 0 0 0 4px rgba(14,125,70,.14); }

.auth-form button[type="submit"] {
  position: relative; overflow: hidden; margin-top: 6px; padding: 13px 18px;
  font: inherit; font-weight: 700; font-size: 15px; color: #fff; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--k-green-2), var(--k-green) 55%, var(--k-green-deep));
  box-shadow: 0 14px 28px -12px rgba(10,107,59,.7);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.auth-form button[type="submit"]:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(10,107,59,.75); filter: brightness(1.05); }
.auth-form button[type="submit"]:active { transform: translateY(0); }
.auth-form button[type="submit"]::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); transition: left .6s ease;
}
.auth-form button[type="submit"]:hover::after { left: 130%; }

.auth-help { margin: 16px 0 0; }
.auth-help small { color: var(--k-ink-soft); line-height: 1.7; font-size: 12.5px; }
.auth-help a { color: var(--k-green-2); font-weight: 600; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s ease; }
.auth-help a:hover { border-bottom-color: var(--k-green-2); }
.auth-card code { background: var(--k-mint); color: var(--k-green-deep); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.auth-card .error { margin: 0 0 14px; padding: 10px 13px; border-radius: 10px; font-size: 13px; color: #8a1f1f; background: #fdecec; border: 1px solid #f6c9c9; animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

@keyframes fadeUp { from{opacity:0; transform:translateY(12px)} to{opacity:1; transform:none} }

/* ============================================================================
   FOOTER
   ========================================================================== */
.auth-foot { position: relative; z-index: 1; flex: none; text-align: center; padding: 16px 20px 22px; font-size: 12px; color: var(--k-ink-soft); }
.auth-foot .sep { opacity: .4; margin: 0 8px; }

/* ============================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 920px) {
  .auth-split { grid-template-columns: 1fr; gap: 18px; max-width: 560px; }
  .auth-hero { padding: 26px; gap: 14px; }
  .kx-word { font-size: clamp(38px, 12vw, 56px); }
  .auth-panel { padding: 0; }
}
@media (max-width: 480px) {
  .auth-hero { border-radius: 14px; }
  .auth-card { backdrop-filter: blur(10px); }
}

/* ============================================================================
   REDUCED MOTION + DARK
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .auth-aurora span, .auth-hero::after, .hero-sheen, .hero-particles i,
  .kx-word, .kx-word span, .hero-brand, .hero-eyebrow, .hero-eyebrow .dot,
  .hero-title, .hero-sub, .hero-manuals, .hero-badges, .kx-tag, .auth-card {
    animation: none !important;
  }
  .kx-logo { transition: none; }
  .kx-word { transform: rotate(0deg); }
  .auth-form button[type="submit"]::after { transition: none; }
}
@media (prefers-color-scheme: dark) {
  body.auth-page { background: radial-gradient(1200px 800px at 85% -10%, #0c2a1d 0%, #08160f 60%, #060f0a 100%); color: #e7f1eb; }
  .auth-card { background: rgba(18,32,25,.82); border-color: rgba(255,255,255,.08); box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255,255,255,.06); }
  .auth-card h1 { color: #eaf6ee; }
  .auth-card .card-kicker, .auth-help small, .auth-form label { color: #a9c2b4; }
  .auth-form input { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); color: #eaf6ee; }
  .auth-form input:focus { background: rgba(255,255,255,.06); }
  .auth-foot { color: #8fa89a; }
  .auth-mini-brand .kx-mini { color: #eafff4; text-shadow: 0 1px 0 #0c8a4e, 0 2px 0 #075a33, 0 3px 6px rgba(0,0,0,.4); }
}
