/*
 * Tema de login do Fisco360: mesmas cores do painel (apps/web/src/app/globals.css).
 * Nada é carregado de serviço externo: fontes do sistema e ícones embutidos.
 */

:root {
  --marca-900: #092a49;
  --marca-700: #12406b;
  --marca-600: #1a5c96;
  --marca-escuro: #092a49;
  --destaque: #0fa45d;
  --destaque-300: #4ade95;

  --background: #ffffff;
  --foreground: #0a0a0a;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #a1a1a1;
  --gray-900: #111827;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --radius-md: 8px;
  --radius-lg: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html.pf-html,
body.pf-body {
  margin: 0;
  min-height: 100%;
}

body.pf-body {
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Como o preflight do Tailwind no fiscal-app: imagens mantêm a proporção. */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Moldura ── */

.pf-login {
  display: flex;
  min-height: 100vh;
}

/* Esquerda: imagem com a marca (só a partir de 1024px, como o `lg:` do Tailwind). */
.pf-visual {
  position: relative;
  display: none;
  flex: 1 1 0%;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 92%, var(--destaque) 0 9rem, transparent 9.05rem),
    radial-gradient(circle at 100% 62%, var(--marca-700) 0 17rem, transparent 17.05rem),
    var(--marca-900);
}

.pf-visual-content {
  position: relative;
  z-index: 10;
  display: flex;
  width: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem;
}

.pf-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
}

.pf-pitch {
  max-width: 30rem;
}

.pf-pitch-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--destaque-300);
}

.pf-pitch-title {
  margin: 0 0 1.5rem;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 700;
  color: #fff;
}

.pf-pitch-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  font-size: 0.9375rem;
  color: rgb(255 255 255 / 0.85);
}

.pf-pitch-list li {
  display: flex;
  gap: 0.625rem;
  align-items: baseline;
}

.pf-pitch-list li::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--destaque-300);
}

/* Direita: formulário */
.pf-panel {
  position: relative;
  display: flex;
  flex: 1 1 0%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.pf-brand-mobile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: var(--marca-escuro);
}

.pf-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .pf-visual {
    display: flex;
  }
  .pf-panel {
    max-width: 520px;
  }
  .pf-brand-mobile {
    display: none;
  }
}

/* ── Cabeçalho ── */

.pf-header h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--gray-900);
}

.pf-subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--gray-500);
}

.pf-required-note {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.required {
  color: #dc2626;
}

.pf-username {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.pf-username label {
  font-weight: 600;
  color: var(--gray-900);
}

.pf-username a {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--marca-600);
  transition: color 0.15s;
}

.pf-username a:hover {
  color: var(--marca-700);
}

/* ── Formulário (Input, Label e Button do shadcn) ── */

#kc-content-wrapper,
.pf-form,
form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#kc-content-wrapper > form + form,
#kc-content-wrapper > div + form {
  margin-top: 0;
}

.pf-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pf-label,
.pf-group > label {
  font-size: 0.875rem;
  line-height: 1;
  font-weight: 500;
  color: var(--foreground);
}

.pf-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pf-input,
.pf-group input[type="text"],
.pf-group input[type="email"],
.pf-group input[type="password"],
.pf-group input[type="tel"],
.pf-group input[type="number"],
.pf-group select,
.pf-group textarea {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  outline: none;
  transition: color 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.pf-group textarea,
.pf-textarea {
  height: auto;
  min-height: 4rem;
  padding: 0.5rem 0.75rem;
}

.pf-input::placeholder,
.pf-group input::placeholder {
  color: var(--muted-foreground);
}

.pf-input:focus-visible,
.pf-group input:focus-visible,
.pf-group select:focus-visible,
.pf-group textarea:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgb(161 161 161 / 0.5);
}

.pf-input[aria-invalid="true"],
.pf-group input[aria-invalid="true"] {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgb(220 38 38 / 0.2);
}

.pf-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Ícone dentro do campo (User, Lock), como no fiscal-app. */
.pf-input-icon {
  position: relative;
}

.pf-input-icon > .pf-icon:first-child {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--gray-400);
  pointer-events: none;
}

.pf-group .pf-input-icon > input.pf-input {
  padding-left: 2.5rem;
}

.pf-input-group {
  position: relative;
}

.pf-group .pf-input-group > input.pf-input {
  padding-right: 2.5rem;
}

.pf-eye {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
}

.pf-eye:hover {
  color: var(--gray-500);
  background: #f5f5f5;
}

.pf-eye .pf-icon {
  width: 1rem;
  height: 1rem;
}

.pf-field-error,
.kc-feedback-text {
  font-size: 0.8125rem;
  color: #b91c1c;
}

.pf-help {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.pf-check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
}

.pf-check {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--marca-700);
}

/* Botões */
.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.pf-btn:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.pf-btn-primary {
  background: var(--marca-900);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgb(59 130 246 / 0.25), 0 4px 6px -4px rgb(59 130 246 / 0.25);
}

.pf-btn-primary:hover {
  box-shadow: 0 10px 15px -3px rgb(59 130 246 / 0.4), 0 4px 6px -4px rgb(59 130 246 / 0.4);
}

.pf-btn-secondary {
  background: var(--background);
  border-color: var(--border);
  color: var(--foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.pf-btn-secondary:hover {
  background: #f5f5f5;
}

.pf-btn-block {
  width: 100%;
}

/* Botões lado a lado das telas de ação (ex.: aceitar/recusar). */
.pf-form-buttons,
#kc-form-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#kc-form-buttons > .pf-btn,
#kc-form-buttons > input[type="submit"] {
  flex: 1 1 0%;
}

.pf-form-options-wrapper,
#kc-form-options {
  font-size: 0.875rem;
}

/* Links */
.pf-link,
#kc-content a:not(.pf-btn) {
  color: var(--marca-600);
  transition: color 0.15s;
}

.pf-link:hover,
#kc-content a:not(.pf-btn):hover {
  color: var(--marca-700);
}

.pf-link-small {
  font-size: 0.75rem;
}

.pf-center {
  align-items: center;
  text-align: center;
}

/* ── Mensagens (como o alerta de erro do fiscal-app) ── */

.pf-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.pf-alert .pf-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}

.pf-alert-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.pf-alert-warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.pf-alert-success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

/* ── Rodapé do formulário ── */

.pf-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
  font-size: 0.875rem;
}

.pf-divider {
  position: relative;
  display: flex;
  justify-content: center;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.pf-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--gray-200);
}

.pf-divider span {
  position: relative;
  padding: 0 0.5rem;
  background: var(--background);
  color: var(--gray-400);
}

.pf-signup,
#kc-registration {
  font-size: 0.875rem;
  text-align: center;
  color: var(--gray-500);
}

/* ── Provedores externos, autenticadores e OTP ── */

.pf-social {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pf-social-list,
.pf-auth-list,
.pf-recovery-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pf-auth-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: var(--foreground);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.pf-auth-item:hover {
  border-color: var(--marca-600);
  box-shadow: 0 4px 12px -4px rgb(59 130 246 / 0.25);
}

.pf-auth-body {
  flex: 1;
}

.pf-auth-heading {
  font-weight: 600;
  font-size: 0.875rem;
}

.pf-auth-desc {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.pf-otp-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pf-otp-input {
  position: absolute;
  opacity: 0;
}

.pf-otp-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
}

.pf-otp-input:checked + label .pf-otp-item,
.pf-otp-input:checked + .pf-otp-item {
  border-color: var(--marca-700);
  box-shadow: 0 0 0 3px rgb(44 64 127 / 0.15);
}

/* ── Seletor de idioma ── */

.pf-locale {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 0.75rem;
}

.pf-locale-dropdown {
  position: relative;
}

.pf-locale-dropdown > button {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--gray-500);
  font: inherit;
  cursor: pointer;
}

.pf-locale-list {
  position: absolute;
  right: 0;
  z-index: 20;
  display: none;
  min-width: 8rem;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  list-style: none;
}

.pf-locale-dropdown > button[aria-expanded="true"] + .pf-locale-list,
.pf-locale-dropdown:focus-within .pf-locale-list {
  display: block;
}

.pf-locale-list a {
  display: block;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  color: var(--foreground);
}

.pf-locale-list a:hover {
  background: #f5f5f5;
}

/* ── Ícones (Lucide, os mesmos do fiscal-app), desenhados por máscara ── */

.pf-icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.pf-icon-user {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><path d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/><circle cx='12' cy='7' r='4'/></svg>");
}

.pf-icon-lock {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><rect width='18' height='11' x='3' y='11' rx='2' ry='2'/><path d='M7 11V7a5 5 0 0 1 10 0v4'/></svg>");
}

.pf-icon-eye {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><path d='M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0'/><circle cx='12' cy='12' r='3'/></svg>");
}

.pf-icon-eye-off {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><path d='M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49'/><path d='M14.084 14.158a3 3 0 0 1-4.242-4.242'/><path d='M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143'/><path d='m2 2 20 20'/></svg>");
}

.pf-icon-alert {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><circle cx='12' cy='12' r='10'/><line x1='12' x2='12' y1='8' y2='12'/><line x1='12' x2='12.01' y1='16' y2='16'/></svg>");
}

.pf-icon-check {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><circle cx='12' cy='12' r='10'/><path d='m9 12 2 2 4-4'/></svg>");
}

.pf-icon-info {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
}

.pf-icon-chevron {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><path d='m9 18 6-6-6-6'/></svg>");
}

.pf-icon-phone {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><rect width='14' height='20' x='5' y='2' rx='2' ry='2'/><path d='M12 18h.01'/></svg>");
}

.pf-icon-restart {
  --icon: url("data:image/svg+xml;utf8,<svg 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'><path d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/><path d='M3 3v5h5'/></svg>");
}

/* Logo da marca (resources/img). */
.pf-brand img {
  display: block;
  height: 2.5rem;
  width: auto;
}

.pf-brand-mobile img {
  display: block;
  height: 2.25rem;
  width: auto;
}
