/* Factura AI auth — extracted 1:1 from prototype-auth.html */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Re-skinned to match the app theme (home.css — slate-blue dark palette). */
  --bg-primary: #0d0d16;
  --bg-secondary: #1a1a26;
  --bg-card: #1e1e2c;
  --bg-input: #28283a;
  --bg-input-focus: #313148;
  --border: #3a3a46;
  --border-focus: #6f93b8;
  --text-primary: #ffffff;
  --text-secondary: #c0c0d0;
  --text-muted: #8888a0;
  --accent: #6f93b8;
  --accent-hover: #5e7fa2;
  --accent-subtle: rgba(111, 147, 184, 0.16);
  --success: #34d399;
  --success-subtle: rgba(52, 211, 153, 0.15);
  --error: #e5484d;
  --error-subtle: rgba(229, 72, 77, 0.15);
  --warning: #f5a623;
  --warning-subtle: rgba(245, 166, 35, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 150ms ease;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.auth-container { display: flex; min-height: 100vh; }
.auth-branding {
  flex: 1;
  background:
    radial-gradient(120% 75% at 15% 10%, rgba(111, 147, 184, 0.13) 0%, transparent 55%),
    radial-gradient(80% 60% at 95% 100%, rgba(77, 148, 132, 0.08) 0%, transparent 60%),
    linear-gradient(158deg, #1c1c29 0%, #15151f 52%, #0c0c13 100%);
  display: flex; flex-direction: column; justify-content: flex-start;
  padding: 52px 64px; position: relative; overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.auth-branding::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(111, 147, 184, 0.28), transparent);
  pointer-events: none;
}
/* Centered on the panel's axis (the divider line is the right edge) and fluid:
   640px até ~1390px de viewport — igual ao layout antigo — depois cresce com o
   ecrã até 900px. ≤900px o painel está escondido, por isso mobile não muda. */
.brand-inner { position: relative; z-index: 1; width: 100%; max-width: clamp(640px, 46vw, 900px); margin-inline: auto; }
/* wordmark lockup — circled emblem + centre line + wordmark, line continues
   past it and fades out (Option B). Emblem, line and text share one centre axis. */
.brand-logo { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
/* clamps calibrados: valor actual a ~1390px de viewport, ~1.3× a ~1930px */
.bl-emblem {
  width: clamp(48px, 2.4vw + 14.6px, 62px); height: clamp(48px, 2.4vw + 14.6px, 62px);
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #ffffff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  outline: 1px solid rgba(255, 255, 255, 0.06);
}
.bl-emblem img { width: clamp(32px, 1.6vw + 9.8px, 42px); height: clamp(32px, 1.6vw + 9.8px, 42px); object-fit: contain; display: block; }
.bl-word { font-size: clamp(23px, 1.15vw + 7px, 30px); font-weight: 800; letter-spacing: 0.2px; line-height: 1; color: var(--text-primary); white-space: nowrap; flex-shrink: 0; }
.bl-word .ai { color: var(--accent); }
.bl-line { height: 3px; border-radius: 999px; flex-shrink: 0; }
.bl-pre { width: 60px; background: linear-gradient(90deg, var(--accent), #5e8fa0); }
.bl-post { flex: 1 1 0; min-width: 28px; background: linear-gradient(90deg, #5e8fa0, #4d9484 32%, rgba(77, 148, 132, 0) 100%); }

/* hero headline — two uppercase lines (one sentence each) */
.brand-headline {
  font-size: clamp(24px, 1.2vw + 7.3px, 32px); font-weight: 800; line-height: 1.22; letter-spacing: -0.2px;
  text-transform: uppercase; color: var(--text-primary); margin: 0 0 30px;
}
.brand-headline .hl-line { display: block; }

/* gradient accent (slate -> teal) — matches the app's --accent / --cyan */
.grad-text {
  background: linear-gradient(100deg, #6f93b8 0%, #5e8fa0 48%, #4d9484 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

@keyframes brand-sub-flow {
  from { background-position: 0% center; }
  to   { background-position: -200% center; }
}

/* product showcase — framed app screenshot (the hero visual) */
.brand-shot { margin: 0 0 28px; }
.brand-shot-frame {
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #15151f;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.brand-shot-bar {
  display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 14px;
  background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brand-shot-bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.brand-shot-bar i:first-child { background: rgba(229, 72, 77, 0.55); }
.brand-shot-bar i:nth-child(2) { background: rgba(245, 166, 35, 0.55); }
.brand-shot-bar i:nth-child(3) { background: rgba(52, 211, 153, 0.50); }
.brand-shot-img { display: block; width: 100%; height: auto; }

/* closing line — kept to a single line; white + bold with a bright shimmer
   sweeping left -> right (high contrast so the motion is actually visible) */
.brand-sub {
  font-size: clamp(15px, 0.75vw + 4.6px, 19px); font-weight: 700; line-height: 1.5; white-space: nowrap; letter-spacing: -0.1px;
  background-image: linear-gradient(90deg,
    #ffffff 0%,
    rgba(255, 255, 255, 0.42) 25%,
    #ffffff 50%,
    rgba(255, 255, 255, 0.42) 75%,
    #ffffff 100%);
  background-size: 200% 100%;
  background-position: 0% center;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: brand-sub-flow 4s linear infinite;
}
/* inner span inherits the parent's single flowing gradient (no separate clip) */
.brand-sub .grad-text { background: none; }
@media (prefers-reduced-motion: reduce) {
  .brand-sub { animation: none; }
}

/* legal footer — pinned to the very bottom of the branding panel */
.brand-legal {
  margin-top: auto; padding-top: 40px; white-space: nowrap;
  width: 100%; max-width: clamp(640px, 46vw, 900px); margin-inline: auto;
  position: relative; z-index: 1;
  font-size: 12.5px; line-height: 1.65; letter-spacing: 0.1px;
  color: rgba(255, 255, 255, 0.58);
}
.auth-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; max-width: 560px; }
.auth-form-wrapper { width: 100%; max-width: 400px; }

.auth-tabs { display: flex; gap: 0; margin-bottom: 32px; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 12px 0; text-align: center; font-size: 14px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border: none; border-bottom: 2px solid transparent;
  transition: var(--transition); background: none; font-family: var(--font); text-decoration: none;
}
.auth-tab:hover { color: var(--text-secondary); }
.auth-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.form-header { margin-bottom: 28px; }
.form-header h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin-bottom: 6px; }
.form-header p { font-size: 14px; color: var(--text-secondary); }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input-wrapper { position: relative; }
.form-input {
  width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 14px; font-family: var(--font);
  transition: var(--transition); outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--border-focus); background: var(--bg-input-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
/* Campos bloqueados (dados verificados pela AGT): visivelmente não editáveis,
   sem tocar na cor da borda para os estados .success/.error continuarem a ler. */
.form-input[readonly] { background: var(--bg-secondary); color: var(--text-secondary); cursor: not-allowed; }
.form-input[readonly]:focus { background: var(--bg-secondary); box-shadow: none; border-color: var(--border); }
.form-input.error { border-color: var(--error); box-shadow: 0 0 0 3px var(--error-subtle); }
.form-input.success { border-color: var(--success); }

.form-error { font-size: 12px; color: var(--error); margin-top: 4px; display: none; }
.form-error.visible { display: block; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error-banner {
  background: var(--error-subtle); border: 1px solid rgba(229, 72, 77, 0.4); border-left: 3px solid var(--error);
  color: var(--error); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 18px;
}

.phone-input-group { display: flex; gap: 8px; }
.phone-prefix { width: 90px; flex-shrink: 0; }

.password-strength { display: flex; gap: 4px; margin-top: 8px; }
.strength-bar { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: var(--transition); }
.strength-bar.active-weak { background: var(--error); }
.strength-bar.active-fair { background: var(--warning); }
.strength-bar.active-good { background: var(--accent); }
.strength-bar.active-strong { background: var(--success); }
.strength-text { font-size: 11px; margin-top: 4px; color: var(--text-muted); }

.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; font-family: var(--font);
}
.password-toggle:hover { color: var(--text-secondary); }

.nif-status { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 500; display: none; }
.nif-status.found { color: var(--success); display: block; }
.nif-status.not-found { color: var(--warning); display: block; }
.nif-empresa-name { font-size: 12px; color: var(--success); margin-top: 4px; padding: 6px 10px; background: var(--success-subtle); border-radius: var(--radius); display: none; }
.nif-empresa-name.visible { display: block; }
.nif-not-found-warning {
  margin-top: 8px; padding: 12px 14px; background: var(--warning-subtle);
  border: 1px solid rgba(245, 166, 35, 0.3); border-radius: var(--radius); font-size: 13px; color: var(--warning);
}
.nif-not-found-warning p { margin-bottom: 4px; }
.btn-warning-yes { padding: 6px 14px; background: var(--warning); color: #000; border: none; border-radius: var(--radius); font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font); }
.btn-warning-no { padding: 6px 14px; background: transparent; color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; cursor: pointer; font-family: var(--font); }
.btn-warning-yes:hover { opacity: 0.9; }
.btn-warning-no:hover { border-color: var(--text-muted); }

.agt-result-card { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-secondary); }
.agt-result-header { background: var(--accent); color: white; padding: 8px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.3px; }
.agt-result-body { padding: 12px 14px; }
.agt-row { display: flex; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.agt-row:last-child { border-bottom: none; }
.agt-label { width: 120px; flex-shrink: 0; color: var(--text-muted); font-weight: 500; }
.agt-value { color: var(--text-primary); flex: 1; }
.agt-resident { font-style: italic; color: var(--text-secondary); }
.agt-result-footer { padding: 6px 14px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--bg-card); }
.agt-estado-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.agt-estado-badge.activo { background: var(--success-subtle); color: var(--success); }
.agt-estado-badge.inactivo { background: var(--error-subtle); color: var(--error); }

.form-checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-input); cursor: pointer; accent-color: var(--accent); margin-top: 2px; flex-shrink: 0; }
.form-checkbox span { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.form-checkbox a { color: var(--accent); text-decoration: none; }
.form-checkbox a:hover { text-decoration: underline; }

.form-select {
  width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); font-size: 14px; font-family: var(--font);
  transition: var(--transition); outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8b96' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.form-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }

.btn { width: 100%; padding: 11px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500; font-family: var(--font); cursor: pointer; transition: var(--transition); border: none; outline: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-input); border-color: var(--text-muted); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google svg { width: 18px; height: 18px; }

.auth-divider { display: flex; align-items: center; gap: 16px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.auth-link { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 20px; }
.auth-link a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }

.forgot-link { display: block; text-align: right; font-size: 13px; color: var(--accent); text-decoration: none; margin-top: -10px; margin-bottom: 18px; }
.forgot-link:hover { text-decoration: underline; }

.otp-container { display: flex; gap: 10px; justify-content: center; margin: 28px 0; }
.otp-input {
  width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 600;
  font-family: var(--font); background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary); outline: none; transition: var(--transition);
}
.otp-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
.otp-message { text-align: center; font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.otp-email { color: var(--text-primary); font-weight: 500; }
.otp-resend { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 16px; }
.otp-resend a { color: var(--accent); text-decoration: none; cursor: pointer; }

.wizard-progress { display: flex; align-items: center; gap: 0; margin-bottom: 32px; }
.wizard-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.wizard-step.active { color: var(--text-primary); }
.wizard-step.completed { color: var(--success); }
.wizard-step-number { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.wizard-step.active .wizard-step-number { background: var(--accent); border-color: var(--accent); color: white; }
.wizard-step.completed .wizard-step-number { background: var(--success); border-color: var(--success); color: white; }
.wizard-step-line { flex: 1; height: 1px; background: var(--border); margin: 0 12px; }
.wizard-step-line.completed { background: var(--success); }

.file-upload { border: 1px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: var(--transition); }
.file-upload:hover { border-color: var(--accent); background: var(--accent-subtle); }
.file-upload-icon { font-size: 24px; margin-bottom: 8px; }
.file-upload-text { font-size: 13px; color: var(--text-secondary); }
.file-upload-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 900px) {
  .auth-branding { display: none; }
  .auth-form-side { max-width: 100%; padding: 24px; }
}
@media (max-width: 480px) {
  .auth-form-wrapper { max-width: 100%; }
  .otp-input { width: 42px; height: 48px; font-size: 18px; }
  .otp-container { gap: 6px; }
}
