/**
 * Tech Equations — production login shell (overrides legacy CyberPanel login layout).
 * Loaded after allCss.css. Safe with existing Angular hooks and IDs.
 */

:root {
  --te-ink: #0b1220;
  --te-ink-muted: #5c6578;
  --te-surface: #ffffff;
  --te-surface-2: #f4f7fb;
  --te-accent: #0d9488;
  --te-accent-deep: #0f766e;
  --te-accent-glow: rgba(13, 148, 136, 0.35);
  --te-border: #e2e8f0;
  --te-danger-bg: #fef2f2;
  --te-danger-border: #fecaca;
  --te-danger-text: #991b1b;
  --te-radius-lg: 16px;
  --te-radius-md: 10px;
  --te-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 12px 24px -4px rgba(15, 23, 42, 0.12);
  --te-font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html, body {
  font-family: var(--te-font);
  -webkit-font-smoothing: antialiased;
}

.te-login-root.te-login-layout {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  min-height: 100vh;
  background: var(--te-surface-2);
}

@supports (min-height: 100dvh) {
  .te-login-root.te-login-layout,
  .te-login-root .col-login-left,
  .te-login-root .col-login-right {
    min-height: 100dvh;
  }
}

.te-login-root.te-login-layout > .col-login-left,
.te-login-root.te-login-layout > .col-login-right {
  float: none !important;
}

.te-login-root .col-login-left {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: linear-gradient(145deg, #0f172a 0%, #134e4a 42%, #0d9488 100%) !important;
  filter: none !important;
  overflow: hidden;
}

.te-login-root .col-login-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(45, 212, 191, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  pointer-events: none;
}

.te-login-root .col-login-left .row.panel-body {
  position: relative;
  z-index: 1;
  align-items: center;
}

.te-login-root .col-login-left h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.25;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  margin-bottom: 0 !important;
}

.te-login-root .col-login-left .panel-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--te-radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  opacity: 0.95;
}

.te-login-root .col-login-right {
  background: transparent !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  min-height: 100vh;
}

.te-login-root .col-login-right .login-wrapper {
  width: 100%;
  max-width: 420px;
  justify-content: center !important;
}

.te-login-root #loginForm {
  float: none !important;
  margin: 0 auto !important;
  width: 100% !important;
  max-width: 100%;
  padding: 0 !important;
}

.te-login-root #loginForm > h1 {
  font-size: 1.5rem !important;
  line-height: 1.2;
  color: var(--te-ink) !important;
  padding: 0 0 0.25rem !important;
  margin-bottom: 0.25rem;
}

.te-login-root #loginForm > h1 img {
  max-height: 52px;
  width: auto;
  margin-bottom: 0.75rem !important;
}

.te-login-root #loginForm > h4.text-muted {
  color: var(--te-ink-muted) !important;
  font-size: 0.9rem !important;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem !important;
}

.te-login-root .te-theme-toggle-wrap {
  margin-bottom: 0.75rem;
}

.te-login-root .te-theme-toggle {
  border: 1px solid var(--te-border);
  background: var(--te-surface-2);
  color: var(--te-ink);
  border-radius: 999px;
  padding: 0.36rem 0.72rem;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.te-login-root .te-theme-toggle:hover {
  border-color: var(--te-accent);
}

.te-login-root .te-theme-toggle:focus-visible {
  outline: 3px solid var(--te-accent-glow);
  outline-offset: 1px;
}

.te-login-root .content-box-wrapper {
  background: var(--te-surface) !important;
  border-radius: var(--te-radius-lg) !important;
  box-shadow: var(--te-shadow) !important;
  border: 1px solid var(--te-border) !important;
  padding: 1.75rem 1.5rem 1.5rem !important;
  margin: 0 !important;
}

.te-login-root .mx-30 {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.te-login-root .form-group {
  margin-bottom: 1rem !important;
}

.te-login-root .input-group {
  border-radius: var(--te-radius-md);
  overflow: hidden;
  border: 1px solid var(--te-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.te-login-root .input-group:focus-within {
  border-color: var(--te-accent);
  box-shadow: 0 0 0 3px var(--te-accent-glow);
}

.te-login-root .form-control {
  height: 48px !important;
  border: none !important;
  font-size: 0.95rem !important;
  padding-left: 0.9rem !important;
  background: #fafbfc !important;
}

.te-login-root .form-control::placeholder {
  color: #94a3b8;
}

.te-login-root .input-group-addon {
  background: #f1f5f9 !important;
  border: none !important;
  color: var(--te-ink-muted) !important;
  min-width: 48px;
}

.te-login-root select.form-control {
  height: 48px !important;
  border: none !important;
  background: #fafbfc !important;
  font-size: 0.9rem !important;
}

.te-login-root .btn-login {
  height: 48px !important;
  margin-top: 0.5rem;
  border: none !important;
  border-radius: var(--te-radius-md) !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  letter-spacing: 0.04em;
  text-transform: none !important;
  background: linear-gradient(135deg, var(--te-accent) 0%, var(--te-accent-deep) 100%) !important;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.45) !important;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
}

.te-login-root .btn-login:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(13, 148, 136, 0.5) !important;
}

.te-login-root .btn-login:active {
  transform: translateY(0);
}

.te-login-root .btn-login:focus-visible,
.te-login-root .form-control:focus-visible,
.te-login-root select.form-control:focus-visible {
  outline: 3px solid var(--te-accent-glow);
  outline-offset: 1px;
}

.te-login-root #verifyingLogin {
  margin-top: 0.75rem !important;
}

.te-login-root #loginFailed {
  margin: 1.25rem 0 0 !important;
  border-radius: var(--te-radius-md) !important;
  border: 1px solid var(--te-danger-border) !important;
  background: var(--te-danger-bg) !important;
  color: var(--te-danger-text) !important;
  padding: 0.85rem 1rem !important;
}

.te-login-root #loginFailed p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
}

.te-login-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--te-border);
  text-align: center;
}

.te-login-footer__line {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--te-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.te-login-footer__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.te-login-footer__muted {
  margin: 0;
  font-size: 0.72rem;
  color: var(--te-ink-muted);
  line-height: 1.4;
}

#loading {
  background: rgba(248, 250, 252, 0.92) !important;
}

.te-login-root .spinner > div {
  background-color: var(--te-accent) !important;
}

@media (min-width: 1600px) {
  .te-login-root .col-login-right .login-wrapper {
    max-width: 480px;
  }

  .te-login-root .content-box-wrapper {
    padding: 2rem 1.75rem 1.75rem !important;
  }
}

@media (max-width: 991px) {
  .te-login-root.te-login-layout {
    flex-direction: column;
  }

  .te-login-root.te-login-layout > .col-login-left,
  .te-login-root.te-login-layout > .col-login-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
  }

  .te-login-root .col-login-left {
    min-height: auto;
    padding: 2rem 1.25rem;
  }

  .te-login-root .col-login-left .row.panel-body {
    text-align: center;
  }

  .te-login-root .col-login-right {
    min-height: auto;
    padding-bottom: 2.5rem;
  }
}

@media (max-width: 767px) {
  .te-login-root .col-login-right .login-wrapper {
    max-width: 100%;
  }

  .te-login-root .col-login-left {
    padding: 1.25rem 1rem;
  }

  .te-login-root .col-login-left h2 {
    font-size: 1.2rem;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-align: center;
  }

  .te-login-root .col-login-right {
    padding: 1rem 0.875rem 1.5rem;
  }

  .te-login-root #loginForm > h1 {
    font-size: 1.3rem !important;
    text-align: center;
  }

  .te-login-root #loginForm > h1 img {
    max-height: 46px;
  }

  .te-login-root #loginForm > h4.text-muted {
    text-align: center;
    margin-bottom: 1rem !important;
  }

  .te-login-root .content-box-wrapper {
    padding: 1.1rem 0.9rem 1rem !important;
    border-radius: 12px !important;
  }

  .te-login-root .form-control,
  .te-login-root select.form-control,
  .te-login-root .btn-login,
  .te-login-root .input-group-addon {
    height: 44px !important;
  }

  .te-login-root .btn-login {
    font-size: 0.92rem !important;
    letter-spacing: 0.02em;
  }

  .te-login-root .btn-login:hover {
    transform: none;
  }

  .te-login-footer {
    margin-top: 1rem;
    padding-top: 0.875rem;
  }

  .te-login-footer__line {
    font-size: 0.74rem;
    gap: 0.35rem;
  }

  .te-login-footer__muted {
    font-size: 0.68rem;
  }
}

@media (max-width: 480px) {
  .te-login-root .col-login-left {
    display: none !important;
  }

  .te-login-root .col-login-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
    min-height: 100vh;
    padding: 0.75rem 0.6rem 1.25rem;
  }

  @supports (padding: max(0px)) {
    .te-login-root .col-login-right {
      padding-top: max(0.75rem, env(safe-area-inset-top));
      padding-right: max(0.6rem, env(safe-area-inset-right));
      padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
      padding-left: max(0.6rem, env(safe-area-inset-left));
    }
  }

  .te-login-root #loginForm > h1 {
    font-size: 1.15rem !important;
  }

  .te-login-root #loginForm > h1 img {
    max-height: 40px;
    margin-bottom: 0.5rem !important;
  }

  .te-login-root .content-box-wrapper {
    padding: 0.95rem 0.75rem !important;
    border-radius: 10px !important;
  }

  .te-login-root .form-control {
    font-size: 0.9rem !important;
    padding-left: 0.75rem !important;
  }

  .te-login-root .input-group-addon {
    min-width: 42px;
  }

  .te-login-root #loginFailed {
    margin-top: 1rem !important;
    padding: 0.75rem 0.85rem !important;
  }
}

@media (max-height: 540px) and (orientation: landscape) {
  .te-login-root .col-login-left {
    display: none !important;
  }

  .te-login-root .col-login-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
    min-height: 100vh;
    padding: 0.5rem 0.65rem 0.75rem;
  }

  .te-login-root .content-box-wrapper {
    padding: 0.85rem 0.75rem !important;
  }

  .te-login-root .form-group {
    margin-bottom: 0.7rem !important;
  }
}

@media (prefers-color-scheme: dark) {
  html:not([data-te-theme="light"]) {
    color-scheme: dark;
  }

  html:not([data-te-theme="light"]) :root {
    --te-ink: #e5e7eb;
    --te-ink-muted: #9ca3af;
    --te-surface: #0f172a;
    --te-surface-2: #020617;
    --te-border: #334155;
    --te-danger-bg: #1f1212;
    --te-danger-border: #7f1d1d;
    --te-danger-text: #fca5a5;
    --te-shadow: 0 8px 20px -6px rgba(2, 6, 23, 0.7), 0 24px 36px -12px rgba(2, 6, 23, 0.75);
  }

  html:not([data-te-theme="light"]) .te-login-root.te-login-layout {
    background: radial-gradient(circle at top right, rgba(13, 148, 136, 0.12), transparent 35%), var(--te-surface-2);
  }

  html:not([data-te-theme="light"]) .te-login-root .col-login-left {
    background: linear-gradient(145deg, #020617 0%, #0f172a 45%, #0f766e 100%) !important;
  }

  html:not([data-te-theme="light"]) .te-login-root .content-box-wrapper {
    background: var(--te-surface) !important;
    border-color: var(--te-border) !important;
  }

  html:not([data-te-theme="light"]) .te-login-root .input-group {
    border-color: #3b4252;
  }

  html:not([data-te-theme="light"]) .te-login-root .form-control,
  html:not([data-te-theme="light"]) .te-login-root select.form-control {
    background: #111827 !important;
    color: #e5e7eb !important;
  }

  html:not([data-te-theme="light"]) .te-login-root .form-control::placeholder {
    color: #94a3b8;
  }

  html:not([data-te-theme="light"]) .te-login-root .input-group-addon {
    background: #1f2937 !important;
    color: #9ca3af !important;
  }

  html:not([data-te-theme="light"]) .te-login-root #loginFailed {
    background: var(--te-danger-bg) !important;
    border-color: var(--te-danger-border) !important;
    color: var(--te-danger-text) !important;
  }

  html:not([data-te-theme="light"]) .te-login-root .te-login-footer {
    border-top-color: var(--te-border);
  }

  html:not([data-te-theme="light"]) .te-login-root .te-login-footer__badge {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.35);
  }

  html:not([data-te-theme="light"]) #loading {
    background: rgba(2, 6, 23, 0.86) !important;
  }
}

html[data-te-theme="dark"] {
  color-scheme: dark;
  --te-ink: #e5e7eb;
  --te-ink-muted: #9ca3af;
  --te-surface: #0f172a;
  --te-surface-2: #020617;
  --te-border: #334155;
  --te-danger-bg: #1f1212;
  --te-danger-border: #7f1d1d;
  --te-danger-text: #fca5a5;
  --te-shadow: 0 8px 20px -6px rgba(2, 6, 23, 0.7), 0 24px 36px -12px rgba(2, 6, 23, 0.75);
}

html[data-te-theme="dark"] .te-login-root.te-login-layout {
  background: radial-gradient(circle at top right, rgba(13, 148, 136, 0.12), transparent 35%), var(--te-surface-2);
}

html[data-te-theme="dark"] .te-login-root .col-login-left {
    background: linear-gradient(145deg, #020617 0%, #0f172a 45%, #0f766e 100%) !important;
}

html[data-te-theme="dark"] .te-login-root .content-box-wrapper {
    background: var(--te-surface) !important;
    border-color: var(--te-border) !important;
}

html[data-te-theme="dark"] .te-login-root .input-group {
    border-color: #3b4252;
}

html[data-te-theme="dark"] .te-login-root .form-control,
html[data-te-theme="dark"] .te-login-root select.form-control {
    background: #111827 !important;
    color: #e5e7eb !important;
}

html[data-te-theme="dark"] .te-login-root .form-control::placeholder {
    color: #94a3b8;
}

html[data-te-theme="dark"] .te-login-root .input-group-addon {
    background: #1f2937 !important;
    color: #9ca3af !important;
}

html[data-te-theme="dark"] .te-login-root #loginFailed {
    background: var(--te-danger-bg) !important;
    border-color: var(--te-danger-border) !important;
    color: var(--te-danger-text) !important;
}

html[data-te-theme="dark"] .te-login-root .te-login-footer {
    border-top-color: var(--te-border);
}

html[data-te-theme="dark"] .te-login-root .te-login-footer__badge {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.35);
}

html[data-te-theme="dark"] #loading {
    background: rgba(2, 6, 23, 0.86) !important;
}

html[data-te-theme="light"] {
  color-scheme: light;
}
