/* Algofusion portal: login aligned with customized Algo Dashboard UI + enterprise post-login chrome */
:root {
  --af-navy: #001a56;
  --af-gradient: linear-gradient(275deg, #804bff 10%, #4269c6 70%, #3e67cc 0%, #21dbaa 150%);
  --af-panel-bg: linear-gradient(165deg, #eef2fb 0%, #f7f9fc 50%, #eef4f8 100%);
  --af-card-shadow: 4px 4px 24px rgba(0, 0, 0, 0.1);
  --header-bg: linear-gradient(180deg, #335a8c 0%, #243d5f 100%);
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Noto Sans", Roboto, "Helvetica Neue", sans-serif;
}

/* ========== Login (Algofusion split layout) ========== */
.af-login-page {
  min-height: 100vh;
  width: 100%;
  background: var(--af-panel-bg);
}

.af-login-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (min-width: 960px) {
  .af-login-layout {
    flex-direction: row;
    align-items: stretch;
  }
}

.af-login-hero {
  display: none;
}

@media (min-width: 960px) {
  .af-login-hero {
    display: flex;
    flex: 1 1 44%;
    max-width: 560px;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    background: var(--af-gradient);
    position: relative;
    overflow: hidden;
  }

  .af-login-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 120% 80% at 20% 20%, rgba(255, 255, 255, 0.12) 0%, transparent 55%);
    pointer-events: none;
  }
}

.af-login-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 400px;
}

.af-login-hero-title {
  margin: 0 0 16px;
  font-weight: 600;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.25;
  color: #fff;
  letter-spacing: -0.02em;
}

.af-login-hero-text {
  margin: 0;
  font-size: clamp(0.95rem, 1.2vw, 1.0625rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
}

.af-login-panel {
  flex: 1 1 56%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}

@media (min-width: 960px) {
  .af-login-panel {
    padding: 48px 32px 64px;
    background: var(--af-panel-bg);
  }
}

.af-login-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--af-card-shadow);
  overflow: hidden;
}

.af-progress {
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
}

.af-progress-bar {
  height: 100%;
  width: 40%;
  background: #4269c6;
  animation: af-indeterminate 1.2s ease-in-out infinite;
}

@keyframes af-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

.af-login-card-header {
  padding: 20px 24px 8px;
  text-align: center;
}

.af-login-logo {
  display: block;
  width: min(280px, 85%);
  height: auto;
  max-height: 64px;
  margin: 0 auto 16px;
  object-fit: contain;
}

.af-sign-in-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--af-navy);
  letter-spacing: 0.02em;
}

.af-login-form {
  padding: 16px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.af-field label {
  display: block;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.54);
  margin-bottom: 4px;
}

.af-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.af-field input:focus {
  outline: 2px solid rgba(66, 105, 198, 0.35);
  border-color: #4269c6;
}

.af-error {
  color: #c62828;
  font-size: 13px;
  min-height: 1.2em;
  margin: 0;
}

.af-btn-row {
  display: flex;
  justify-content: stretch;
  margin-top: 8px;
}

.af-btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.af-btn-primary {
  color: #fff !important;
  background: var(--af-gradient);
  box-shadow: 0 4px 14px rgba(66, 105, 198, 0.35);
}

.af-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.af-btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ========== Post-login: enterprise header + iframe ========== */
.embed-shell {
  display: none;
  flex-direction: column;
  height: 100vh;
  background: #0d1117;
}

.embed-shell.visible {
  display: flex;
}

.embed-app-header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 12px 0 16px;
  background: var(--header-bg);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

.embed-app-header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.embed-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.embed-select {
  min-width: 180px;
  max-width: min(420px, 50vw);
  flex: 0 1 auto;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  color: #1a1a1a;
}

.embed-btn-text {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.embed-btn-text:hover {
  background: rgba(255, 255, 255, 0.1);
}

.embed-app-header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.embed-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

.embed-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.embed-icon-btn .material-icons {
  font-size: 22px;
}

.embed-user-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  max-width: 280px;
  margin-left: 4px;
}

.embed-user-avatar {
  font-size: 40px;
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
}

.embed-user-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 8px;
  min-width: 0;
}

.embed-user-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.98);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-user-role {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-menu-wrap {
  position: relative;
}

.embed-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  z-index: 100;
  padding: 6px 0;
}

.embed-dropdown[hidden] {
  display: none !important;
}

.embed-dropdown-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.87);
  cursor: pointer;
  text-align: left;
}

.embed-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.embed-dropdown-item .material-icons {
  font-size: 20px;
  color: rgba(0, 0, 0, 0.54);
}

.embed-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #000;
}

.embed-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 719px) {
  .embed-user-text {
    display: none;
  }

  .embed-user-block {
    max-width: none;
  }
}

