/* controlpanelos — sign-in pages (Server Admin, Client Portal, Hosting).
   Loaded after panel.css, which provides the theme tokens, inputs and alerts. */

:root {
  --auth-bg: #eef2f8;
  --auth-line: rgb(15 23 42 / 7%);
  --auth-card: rgb(255 255 255 / 94%);
  --icon-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21v-1a7 7 0 0 1 16 0v1'/%3E%3C/svg%3E");
  --icon-mail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m22 7-10 6L2 7'/%3E%3C/svg%3E");
  --icon-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --icon-eye-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.9 4.2A10 10 0 0 1 12 4c6.5 0 10 8 10 8a17 17 0 0 1-2.2 3.3M6.6 6.6A17 17 0 0 0 2 12s3.5 8 10 8a10 10 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2M2 2l20 20'/%3E%3C/svg%3E");
  --icon-arrow-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
  --icon-lock-small: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] { --auth-bg: #070a12; --auth-line: rgb(255 255 255 / 6%); --auth-card: rgb(17 22 34 / 92%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --auth-bg: #070a12; --auth-line: rgb(255 255 255 / 6%); --auth-card: rgb(17 22 34 / 92%); }
}

@property --auth-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.auth-page {
  min-height: 100vh; min-height: 100svh; margin: 0;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr);
  background: var(--auth-bg); overflow-x: hidden;
}

/* --- Animated background ------------------------------------------------- */
.auth-bg { --mx: 50vw; --my: 30vh; position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.auth-grid {
  position: absolute; inset: -40px;
  background:
    linear-gradient(var(--auth-line) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--auth-line) 1px, transparent 1px) 0 0 / 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  animation: auth-pan 24s linear infinite;
}
@keyframes auth-pan { to { transform: translate3d(56px, 56px, 0); } }
.auth-beam {
  position: absolute; top: 0; width: 1px; height: 30vh;
  background: linear-gradient(transparent, var(--accent), transparent); opacity: .7;
  animation: auth-fall 7s linear infinite;
}
.auth-beam-a { left: 22%; }
.auth-beam-b { left: 74%; animation-delay: -3.5s; animation-duration: 9s; }
@keyframes auth-fall { from { transform: translateY(-40vh); } to { transform: translateY(140vh); } }
.auth-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: auth-float 20s ease-in-out infinite alternate; }
.auth-orb-a { width: 46vmax; height: 46vmax; top: -24vmax; left: 50%; margin-left: -23vmax; background: color-mix(in srgb, var(--accent) 50%, transparent); }
.auth-orb-b { width: 30vmax; height: 30vmax; bottom: -16vmax; right: -8vmax; background: color-mix(in srgb, var(--info) 30%, transparent); animation-delay: -10s; }
@keyframes auth-float { to { transform: translate3d(-5vmax, 6vmax, 0) scale(1.1); } }
.auth-spotlight {
  position: absolute; inset: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}

/* --- Top bar ------------------------------------------------------------- */
.auth-top {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 2.5rem);
  animation: auth-in .5s ease both;
}
.auth-top > .theme-toggle { justify-self: end; }
.auth-logo { display: inline-flex; align-items: center; justify-self: start; min-width: 0; gap: .65rem; color: var(--text); font-size: 1rem; }
.auth-logo strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-logo:hover { text-decoration: none; }
.auth-logo .brand-mark { flex: none; width: 36px; height: 36px; box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--accent) 80%, transparent); }
.auth-tabs {
  display: flex; justify-self: center; gap: .25rem; padding: .3rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(12px);
}
.auth-tab {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .95rem; border-radius: 999px;
  color: var(--muted); font-size: .84rem; font-weight: 650; white-space: nowrap; transition: color .2s ease, background .2s ease;
}
.auth-tab::before, .auth-badge::before, .auth-highlights li::before,
.login-input::before, .login-submit-arrow::before, .login-reveal::before, .login-secure::before {
  content: ""; flex: none; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.auth-tab:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.auth-tab[aria-current="page"] { color: var(--on-accent); background: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }

/* --- Card ---------------------------------------------------------------- */
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem; padding: 1.5rem 1rem 2.5rem; }
.auth-card {
  --auth-angle: 0deg;
  position: relative; width: min(100%, 27rem); padding: 1px; border-radius: 24px;
  background: conic-gradient(from var(--auth-angle), transparent 0 60%, var(--accent) 75%, color-mix(in srgb, var(--accent) 40%, var(--info)) 85%, transparent 100%), var(--border);
  box-shadow: var(--shadow-lg), 0 0 80px -30px var(--accent);
  animation: auth-spin 6s linear infinite, auth-in .6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes auth-spin { to { --auth-angle: 360deg; } }
@keyframes auth-in { from { opacity: 0; transform: translateY(16px); } }
.auth-card-inner {
  padding: 2.25rem clamp(1.25rem, 5vw, 2.25rem) 1.75rem; border-radius: 23px;
  background: var(--auth-card); backdrop-filter: blur(20px) saturate(1.3);
}
.auth-card-inner > .auth-badge + .auth-heading { margin-top: 1.1rem; }
.auth-badge {
  position: relative; display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto;
  border-radius: 16px; color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--info)));
  box-shadow: 0 12px 30px -10px var(--accent);
}
.auth-badge::before { width: 26px; height: 26px; }
.auth-badge::after {
  content: ""; position: absolute; inset: -6px; border-radius: 20px; border: 2px solid var(--accent);
  opacity: 0; animation: auth-pulse 2.6s ease-out infinite;
}
@keyframes auth-pulse { 0% { opacity: .6; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.35); } }
.auth-heading { text-align: center; margin-bottom: 1.5rem; }
.auth-kicker { margin-bottom: .3rem; color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-heading h1 { font-size: clamp(1.5rem, 4vw, 1.85rem); letter-spacing: -.035em; margin-bottom: .3rem; }
.auth-heading .muted { font-size: .9rem; }
.auth-error { animation: auth-shake .45s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes auth-shake {
  20%, 80% { transform: translateX(-2px); }
  40%, 60% { transform: translateX(4px); }
  50% { transform: translateX(-4px); }
}
.auth-card-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .9rem; margin: 1.25rem 0 0; color: var(--muted); font-size: .78rem; }

/* --- Fields -------------------------------------------------------------- */
.login-field { margin-bottom: .95rem; }
.login-field label { margin-top: 0; }
.login-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.login-caps { color: var(--warn); font-size: .76rem; font-weight: 650; }
.login-caps[hidden] { display: none; }
.login-input { --icon: var(--icon-user); position: relative; display: flex; align-items: center; color: var(--muted); transition: color .2s ease; }
.login-input.icon-mail { --icon: var(--icon-mail); }
.login-input.icon-lock { --icon: var(--icon-lock-small); }
.login-input::before { position: absolute; left: .95rem; z-index: 1; width: 18px; height: 18px; pointer-events: none; }
.login-input:focus-within { color: var(--accent); }
.login-input input { min-height: 3rem; padding-left: 2.8rem; border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 80%, transparent); }
.login-input input:focus { background: var(--surface); }
.login-password:has(.login-reveal:not([hidden])) input { padding-right: 3.1rem; }
.login-reveal {
  --icon: var(--icon-eye);
  position: absolute; right: .3rem; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; min-height: 0; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.login-reveal::before { width: 18px; height: 18px; }
.login-reveal:hover { background: var(--surface-3); color: var(--text); }
.login-reveal[aria-pressed="true"] { --icon: var(--icon-eye-off); color: var(--accent); }
.login-reveal[hidden] { display: none; }
.login-remember { margin: .15rem 0 0; font-size: .86rem; color: var(--text-2); }
.login-remember[hidden] { display: none; }

.login-submit {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin-top: 1.25rem; min-height: 3rem; border-radius: 12px; font-size: .95rem;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, var(--info)));
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.login-submit::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%); pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 30%) 50%, transparent 80%);
}
.login-submit:hover { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, var(--info))); filter: brightness(1.07); box-shadow: 0 14px 30px -10px var(--accent); }
.login-submit:hover::after { transform: translateX(120%); transition: transform .8s ease; }
.login-submit:active { transform: translateY(1px) scale(.995); }
.login-submit:disabled { opacity: .85; cursor: wait; }
.login-submit-arrow { --icon: var(--icon-arrow-right); display: inline-grid; transition: transform .2s ease; }
.login-submit:hover .login-submit-arrow { transform: translateX(3px); }
.login-submit.is-loading .login-submit-arrow { transform: none; }
.login-submit.is-loading .login-submit-arrow::before {
  -webkit-mask: none; mask: none; background: none;
  width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: auth-rotate .7s linear infinite;
}
@keyframes auth-rotate { to { transform: rotate(360deg); } }
.login-secure { --icon: var(--icon-lock-small); display: inline-flex; align-items: center; gap: .3rem; color: var(--ok); font-weight: 600; }
.login-secure::before { width: 12px; height: 12px; }
.login-secure[hidden] { display: none; }

/* --- Highlights and footer ----------------------------------------------- */
.auth-highlights { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.auth-highlights li {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: .8rem; font-weight: 600;
  background: color-mix(in srgb, var(--surface) 65%, transparent); backdrop-filter: blur(10px);
  transition: transform .2s ease, border-color .2s ease, color .2s ease;
  animation: auth-in .5s ease both;
}
.auth-highlights li::before { color: var(--accent); }
.auth-highlights li:nth-child(1) { animation-delay: .25s; }
.auth-highlights li:nth-child(2) { animation-delay: .35s; }
.auth-highlights li:nth-child(3) { animation-delay: .45s; }
.auth-highlights li:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--text); }
.auth-foot { display: flex; justify-content: center; gap: 1rem; padding: 0 1rem 1.25rem; color: var(--muted); font-size: .78rem; }

/* --- Small screens ------------------------------------------------------- */
@media (max-width: 760px) {
  .auth-top { grid-template-columns: minmax(0, 1fr) auto; row-gap: .75rem; }
  .auth-tabs { grid-area: 2 / 1 / 3 / -1; }
  .auth-tab { justify-content: center; padding: .55rem .85rem; }
}
@media (max-width: 420px) {
  .auth-tab::before { display: none; }
  .auth-tab { font-size: .78rem; }
  .auth-highlights { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-grid, .auth-beam, .auth-orb, .auth-card, .auth-badge::after, .auth-highlights li, .auth-top, .auth-error { animation: none; }
  .auth-beam { display: none; }
}
