/* ==========================================================================
   MABII - UI COMPONENTS (MOBILE OPTIMIZED)
   ========================================================================== */

/* ── AUTHENTICATION SCREEN ── */
#authScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: #FFFFFF;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo-img {
  height: 68px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  margin-bottom: 10px;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.auth-sub {
  font-size: 13px;
  color: #1E293B;
  font-weight: 600;
}

.auth-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 24px 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-card h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--mabii-navy-deep);
  margin-bottom: 4px;
}

.auth-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.auth-fgrp {
  margin-bottom: 14px;
}

.auth-fgrp label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.auth-fgrp input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px; /* Prevents auto-zoom on iOS */
  font-weight: 700;
  outline: none;
  transition: var(--transition-fast);
  color: var(--text-main);
  background: #FFF;
}

.auth-fgrp input:focus {
  border-color: var(--mabii-navy-deep);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper input {
  padding-right: 46px;
}

.toggle-senha-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition-fast);
}

.toggle-senha-btn:hover, .toggle-senha-btn:active {
  color: var(--mabii-navy-deep);
  background: rgba(0, 0, 0, 0.05);
}

.auth-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  min-height: 48px; /* Touch target */
  font-size: 16px;
  font-weight: 800;
  color: #FFF;
  background: linear-gradient(to right, #162858 0%, #0C1838 100%);
  margin-top: 8px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-btn:active {
  transform: scale(0.98);
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-switch button {
  border: none;
  color: var(--mabii-navy-deep);
  font-weight: 800;
  font-size: 13px;
  padding: 4px;
}

.auth-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--danger-text);
  font-weight: 700;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}

.auth-success {
  background: var(--green-bg, #ECFDF5);
  border: 1px solid var(--green, #10B981);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--green-text, #065F46);
  font-weight: 700;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}

.auth-loading {
  text-align: center;
  color: #1E293B;
  font-size: 13px;
  font-weight: 700;
  margin-top: 16px;
  display: none;
}

/* ── INSTANT EMAIL VALIDATION FEEDBACK ── */
.auth-fgrp input.input-error {
  border-color: var(--danger, #EF4444) !important;
  background-color: #FEF2F2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.auth-fgrp input.input-valid {
  border-color: #10B981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
}

.email-feedback {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--danger, #EF4444);
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
  animation: fadeIn 0.2s ease-in-out;
}

.email-feedback.valid {
  color: #059669;
}

/* ── REMEMBER ME CHECKBOX ── */
.auth-remember-row {
  margin: 6px 0 14px 0;
  display: flex;
  align-items: center;
}

.remember-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.remember-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--mabii-navy-deep);
  cursor: pointer;
}

/* ── OTP 6-DIGIT VERIFICATION CARD ── */
.otp-card {
  animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.otp-badge-header {
  text-align: center;
  margin-bottom: 20px;
}

.otp-icon-bubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  color: #162858;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px auto;
  box-shadow: 0 8px 16px rgba(22, 40, 88, 0.12);
}

.otp-badge-header h2 {
  font-size: 20px;
  font-weight: 900;
  color: var(--mabii-navy-deep);
  margin-bottom: 6px;
}

.otp-badge-header p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.otp-target-email {
  color: var(--mabii-navy-deep);
  font-weight: 800;
  word-break: break-all;
}

.otp-inputs-wrapper {
  margin: 22px 0 14px 0;
}

.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.otp-digit {
  width: 44px;
  height: 52px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  background: #F8FAFC;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
  color: var(--text-main);
  outline: none;
  transition: all 0.18s ease;
  font-family: inherit;
  caret-color: var(--mabii-navy-deep);
}

.otp-digit:focus {
  border-color: #162858;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(22, 40, 88, 0.16);
  transform: translateY(-2px);
}

.otp-digit.filled {
  border-color: #162858;
  background: #FFFFFF;
}

.otp-digit.error {
  border-color: var(--danger) !important;
  background: #FEF2F2 !important;
  color: var(--danger) !important;
}

@keyframes otpShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.otp-inputs.shake {
  animation: otpShake 0.4s ease-in-out;
}

.otp-timer-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.otp-timer-info svg {
  stroke: var(--text-muted);
}

.otp-resend-row {
  text-align: center;
  margin-top: 14px;
}

.otp-resend-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--mabii-navy-deep);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.otp-resend-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.otp-resend-btn:not(:disabled):hover {
  text-decoration: underline;
  background: rgba(22, 40, 88, 0.05);
}

.otp-footer-action {
  text-align: center;
  margin-top: 12px;
}

.otp-back-btn {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.otp-back-btn:hover {
  color: var(--mabii-navy-deep);
}

@media (max-width: 360px) {
  .otp-inputs {
    gap: 5px;
  }
  .otp-digit {
    width: 38px;
    height: 46px;
    font-size: 18px;
    border-radius: 8px;
  }
}

/* ── BUTTONS & CHIPS (TOUCH READY) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 44px; /* Touch target */
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  transition: var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background: var(--mabii-navy-deep);
  color: #FFF;
}

.btn-secondary {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  background: #FFF;
  transition: var(--transition-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-title {
  pointer-events: none;
}

.chip-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
}

.chip-act-btn {
  background: transparent;
  border: none;
  font-size: 12px;
  padding: 3px 4px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: var(--transition-fast);
}

.chip-act-btn:hover, .chip-act-btn:active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.chip.spj {
  background: var(--pjl);
  border-color: var(--pj-accent);
  color: var(--pj-accent);
}

.chip.spf {
  background: var(--pfl);
  border-color: var(--mabii-turquoise-deep);
  color: var(--mabii-turquoise-deep);
}

.chip.add-chip {
  border-style: dashed;
  color: var(--text-muted);
}

.custom-cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
  padding: 4px 2px;
}

.cat-manage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.cat-tag-title {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-tag-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cat-act-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.7;
  border-radius: 4px;
  line-height: 1;
}

.cat-act-btn:hover, .cat-act-btn:active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.cat-label-actions {
  display: flex;
  gap: 6px;
}

.cat-action-link {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.cat-action-link:hover, .cat-action-link:active {
  color: var(--mabii-navy-deep);
  background: rgba(0, 0, 0, 0.05);
}

.cat-action-link.danger:hover, .cat-action-link.danger:active {
  color: var(--danger-text);
  background: var(--danger-bg);
}

/* ── MOBILE BOTTOM-SHEET MODAL ── */
.overlay {
  display: none;
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}

.overlay.open {
  display: flex;
  pointer-events: auto;
}

.modal {
  background: #FFF;
  width: 100%;
  max-width: 500px;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px 36px;
  animation: slideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
}

@media (min-width: 640px) {
  .overlay {
    align-items: center;
  }
  .modal {
    border-radius: 20px;
    padding-bottom: 24px;
  }
}

.mhandle {
  width: 40px;
  height: 5px;
  background: var(--border-strong);
  border-radius: 3px;
  margin: 0 auto 18px;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header-row h2, .modal h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--mabii-navy-deep);
  margin-bottom: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.modal-close-btn:hover, .modal-close-btn:active {
  color: var(--danger-text, #E53935);
  background: var(--danger-bg, #FFEBEE);
}

.fgrp {
  margin-bottom: 14px;
}

.fgrp label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.fgrp input, .fgrp select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px; /* Prevents auto-zoom on mobile safari */
  font-weight: 700;
  color: var(--text-main);
  background: #FFF;
  outline: none;
  min-height: 46px;
}

.fgrp input:focus, .fgrp select:focus {
  border-color: var(--mabii-navy-deep);
}

.tipo-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.tbtn {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 4px;
  min-height: 44px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  background: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tbtn.te {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green-text);
}

.tbtn.ts {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}

.tbtn.tt {
  background: var(--mabii-navy-bg);
  border-color: var(--mabii-navy-main);
  color: var(--mabii-navy-main);
}

.recorr-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.rtbtn {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 4px;
  min-height: 40px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  background: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rtbtn.active {
  background: var(--mabii-navy-deep);
  border-color: var(--mabii-navy-deep);
  color: #FFF;
}

.mbtns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.btn-cancel {
  border: 1px solid var(--border-strong);
  background: #FFF;
  border-radius: 10px;
  padding: 13px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-muted);
}

.btn-save {
  border: none;
  border-radius: 10px;
  padding: 13px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
  color: #FFF;
  background: linear-gradient(to right, #162858 0%, #0C1838 100%);
}

/* ── FLOATING ACTION BUTTON (FAB FOR MOBILE THUMBS) ── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 18px;
  z-index: 200;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  color: #FFF;
  background: linear-gradient(to right, #162858 0%, #0C1838 100%);
  box-shadow: 0 6px 20px rgba(12, 24, 56, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.fab:active {
  transform: scale(0.92);
}

.fab.fpf {
  background: linear-gradient(to right, #06B6D4 0%, #0891B2 100%);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.35);
}

/* ── EMPTY STATE ── */
.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}

.empty p {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-main);
}

.empty small {
  font-size: 12px;
}

/* ── AI CAMERA & RECEIPT SCANNER ── */
.scan-receipt-box {
  margin-bottom: 16px;
}

.scan-receipt-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 380px) {
  .scan-receipt-btns {
    grid-template-columns: 1fr;
  }
}

.btn-scan-receipt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
}

.btn-scan-camera {
  background: linear-gradient(to right, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-scan-file {
  background: var(--bg-card, #F8FAFC);
  color: var(--mabii-navy-main, #1E3A8A);
  border: 1.5px solid var(--mabii-navy-light, #3B82F6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-scan-file:hover {
  background: #EFF6FF;
}

.btn-scan-receipt:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.scan-icon {
  font-size: 18px;
}

.scan-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 10px;
  color: #1E40AF;
  font-size: 13px;
  font-weight: 700;
  animation: fadeIn 0.2s ease forwards;
}

.scan-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #BFDBFE;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.field-autofilled {
  animation: pulseGreen 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-color: #10B981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

@keyframes pulseGreen {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}


/* Links de conta: política de privacidade / excluir conta */
.account-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 12px;
}

.account-links a,
.account-links button {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.account-links button {
  color: var(--danger-text);
}
