/*
  DropX Login — modern, lightweight UI
  Stack: plain HTML + CSS + JS (no build step)
*/

:root {
  --bg-900: #0b1422;
  --bg-800: #131d2c;
  --bg-700: #1a2535;

  --card: #111a27;
  --muted: #a9b4c6;
  --text: #d7ffe9; /* greenish text */
  --field: #162235;
  --field-border: rgba(255,255,255,0.06);
  --field-border-focus: rgba(16, 185, 129, 0.45);
  --shadow: rgba(2, 6, 23, 0.6);

  --teal-1: #0ea5a3; /* primary accent */
  --teal-2: #10b981; /* emerald blend */
  --teal-3: #0f766e; /* darker */
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
  color: var(--text);
  background: radial-gradient(1200px 600px at 70% 0%, rgba(30,58,138,0.25), transparent 60%),
              radial-gradient(1200px 600px at 30% 0%, rgba(16,185,129,0.12), transparent 60%),
              var(--bg-900);
}

.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* Background waves */
.waves { position: absolute; inset: 0; pointer-events: none; }
.wave { position: absolute; bottom: -2px; width: 140%; left: -20%; height: 40vh; will-change: transform; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.wave path { fill: var(--bg-700); opacity: .45; }
.wave-1 path { fill: #1b2639; opacity: .45; }
.wave-2 { --y: 10px; }
.wave-2 path { fill: #202b3f; opacity: .35; }
.wave-3 { --y: 28px; }
.wave-3 path { fill: #263246; opacity: .3; }

/* Card */
.card {
  position: relative;
  width: 420px;
  max-width: calc(100% - 32px);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0) 30%), var(--card);
  border-radius: 22px;
  padding: 28px 28px 34px;
  box-shadow:
    0 18px 40px -8px var(--shadow),
    0 2px 10px rgba(0,0,0,.35),
    inset 0 0 0 1px var(--field-border);
  backdrop-filter: saturate(120%);
}

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.title {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.2px;
  margin: 0;
  color: var(--text);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1), rgba(255,255,255,0) 60%),
              linear-gradient(145deg, rgba(16,185,129,0.25), rgba(14,165,160,0.25));
  color: #c2d2df;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(14,165,160,0.25) inset, 0 6px 20px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.icon-button:hover { filter: brightness(1.1); }
.icon-button:active { transform: translateY(1px) scale(.98); }
.icon-button svg { width: 18px; height: 18px; shape-rendering: geometricPrecision; vector-effect: non-scaling-stroke; }

/* Controls popover */
.controls {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 280px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0)), var(--card);
  border-radius: 16px;
  box-shadow: 0 22px 50px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,0.06);
  padding: 10px 10px 12px;
  color: var(--text);
  z-index: 10;
}
.controls[hidden] { display: none; }
.controls-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.controls-header h2 { margin: 0; font-size: 14px; font-weight: 700; color: #d9e3ee; letter-spacing: .2px; }
.controls-close { border: 0; background: transparent; color: #b9c6d6; font-size: 18px; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }
.controls-close:hover { background: rgba(255,255,255,0.06); }
.controls-body { display: grid; gap: 10px; }
.ctrl { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 4px 6px; }
.ctrl label { font-size: 12px; color: #a9b4c6; }
.ctrl input[type="range"] { grid-column: 1 / -1; appearance: none; height: 4px; border-radius: 999px; background: #283348; outline: none; }
.ctrl input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--teal-1), var(--teal-2)); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.ctrl output { font-size: 12px; color: #c5d2e1; justify-self: end; }
.ctrl-row { display: flex; gap: 10px; padding: 2px 6px; flex-wrap: wrap; }
.btn-mini { border: 0; border-radius: 12px; padding: 6px 10px; background: linear-gradient(135deg, var(--teal-1), var(--teal-2)); color: white; cursor: pointer; font-weight: 600; font-size: 12px; }
.btn-mini:hover { filter: brightness(1.05); }

/* Switch (styled checkbox) */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #c5d2e1; cursor: pointer; }
.switch input { appearance: none; width: 34px; height: 18px; background: #313c52; border-radius: 999px; position: relative; outline: none; transition: background .2s ease; }
.switch input::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #a9b4c6; transition: transform .2s ease, background .2s ease; }
.switch input:checked { background: linear-gradient(135deg, var(--teal-1), var(--teal-2)); }
.switch input:checked::after { transform: translateX(16px); background: white; }

/* Form */
.form { display: grid; gap: 14px; }

.field {
  position: relative;
  display: grid;
  align-items: center;
  grid-template-columns: 42px 1fr 42px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0)) , var(--field);
  border-radius: 999px;
  height: 48px;
  padding: 0 8px 0 0;
  box-shadow: inset 0 0 0 1px var(--field-border);
}
.field:focus-within {
  box-shadow: inset 0 0 0 1px var(--field-border),
              0 0 0 3px var(--field-border-focus);
}

.field-icon { display: grid; place-items: center; color: #a9b4c6; }
.field-icon svg { width: 18px; height: 18px; opacity: .9; shape-rendering: geometricPrecision; vector-effect: non-scaling-stroke; }

.field input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 0 8px;
  font-size: 15px;
}
.field input::placeholder { color: #c8d0dc; opacity: .85; }

.reveal {
  display: grid; place-items: center;
  width: 36px; height: 36px; margin-left: auto;
  border-radius: 50%; border: 0; background: transparent; color: #b9c6d6;
  cursor: pointer; transition: opacity .15s ease, transform .1s ease;
}
.reveal:hover { opacity: .95; }
.reveal:active { transform: translateY(1px) scale(.98); }
.reveal .eye-off { display: none; }
.reveal.is-on .eye { display: none; }
.reveal.is-on .eye-off { display: block; }
.reveal svg { width: 18px; height: 18px; shape-rendering: geometricPrecision; vector-effect: non-scaling-stroke; }

.submit {
  appearance: none; -webkit-appearance: none;
  height: 52px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 600; letter-spacing: .2px; color: #eafff7;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
              linear-gradient(135deg, var(--teal-1), var(--teal-2));
  box-shadow:
    inset 0 -2px 0 rgba(0,0,0,.15),
    0 8px 25px rgba(16, 185, 129, .25),
    0 0 0 1px rgba(14, 165, 160, .35) inset;
  transition: transform .1s ease, filter .15s ease, box-shadow .2s ease;
  position: relative; overflow: hidden;
}
.submit:hover { filter: brightness(1.06); box-shadow: inset 0 -2px 0 rgba(0,0,0,.15), 0 10px 28px rgba(16,185,129,.28), 0 0 0 1px rgba(14, 165, 160, .45) inset; }
.submit:active { transform: translateY(1px) scale(.995); }

/* Ripple effect */
.ripple {
  position: absolute; border-radius: 999px; pointer-events: none; inset: 0;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px; background: radial-gradient(circle, rgba(255,255,255,.65) 0%, rgba(255,255,255,0) 70%);
  opacity: .7; animation: ripple .6s ease-out forwards;
}
@keyframes ripple {
  to { opacity: 0; width: 260px; height: 260px; }
}

.status {
  min-height: 20px; font-size: 13px; color: #a9b4c6; padding: 2px 8px 6px; text-align: center;
}
.status.error { color: #f7b3b3; }
.status.success { color: #b5f3d3; }

/* Subtle text rise animation */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.title, .field, .submit { animation: rise .28s cubic-bezier(.22,.61,.36,1) both; }

/* Toasts (login page) */
.toast-stack { position: fixed; right: 14px; top: 12px; display: grid; gap: 10px; z-index: 70; }
.toast { background: #111a27; color: var(--text); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 18px 40px rgba(0,0,0,.45); border-radius: 12px; padding: 10px 14px; min-width: 200px; max-width: 360px; display: flex; align-items: center; gap: 10px; animation: toast-in .3s ease both; }
.toast.ok { border-color: rgba(16,185,129,.4); box-shadow: 0 18px 40px rgba(16,185,129,.15); }
.toast.err { border-color: rgba(239,68,68,.35); }
.toast .msg { flex: 1; }
.toast .close { border: 0; background: transparent; color: #c8d0dc; font-size: 18px; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .wave { transform: translate3d(0, var(--y, 0), 0) !important; }
}

/* Small screens */
@media (max-width: 420px) {
  .card { padding: 22px 18px 26px; border-radius: 18px; }
  .title { font-size: 24px; }
  .field { height: 46px; }
  .submit { height: 50px; }
}
