/* ============================================================
   SHIPFLEE — MODERN AUTHENTICATION STYLESHEET (auth.css)
   Clean • Executive • Fluid Micro-Animations • Highly Responsive
   Zero breaking changes • Fully compatible with Firebase Hosting
   ============================================================ */

/* ===== DESIGN TOKENS (Matching UserMain.css & Wallet) ===== */
:root {
  --primary: #1e88e5;
  --primary-hover: #1565c0;
  --primary-light: #e3f2fd;
  --primary-glow: rgba(30, 136, 229, 0.22);
  --primary-focus: rgba(30, 136, 229, 0.15);

  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --warning: #f59e0b;
  --warning-bg: #fffbeb;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --bg-input-focus: #ffffff;

  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 12px 36px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.03), 0 0 0 1px rgba(226, 232, 240, 0.8);
  --shadow-btn: 0 4px 14px 0 rgba(30, 136, 229, 0.35);
  --shadow-btn-hover: 0 6px 20px 0 rgba(30, 136, 229, 0.45);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BASE RESET & TYPOGRAPHY ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-page);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* ===== AMBIENT BACKGROUND GLOW ===== */
.auth-bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.auth-blob-1 {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, rgba(30, 136, 229, 0.28) 0%, rgba(30, 136, 229, 0) 70%);
  top: -120px;
  right: -80px;
  animation-duration: 20s;
}

.auth-blob-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0) 70%);
  bottom: 80px;
  left: -100px;
  animation-duration: 24s;
  animation-delay: -5s;
}

.auth-blob-3 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.18) 0%, rgba(14, 165, 233, 0) 70%);
  top: 45%;
  left: 55%;
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  50% {
    transform: translate(25px, -35px) scale(1.08);
  }
  100% {
    transform: translate(-30px, 20px) scale(0.95);
  }
}

/* ===== MAIN CONTENT WRAPPER ===== */
.auth-main-wrapper {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 48px;
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ===== FLOATING ERROR / SUCCESS NOTIFICATION TOAST (#error, #p) ===== */
#error {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  width: calc(100% - 32px);
  max-width: 440px;
  box-sizing: border-box;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  box-shadow: 0 10px 25px -3px rgba(239, 68, 68, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  display: none;
  animation: slideDownToast 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

#error.success {
  color: var(--success-text);
  border-color: var(--success-border);
  background: var(--success-bg);
  box-shadow: 0 10px 25px -3px rgba(16, 185, 129, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#error.error {
  color: var(--danger-text);
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

#error #p {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  margin: 0;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
}

#error #p::before {
  content: "⚠️";
  font-size: 16px;
  flex-shrink: 0;
}

#error.success #p::before {
  content: "✅";
}

/* Verification buttons & loaders inside #error */
#error #loader1 {
  margin: 10px auto 0;
  display: none;
}

#error #buttond {
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--primary) !important;
  color: #ffffff !important;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px !important;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

#error #buttond:hover:not(:disabled) {
  background: var(--primary-hover) !important;
}

#error #buttond:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes slideDownToast {
  0% {
    opacity: 0;
    transform: translate(-50%, -16px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* ===== AUTH CARD CONTAINER (#div3 for signin, #div for signup) ===== */
#div3, #div {
  background: var(--bg-card);
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
  padding: 38px 36px 36px;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 10;
  transition: box-shadow 0.3s ease;
  animation: cardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes cardFadeIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== BRAND HEADER & LOGO ===== */
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

#p2 {
  text-align: center;
  margin: 0 0 16px 0;
  line-height: 1;
  position: static;
  bottom: auto;
  font-size: 100%;
}

#logocrop {
  height: 40px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: inline-block;
  margin: 0 auto;
  border-radius: 0;
  position: static;
  transition: transform 0.25s ease;
}

#logocrop:hover {
  transform: scale(1.02);
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.4;
}

/* ===== FORM FIELDS & INPUTS ===== */
.sf-form-group {
  margin-bottom: 18px;
  position: relative;
  text-align: left;
}

.sf-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.sf-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.sf-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: color 0.2s ease;
  z-index: 2;
}

/* Inputs styling: #emailq, #pass, #name, #email, #password1, #password2 */
#emailq, #pass, #name, #email, #password1, #password2, .input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px 12px 42px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  font-weight: 400;
  line-height: 1.5;
  transform: none !important;
}

#emailq::placeholder, #pass::placeholder, #name::placeholder, #email::placeholder, #password1::placeholder, #password2::placeholder, .input::placeholder {
  color: var(--text-light);
  font-weight: 400;
}

#emailq:focus, #pass:focus, #name:focus, #email:focus, #password1:focus, #password2:focus, .input:focus {
  border-color: var(--primary) !important;
  background-color: var(--bg-input-focus);
  box-shadow: 0 0 0 3.5px var(--primary-focus);
}

.sf-input-wrap:focus-within .sf-input-icon {
  color: var(--primary);
}

/* Single line password wrapper with toggle icon */
#singleline {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

#singleline input {
  padding-right: 44px;
}

/* Visibility toggle icons */
#eyee, #passshow {
  position: absolute;
  right: 13px;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background-color 0.2s ease;
  z-index: 2;
}

#eyee:hover, #passshow:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Break tag removal from layout interference */
#div3 br, #div br {
  display: none;
}

/* ===== FORGOT PASSWORD ROW (#forgotPassBtn, #loader2) ===== */
.forgot-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: -8px;
  margin-bottom: 20px;
  gap: 8px;
}

#forgotPassBtn, .forgot-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
  margin: 0;
}

#forgotPassBtn:hover, .forgot-btn:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.forgot-wrapper #loader2 {
  display: none;
  width: 18px;
  height: 18px;
}

.forgot-wrapper #loader2 div {
  width: 14px;
  height: 14px;
  margin: 2px;
  border: 2px solid var(--primary);
  border-color: var(--primary) transparent transparent transparent;
}

/* ===== PASSWORD GENERATOR SLIDER (SignUp: #changee, #slider, #range, #numbershow) ===== */
#changee {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  margin: -4px 0 16px 0;
  width: auto !important;
  transition: color 0.2s ease;
  user-select: none;
}

#changee:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

#changee::before {
  content: "⚡";
  font-size: 14px;
}

#slider {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  animation: sliderSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sliderSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.slider-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

#range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #cbd5e1;
  outline: none;
  margin: 0 !important;
  cursor: pointer;
  transition: background 0.2s ease;
}

#range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 136, 229, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

#range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--primary-hover);
}

#range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 136, 229, 0.4);
  border: none;
}

#numbershow {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  position: static !important;
  top: auto !important;
  margin-left: 0 !important;
}

/* Action button area in signup (#did) */
#did {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

/* ===== PRIMARY ACTION BUTTONS (#button1 for signin, #button for signup) ===== */
#button1, #button, .sf-primary-btn {
  width: 100% !important;
  padding: 13px 20px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%) !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  cursor: pointer !important;
  box-shadow: var(--shadow-btn) !important;
  transition: var(--transition) !important;
  outline: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  text-align: center;
}

#button1:hover, #button:hover, .sf-primary-btn:hover {
  background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%) !important;
  box-shadow: var(--shadow-btn-hover) !important;
  transform: translateY(-1.5px) !important;
}

#button1:active, #button:active, .sf-primary-btn:active {
  transform: translateY(1px) scale(0.99) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* ===== DIVIDER ===== */
.sf-auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 22px 0;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sf-auth-divider::before,
.sf-auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border-light);
}

.sf-auth-divider span {
  padding: 0 12px;
}

/* Legacy #p5 removal of weird underline */
#p5 {
  display: none;
}

/* ===== GOOGLE SIGN-IN BUTTON (#gogl) ===== */
.google-btn-wrapper {
  width: 100%;
  margin-bottom: 4px;
}

#gogl, .googlel {
  width: 100% !important;
  height: 46px !important;
  padding: 10px 18px !important;
  border: 1.5px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  background-color: #ffffff !important;
  color: var(--text-body) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  transition: var(--transition) !important;
  outline: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  user-select: none;
  box-sizing: border-box;
}

#gogl:hover, .googlel:hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07) !important;
  transform: translateY(-1px) !important;
}

#gogl:active, .googlel:active {
  transform: translateY(1px) scale(0.99) !important;
}

.google-icon-svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  display: block;
}

/* ===== AUTH SWITCH LINK (#p4, #span) ===== */
#p4 {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 22px;
  margin-bottom: 0;
}

#span {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
  margin-left: 4px;
}

#span:hover {
  color: var(--primary-hover);
  text-decoration: underline !important;
}

/* ===== LOADERS (.lds-ring, #loader, #loader1, #loader2) ===== */
.lds-ring {
  display: inline-block;
  position: relative;
  width: 24px;
  height: 24px;
}

.lds-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 20px;
  height: 20px;
  margin: 2px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-color: var(--primary) transparent transparent transparent;
}

.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes lds-ring {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Global Centered Loader (#loader) when active */
#loader {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 999999 !important;
  width: 44px !important;
  height: 44px !important;
  margin: 0 !important;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  box-sizing: content-box;
}

#loader div {
  width: 36px;
  height: 36px;
  margin: 4px;
  border-width: 3px;
  border-color: var(--primary) transparent transparent transparent;
}

/* ===== FOOTER STYLES (Matching Dashboard / Production) ===== */
.footer {
  background: #0f172a;
  color: #cbd5f5;
  padding: 60px 24px 30px;
  margin-top: 40px;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
}

.footer-container {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 48px;
  flex-wrap: wrap;
}

.footer-brand {
  max-width: 340px;
}

.footer-brand .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

#footeri {
  width: 110px;
  height: auto;
  border-radius: 6px;
}

.footer-brand p {
  font-size: 13.5px;
  line-height: 1.6;
  color: #94a3b8;
  margin-bottom: 16px;
}

.socials {
  display: flex;
  gap: 12px;
}

.socials a {
  color: #cbd5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  transition: var(--transition);
  text-decoration: none;
}

.socials a:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-2px);
}

.footer-col {
  min-width: 140px;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.footer-col a {
  display: block;
  font-size: 13.5px;
  color: #94a3b8;
  text-decoration: none;
  margin-bottom: 10px;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: #ffffff;
}

.footer-bottom {
  max-width: 1140px;
  margin: 36px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: #94a3b8;
  flex-wrap: wrap;
  gap: 10px;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (max-width: 768px) {
  .auth-main-wrapper {
    padding: 24px 16px 36px;
  }

  .footer-container {
    flex-direction: column;
    gap: 32px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  #div3, #div {
    padding: 28px 20px 24px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(226, 232, 240, 0.8);
  }

  .auth-title {
    font-size: 21px;
  }

  .auth-subtitle {
    font-size: 13px;
  }

  #emailq, #pass, #name, #email, #password1, #password2, .input {
    padding: 11px 12px 11px 38px;
    font-size: 13.5px;
  }

  .sf-input-icon {
    left: 12px;
    width: 18px;
    height: 18px;
  }

  #button1, #button {
    padding: 12px 16px !important;
    font-size: 14.5px !important;
  }

  #gogl, .googlel {
    height: 44px !important;
    font-size: 13.5px !important;
  }

  #error {
    width: calc(100% - 24px);
    top: 16px;
    padding: 12px 14px;
  }
}

@media (max-width: 340px) {
  #div3, #div {
    padding: 22px 14px 20px;
  }

  .auth-title {
    font-size: 19px;
  }
}
