/* =========================================================
   Greatness Panel — Login UI (2026 refresh)
   - Premium glass + gradient border
   - Responsive split layout
   - Accessible focus, reduced-motion support
   - Dynamic theme colors extracted from your logo (JS)
   ========================================================= */

:root{
  --bg0:#07070a;
  --bg1:#0b0c12;

  --surface:rgba(255,255,255,0.06);
  --surface2:rgba(255,255,255,0.09);
  --surface-solid:#0f1118;

  --stroke:rgba(255,255,255,0.10);
  --stroke2:rgba(255,255,255,0.18);

  --text:rgba(255,255,255,0.92);
  --muted:rgba(255,255,255,0.62);
  --muted2:rgba(255,255,255,0.42);

  /* Fallback brand colors (will be replaced at runtime by logo sampling) */
  --brand:#b01020;
  --brand2:#ff3b6a;
  --brandGlow:rgba(176,16,32,0.35);
  --brandRing:rgba(176,16,32,0.25);

  --shadow:0 24px 90px rgba(0,0,0,0.55);

  --radius-xl:28px;
  --radius-lg:18px;
  --radius-md:14px;

  --font-sans:"Manrope", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-serif:"Sora", ui-sans-serif, system-ui, sans-serif;

  --pointer-x:65%;
  --pointer-y:30%;
}

:root[data-theme="light"]{
  --bg0:#f6f7fb;
  --bg1:#ffffff;

  --surface:rgba(0,0,0,0.04);
  --surface2:rgba(0,0,0,0.06);
  --surface-solid:#ffffff;

  --stroke:rgba(0,0,0,0.10);
  --stroke2:rgba(0,0,0,0.16);

  --text:rgba(0,0,0,0.88);
  --muted:rgba(0,0,0,0.60);
  --muted2:rgba(0,0,0,0.42);

  --shadow:0 20px 70px rgba(14,18,28,0.18);
  --brandGlow:rgba(176,16,32,0.18);
  --brandRing:rgba(176,16,32,0.18);
}

/* Progressive enhancement for modern color mixing */
@supports (color: color-mix(in srgb, red, white)){
  :root{
    --brand2: color-mix(in srgb, var(--brand) 55%, #ff4d7d 45%);
    --brandGlow: color-mix(in srgb, var(--brand) 38%, transparent);
    --brandRing: color-mix(in srgb, var(--brand) 30%, transparent);
  }
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font-sans);
  color:var(--text);
  background:linear-gradient(180deg,var(--bg0),var(--bg1));
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

/* Background stage */
.bg{
  position:fixed;
  inset:0;
  z-index:0;
  pointer-events:none;
  overflow:hidden;
}
.bg::before{
  content:"";
  position:absolute;
  inset:-40%;
  background:
    radial-gradient(900px circle at var(--pointer-x) var(--pointer-y), var(--brandGlow), transparent 62%),
    radial-gradient(700px circle at 18% 78%, rgba(255,255,255,0.06), transparent 55%),
    radial-gradient(600px circle at 88% 24%, rgba(255,255,255,0.05), transparent 55%);
  filter:blur(10px);
  transform:translate3d(0,0,0);
  opacity:0.95;
}
.bg::after{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size:62px 62px;
  opacity:0.06;
  mask-image:radial-gradient(ellipse at 50% 38%, rgba(0,0,0,0.85), transparent 70%);
}

/* Subtle animated “orbit” accents */
.orbit{
  position:absolute;
  inset:0;
  filter:blur(28px);
  opacity:0.75;
}
.orbit .orb{
  position:absolute;
  width:520px;
  height:520px;
  border-radius:999px;
  background:conic-gradient(from 180deg, transparent, var(--brandGlow), transparent);
  left:-120px;
  top:-140px;
  animation:orbFloat 14s ease-in-out infinite;
}
.orbit .orb:nth-child(2){
  width:460px;
  height:460px;
  left:auto;
  right:-180px;
  top:auto;
  bottom:-160px;
  animation-duration:18s;
  animation-direction:reverse;
  opacity:0.6;
}
@keyframes orbFloat{
  0%{transform:translate3d(0,0,0) rotate(0deg) scale(1)}
  50%{transform:translate3d(30px,18px,0) rotate(20deg) scale(1.03)}
  100%{transform:translate3d(0,0,0) rotate(0deg) scale(1)}
}

/* Layout */
.shell{
  position:relative;
  z-index:1;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:28px 18px;
}

.layout{
  width:min(1120px, 100%);
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap:28px;
  align-items:center;
}

/* Hero */
.hero{
  padding:28px 18px;
}
.hero__brand{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:18px;
}
.hero__logo{
  width:52px;
  height:52px;
  object-fit:contain;
  filter: drop-shadow(0 10px 30px var(--brandGlow));
}
.hero__name{
  font-family:var(--font-serif);
  letter-spacing:0.22em;
  text-transform:uppercase;
  font-size:14px;
  line-height:1.2;
}
.hero__headline{
  font-family:var(--font-serif);
  font-size:clamp(32px, 4vw, 54px);
  line-height:1.06;
  margin:8px 0 14px;
  letter-spacing:0.02em;
}
.hero__headline strong{
  color:var(--text);
  position:relative;
}
.hero__headline strong::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-10px;
  height:2px;
  background:linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity:0.85;
}
.hero__sub{
  max-width:54ch;
  color:var(--muted);
  font-size:16px;
  line-height:1.6;
  margin:0 0 22px;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:18px 0 10px;
}
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:999px;
  background:var(--surface);
  border:1px solid var(--stroke);
  color:var(--muted);
  font-size:13px;
  line-height:1;
}
.chip svg{width:16px;height:16px;opacity:0.9}

.hero__meta{
  margin-top:18px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  color:var(--muted2);
  font-size:12px;
}
.hero__meta span{
  padding:8px 10px;
  border:1px dashed var(--stroke);
  border-radius:999px;
}

/* Card */
.card{
  position:relative;
  border-radius:var(--radius-xl);
  padding:30px 28px 24px;
  box-shadow:var(--shadow);
  border:1px solid transparent;

  background:
    linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box,
    linear-gradient(135deg, rgba(255,255,255,0.10), var(--brandGlow), rgba(255,255,255,0.06)) border-box;
}
@supports (backdrop-filter: blur(14px)){
  .card{
    background:
      linear-gradient(rgba(255,255,255,0.03), rgba(255,255,255,0.02)) padding-box,
      linear-gradient(135deg, rgba(255,255,255,0.12), var(--brandGlow), rgba(255,255,255,0.06)) border-box;
    backdrop-filter: blur(16px);
  }
}

.card__top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}
.card__title{
  margin:0;
  font-family:var(--font-serif);
  letter-spacing:0.06em;
  font-size:22px;
}
.card__sub{
  margin:8px 0 0;
  color:var(--muted);
  font-size:13px;
  line-height:1.6;
}

/* Theme toggle */
.theme-toggle{
  flex:0 0 auto;
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:var(--surface);
  color:var(--text);
  display:grid;
  place-items:center;
  cursor:pointer;
  transition:transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover{transform:translateY(-1px); background:var(--surface2); border-color:var(--stroke2)}
.theme-toggle:active{transform:translateY(0)}
.theme-toggle svg{width:18px;height:18px}

/* Form */
.form{
  margin-top:18px;
}
.field{
  margin-bottom:14px;
}
.label{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:8px;
  gap:10px;
}
.label label{
  font-size:11px;
  letter-spacing:0.18em;
  text-transform:uppercase;
  color:var(--muted);
}
.hint{
  font-size:12px;
  color:var(--muted2);
  margin-top:8px;
  line-height:1.4;
}
.error{
  font-size:12px;
  color:rgba(255,120,120,0.95);
  margin-top:8px;
  line-height:1.4;
  display:none;
}

.control{
  position:relative;
}
.control input{
  width:100%;
  appearance:none;
  -webkit-appearance:none;
  font-family:var(--font-sans);
  font-size:14px;
  color:var(--text);

  background:var(--surface);
  border:1px solid var(--stroke);
  border-radius:var(--radius-md);
  padding:14px 44px 14px 44px;

  outline:none;
  transition:border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
:root[data-theme="light"] .control input{
  background:rgba(255,255,255,0.70);
}
.control input::placeholder{color:var(--muted2)}
.control .icon{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  width:18px;
  height:18px;
  opacity:0.75;
}
.control .action{
  position:absolute;
  right:8px;
  top:50%;
  transform:translateY(-50%);
  border:none;
  background:transparent;
  color:var(--muted);
  width:34px;
  height:34px;
  border-radius:10px;
  cursor:pointer;
  display:grid;
  place-items:center;
  transition:background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.control .action:hover{background:var(--surface2); color:var(--text)}
.control .action:active{transform:translateY(-50%) scale(0.96)}
.control .action svg{width:18px;height:18px}

/* Focus ring */
.control input:focus-visible{
  border-color: var(--brand);
  box-shadow:0 0 0 4px var(--brandRing);
  background:var(--surface2);
}

/* Field states */
.field[data-state="error"] .error{display:block}
.field[data-state="error"] .control input{
  border-color: rgba(255,120,120,0.85);
  box-shadow:0 0 0 4px rgba(255,120,120,0.18);
}
.field[data-state="ok"] .control input{
  border-color: rgba(120,255,170,0.55);
}

/* Inline row under license field */
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:10px;
  flex-wrap:wrap;
}
.check{
  display:inline-flex;
  gap:10px;
  align-items:center;
  user-select:none;
  color:var(--muted);
  font-size:13px;
}
.check input{
  width:16px;
  height:16px;
  accent-color: var(--brand);
}
.link{
  color:var(--text);
  text-decoration:none;
  font-size:13px;
  opacity:0.85;
  transition:opacity 0.2s ease;
}
.link:hover{opacity:1}

/* Buttons */
.btn{
  width:100%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin-top:14px;
  padding:14px 16px;
  border-radius:var(--radius-md);
  border:1px solid transparent;
  cursor:pointer;
  user-select:none;

  font-family:var(--font-serif);
  text-transform:uppercase;
  letter-spacing:0.18em;
  font-weight:700;
  font-size:12px;

  color:white;
  background:linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow:0 18px 40px var(--brandGlow);
  position:relative;
  overflow:hidden;
  transition:transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn::before{
  content:"";
  position:absolute;
  inset:-1px;
  background:linear-gradient(135deg, rgba(255,255,255,0.15), transparent 50%);
  opacity:0.75;
  pointer-events:none;
}
.btn:hover{transform:translateY(-1px); filter:saturate(1.05)}
.btn:active{transform:translateY(0)}
.btn:disabled{
  opacity:0.65;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}

.btn--secondary{
  margin-top:10px;
  background:transparent;
  color:var(--text);
  border-color:var(--stroke);
  box-shadow:none;
}
.btn--secondary::before{display:none}
.btn--secondary:hover{background:var(--surface); transform:translateY(-1px)}
.btn--secondary:active{transform:translateY(0)}

.btn--link{
  text-decoration:none;
}

.btn__spinner{
  width:16px;
  height:16px;
  border-radius:999px;
  border:2px solid rgba(255,255,255,0.35);
  border-top-color: rgba(255,255,255,0.95);
  display:none;
  animation:spin 0.9s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.btn[data-loading="true"] .btn__spinner{display:inline-block}
.btn[data-loading="true"] .btn__text{opacity:0.9}

.inline-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.server-alert{
  border-radius:12px;
  border:1px solid var(--stroke);
  padding:10px 12px;
  margin:10px 0 14px;
  font-size:13px;
  line-height:1.5;
}
.server-alert a{
  color:var(--text);
  font-weight:600;
}
.server-alert code{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background:rgba(0,0,0,0.26);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:8px;
  padding:2px 6px;
}
.server-alert--error{
  background:rgba(255, 120, 120, 0.12);
  border-color:rgba(255,120,120,0.45);
  color:#ffd9d9;
}
.server-alert--success{
  background:rgba(120, 255, 170, 0.12);
  border-color:rgba(120,255,170,0.45);
  color:#d7ffe8;
}

/* Divider */
.divider{
  display:flex;
  align-items:center;
  gap:12px;
  margin:18px 0 6px;
  color:var(--muted2);
  font-size:11px;
  letter-spacing:0.18em;
  text-transform:uppercase;
}
.divider::before,
.divider::after{
  content:"";
  height:1px;
  flex:1;
  background:var(--stroke);
}

/* Footer */
.footer{
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid var(--stroke);
  display:flex;
  justify-content:space-between;
  gap:10px;
  color:var(--muted2);
  font-size:12px;
  flex-wrap:wrap;
}
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.badge::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--brand);
  box-shadow:0 0 0 3px var(--brandRing);
}

/* Toast */
.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%) translateY(20px);
  z-index:9;
  min-width:min(520px, calc(100% - 32px));
  padding:12px 14px;
  border-radius:16px;
  border:1px solid var(--stroke);
  background:var(--surface-solid);
  box-shadow:var(--shadow);
  backdrop-filter: blur(14px);
  color:var(--text);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;

  opacity:0;
  pointer-events:none;
  transition:opacity 0.18s ease, transform 0.18s ease;
}
.toast[data-open="true"]{
  opacity:1;
  transform:translateX(-50%) translateY(0);
  pointer-events:auto;
}
.toast__title{
  font-family:var(--font-serif);
  letter-spacing:0.1em;
  font-size:12px;
  text-transform:uppercase;
  margin:0 0 4px;
}
.toast__msg{
  margin:0;
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
}
.toast__close{
  border:none;
  background:transparent;
  color:var(--muted);
  width:34px;
  height:34px;
  border-radius:12px;
  cursor:pointer;
}
.toast__close:hover{background:var(--surface); color:var(--text)}

@supports (backdrop-filter: blur(14px)){
  .toast{
    background: rgba(15,17,24,0.72);
  }
  :root[data-theme="light"] .toast{
    background: rgba(255,255,255,0.78);
  }
}

/* Responsive */
@media (max-width: 980px){
  .layout{grid-template-columns:1fr; gap:18px}
  .hero{padding:8px 6px}
}
@media (max-width: 520px){
  .card{padding:26px 18px 20px}
  .hero__headline{font-size:clamp(28px, 9vw, 40px)}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .orbit .orb{animation:none}
  .btn, .theme-toggle{transition:none}
}
