/* Reportify auth — branded styles, mirroring FrontEnd/src/app/pages/auth/Login.jsx
   and ForgetPassword.jsx. Fully responsive: mobile (<=600px), tablet
   (601–1024px), desktop (>1024px). */

:root {
  --brand-dark: #095a41;
  --brand-mid: #0d6e4f;
  --brand-main: #43b5c1;
  --brand-mint: #63bf99;
  --bg: #f8fafb;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #43b5c1;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #991b1b;
  --error-strong: #ef4444;
  --success-bg: #f0fdf4;
  --success-text: #166534;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(9, 90, 65, 0.08);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  /* Nunito is Reportify's brand font. */
  font-family:
    "Nunito",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Helvetica Neue",
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ─── Brand panel (left) ──────────────────────────────────────────────── */
.brand-panel {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-mid) 45%, var(--brand-main) 100%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  pointer-events: none;
}
.orb-mint {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -80px;
  background: var(--brand-mint);
}
.orb-teal {
  width: 380px;
  height: 380px;
  bottom: -120px;
  right: -100px;
  background: var(--brand-main);
}
.orb-white {
  width: 220px;
  height: 220px;
  top: 40%;
  right: 10%;
  background: #fff;
  opacity: 0.08;
}

.brand-top,
.brand-message,
.brand-foot {
  position: relative;
  z-index: 1;
}
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.brand-message h1 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 16px 0;
}
.brand-message p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  margin: 0 0 32px 0;
  max-width: 460px;
}

.features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 18px;
  max-width: 460px;
}
.features li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  padding: 0;
}
.features p {
  margin: 0;
}
.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
}
.feature-icon .material-icons-outlined {
  font-size: 20px;
  line-height: 1;
}
.feature-text {
  min-width: 0;
}
.feature-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 2px 0;
  color: #fff;
}
.feature-desc {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
}
.brand-foot {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

/* ─── Form panel (right) ──────────────────────────────────────────────── */
.form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
}
.form-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: var(--radius);
  padding: 40px 38px;
  box-shadow: var(--shadow);
}

.form-logo-mobile {
  display: none;
  margin-bottom: 24px;
  text-align: center;
}
.form-logo-mobile img {
  height: 40px;
  width: auto;
}

.mobile-footer {
  display: none;
}

.form-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--brand-dark);
}
.form-subtitle {
  margin: 0 0 24px 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Heading with gradient icon (used on forgot-password, reset-password) */
.reset-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.reset-heading-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-main) 0%, var(--brand-mint) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(67, 181, 193, 0.3);
  flex-shrink: 0;
}
.reset-heading-icon .material-icons-outlined {
  font-size: 20px;
}
.reset-heading-icon-error {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}
.reset-heading-icon-success {
  background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3);
}
.reset-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

/* ─── Stepper ────────────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px 0;
  flex-wrap: wrap;
}
.stepper-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.stepper-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  background: #e2e8f0;
  transition: all 200ms ease;
  flex-shrink: 0;
}
.stepper-circle .material-icons-outlined {
  font-size: 16px;
}
.stepper-active,
.stepper-done {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-main) 0%, var(--brand-mint) 100%);
}
.stepper-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}
.stepper-label-active {
  color: var(--text);
}
.stepper-line {
  flex-grow: 0;
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: #e2e8f0;
}
.stepper-line-done {
  background: var(--brand-main);
}

/* ─── Alerts ────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);
}
.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
}

/* ─── Form fields ───────────────────────────────────────────────────── */
.field {
  margin-bottom: 20px;
}
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.field-row label {
  margin-bottom: 0;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}
.input-wrap:hover {
  border-color: var(--border-focus);
}
.input-wrap:focus-within {
  border-color: var(--border-focus);
  border-width: 1.5px;
  box-shadow: 0 0 0 4px rgba(67, 181, 193, 0.14);
}
.input-wrap-error {
  border-color: var(--error-strong);
}
.input-wrap-error:focus-within {
  border-color: var(--error-strong);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}
.input-icon {
  font-size: 20px !important;
  color: #94a3b8;
  margin: 0 8px 0 14px;
  flex-shrink: 0;
  /* Cap dimensions so a slow-to-load Material Icons font can't render the
     literal icon NAME ("lock_outline" = 12 chars ~180px) and push the input
     contents to the right. */
  width: 20px;
  height: 20px;
  /* Keep `display: inline-block` from Google's Material Icons base CSS —
     don't override with flex (it interferes with the icon font glyph
     rendering on some browsers). Centering is via line-height. */
  line-height: 20px;
  text-align: center;
  overflow: hidden;
}
.input-wrap input {
  flex: 1;
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  padding: 14px 14px 14px 0;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
  line-height: 1.5;
  height: 48px;
  box-sizing: border-box;
  /* Force LTR text alignment. Browsers sometimes apply RTL/right-alignment
     heuristics to password fields when the user agent locale is RTL-leaning,
     which produced a visible mismatch with the username field. */
  text-align: left;
  direction: ltr;
}
.input-wrap input::placeholder {
  color: #94a3b8;
  opacity: 1;
}
.input-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0 14px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  height: 48px; /* match the input height so it doesn't push siblings */
  flex-shrink: 0;
}
.input-toggle:hover {
  color: var(--brand-main);
}
.input-toggle .material-icons-outlined {
  font-size: 20px;
}
.input-wrap-readonly {
  background: #f8fafc;
}
.input-wrap-readonly input {
  color: var(--text-muted);
  cursor: not-allowed;
}

.field-error {
  margin: 6px 2px 0 2px;
  font-size: 0.78rem;
  color: var(--error-strong);
  line-height: 1.4;
}
.field-hint {
  margin: 6px 0 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
  box-shadow: 0 0 0 1000px #ffffff inset;
  -webkit-text-fill-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}

/* ─── Password strength meter ───────────────────────────────────────── */
.strength {
  margin-top: 8px;
}
.strength-track {
  height: 6px;
  border-radius: 4px;
  background: #e2e8f0;
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition:
    width 200ms ease,
    background-color 200ms ease;
}
.strength-label {
  margin: 6px 0 0 0;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ─── Buttons ──────────────────────────────────────────────────────── */
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 24px 0;
  flex-wrap: wrap;
  gap: 12px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.checkbox input {
  margin: 0;
  accent-color: var(--brand-main);
}
.link-muted {
  font-size: 13px;
  color: var(--brand-main);
  text-decoration: none;
  font-weight: 600;
}
.link-muted:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.btn-primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  background: var(--brand-dark);
  color: #fff !important;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.2px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition:
    background 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(9, 90, 65, 0.2);
}
.btn-primary:hover {
  background: var(--brand-mid);
  box-shadow: 0 6px 16px rgba(9, 90, 65, 0.28);
}
.btn-primary:active {
  transform: scale(0.99);
}
.btn-primary:disabled {
  opacity: 0.85;
  cursor: progress;
  box-shadow: none;
}

/* Loading state — hide the label, show a spinner. Button width stays stable. */
.btn-primary .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
.btn-primary.is-loading .btn-label {
  visibility: hidden;
}
.btn-primary.is-loading .btn-spinner {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -9px 0 0 -9px;
}
@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Gradient variant — used on reset/forgot-password to match Reportify */
.btn-gradient {
  background: linear-gradient(135deg, var(--brand-main) 0%, var(--brand-mint) 100%) !important;
  box-shadow: 0 8px 22px rgba(67, 181, 193, 0.32);
}
.btn-gradient:hover {
  box-shadow: 0 12px 28px rgba(67, 181, 193, 0.42);
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
  margin-top: 14px;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--brand-main);
}

.footer-note {
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--text-soft);
  text-align: center;
}

/* ─── Back link, info box, badges ───────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-soft);
  text-decoration: none;
  margin-bottom: 18px;
  font-weight: 600;
}
.back-link:hover {
  color: var(--brand-dark);
}
.back-link .material-icons-outlined {
  font-size: 16px;
}

.info-box {
  background: #f8fafc;
  border-left: 3px solid var(--brand-main);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--text-soft);
  margin: 18px 0 20px 0;
}
.info-box p {
  margin: 0 0 8px 0;
}
.info-box p:last-child {
  margin-bottom: 0;
}
.info-box ul {
  margin: 8px 0;
  padding-left: 20px;
}
.info-box li {
  margin: 4px 0;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}
.muted {
  color: var(--text-soft);
  font-style: italic;
}

/* ─── Profile page ─────────────────────────────────────────────────── */
.profile-grid {
  border-top: 1px solid var(--border);
  margin: 4px 0 24px 0;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.profile-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  flex-shrink: 0;
}
.profile-value {
  font-size: 14px;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.profile-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}
.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease;
}
.action-card:hover {
  border-color: var(--brand-main);
}
.action-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(67, 181, 193, 0.12);
  color: var(--brand-dark);
  flex-shrink: 0;
}
.action-icon > .material-icons-outlined {
  font-size: 20px;
}
.action-body {
  flex: 1;
  min-width: 0;
}
.action-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.action-desc {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}
.action-chev {
  color: var(--text-soft);
  font-size: 22px !important;
}
.action-card:hover .action-chev {
  color: var(--brand-main);
}

.logout-form {
  margin-top: 8px;
}

/* ─── App launcher (profile page) ──────────────────────────────────── */
.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 4px 0 10px 0;
}
.app-launcher {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}
.app-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.app-tile:hover {
  border-color: var(--brand-main);
  box-shadow: 0 4px 12px rgba(67, 181, 193, 0.12);
}
.app-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-main) 0%, var(--brand-mint) 100%);
  color: #fff;
  flex-shrink: 0;
}
.app-tile-icon .material-icons-outlined {
  font-size: 22px !important;
}
.app-tile-icon--image {
  background: none;
}
.app-tile-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}
.app-tile-body {
  flex: 1;
  min-width: 0;
}
.app-tile-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.app-tile-desc {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}
.app-tile-chev {
  color: var(--text-soft);
  font-size: 18px !important;
}
.app-tile:hover .app-tile-chev {
  color: var(--brand-main);
}

/* ─── Success page (reset done) ─────────────────────────────────────── */
.success-pulse {
  margin: 20px auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-main) 0%, var(--brand-mint) 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(67, 181, 193, 0.32);
}
.success-pulse .material-icons-outlined {
  font-size: 44px !important;
}
.success-tagline {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 20px 0;
  padding: 0 16px;
}

/* Verify-email result-icon (used elsewhere) */
.result-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-icon .material-icons-outlined {
  font-size: 48px !important;
}
.result-icon-success {
  background: #dcfce7;
  color: #15803d;
}
.result-icon-error {
  background: #fee2e2;
  color: #b91c1c;
}

/* ─── Responsive ────────────────────────────────────────────────────── */

/* Tablet — narrow brand panel a bit, slightly smaller fonts */
@media (max-width: 1199px) {
  .brand-panel {
    padding: 40px;
  }
  .brand-message h1 {
    font-size: 2.25rem;
  }
  .form-panel {
    padding: 32px;
  }
  .form-card {
    padding: 36px 32px;
    max-width: 440px;
  }
}

/* Smaller tablet — switch brand panel from "scenic" to "compact hero" */
@media (max-width: 960px) {
  .brand-panel {
    padding: 32px;
  }
  .brand-message h1 {
    font-size: 2rem;
  }
  .brand-message p {
    font-size: 0.95rem;
    margin-bottom: 24px;
  }
  .features {
    gap: 14px;
  }
  .feature-title {
    font-size: 0.9rem;
  }
  .feature-desc {
    font-size: 0.82rem;
  }
  .form-card {
    padding: 32px 28px;
  }
}

/* Mobile — hide brand panel, single column, show logo + footer on form */
@media (max-width: 760px) {
  .page {
    display: block;
  }
  .brand-panel {
    display: none;
  }
  .form-panel {
    padding: 24px 16px;
    align-items: stretch;
    min-height: 100vh;
    background: radial-gradient(at 0% 0%, rgba(67, 181, 193, 0.08) 0px, transparent 55%), radial-gradient(at 100% 100%, rgba(99, 191, 153, 0.08) 0px, transparent 55%);
  }
  .form-card {
    padding: 28px 22px;
    box-shadow: none;
    max-width: 460px;
    margin: 0 auto;
    background: transparent;
  }
  .form-logo-mobile {
    display: block;
  }
  .mobile-footer {
    display: block;
    text-align: center;
    margin-top: 32px;
    font-size: 0.72rem;
    color: #94a3b8;
  }
  /* On mobile, give the form card breathing room from the top */
  .form-card {
    padding-top: 12px;
  }
  .form-title,
  .reset-title {
    font-size: 1.4rem;
  }
  .reset-heading-icon {
    width: 34px;
    height: 34px;
  }
  .reset-heading-icon .material-icons-outlined {
    font-size: 18px;
  }
  .stepper {
    gap: 6px;
  }
  .stepper-line {
    width: 16px;
  }
  .stepper-label {
    font-size: 0.72rem;
  }
  .profile-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .profile-value {
    text-align: left;
  }
  .input-icon {
    margin-left: 12px;
  }
  .input-wrap input {
    padding: 12px 12px 12px 0;
  }
}

/* Small mobile — tighter padding */
@media (max-width: 420px) {
  .form-card {
    padding: 24px 18px;
  }
  .reset-title {
    font-size: 1.25rem;
  }
  .form-title {
    font-size: 1.25rem;
  }
  .form-subtitle {
    font-size: 0.9rem;
  }
  .stepper-label {
    display: none;
  } /* circles only on tiny screens */
  .stepper-line {
    width: 20px;
  }
}
