:root {
  /* Palette - Slate Tones (Matching Dashboard) */
  --bg-body: #f8fafc;
  --bg-white: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  /* UI Elements */
  --radius-xl: 2.5rem;
  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 20px 40px -10px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  /* Changed from overflow: hidden to allow vertical scrolling */
  overflow-y: auto;
  position: relative;
  padding: 2rem 0;
  /* Add vertical padding to prevent edge clipping on small screens */
}

/* Ambient Background Shapes */
.ambient-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  animation: float 20s infinite ease-in-out;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: rgba(79, 70, 229, 0.08);
  top: -100px;
  left: -100px;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: rgba(16, 185, 129, 0.08);
  bottom: -50px;
  right: -50px;
  animation-delay: -5s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(30px, 50px);
  }
}

/* --- Toast System (Reused) --- */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
  align-items: center;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  color: white;
  padding: 14px 24px;
  border-radius: 99px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  transform: translateY(-50px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon.success {
  color: #34d399;
}

.toast-icon.error {
  color: #ef4444;
}

/* --- Auth Card --- */
.auth-wrapper {
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  perspective: 1000px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid #ffffff;
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-float);
  position: relative;
  overflow: hidden;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 2.5rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: var(--primary);
  color: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.3);
}

.brand-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

/* --- Form Views --- */
.auth-view {
  display: none;
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.view-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  text-align: center;
}

.view-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
  transition: transform 0.2s;
}

.input-wrapper:focus-within {
  transform: translateY(-2px);
}

.input-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  transition: color 0.2s;
}

.form-input {
  width: 100%;
  padding: 1.1rem 1.25rem 1.1rem 3.5rem;
  border-radius: 1.25rem;
  border: 2px solid #f1f5f9;
  background: #f8fafc;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
}

.form-input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input:focus + .input-icon {
  color: var(--primary);
}

.form-input::placeholder {
  color: #cbd5e1;
}

.forgot-link {
  display: block;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.5rem;
  margin-top: -0.5rem;
  transition: color 0.2s;
  cursor: pointer;
}

.forgot-link:hover {
  color: var(--primary);
}

.btn-submit {
  width: 100%;
  padding: 1.1rem;
  border-radius: 1.25rem;
  border: none;
  background: var(--text-main);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.4);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit.loading {
  opacity: 0.8;
  pointer-events: none;
}

.auth-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-switch-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-size: inherit;
  margin-left: 4px;
}

.auth-switch-btn:hover {
  text-decoration: underline;
}

/* Spinner for loading state */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.loading .spinner {
  display: block;
}

.loading span {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Media Queries */
@media (max-width: 480px) {
  .auth-wrapper {
    padding: 1rem;
  }

  .auth-card {
    padding: 2rem 1.5rem;
  }
}

.loader {
  color: #cdcdcd;
  font-size: 45px;
  text-indent: -9999em;
  overflow: hidden;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  position: relative;
  transform: translateZ(0);
  animation:
    mltShdSpin 1.5s infinite ease,
    round 1.5s infinite ease;
}

@keyframes mltShdSpin {
  0% {
    box-shadow:
      0 -0.83em 0 -0.4em,
      0 -0.83em 0 -0.42em,
      0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em,
      0 -0.83em 0 -0.477em;
  }
  5%,
  95% {
    box-shadow:
      0 -0.83em 0 -0.4em,
      0 -0.83em 0 -0.42em,
      0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em,
      0 -0.83em 0 -0.477em;
  }
  10%,
  59% {
    box-shadow:
      0 -0.83em 0 -0.4em,
      -0.087em -0.825em 0 -0.42em,
      -0.173em -0.812em 0 -0.44em,
      -0.256em -0.789em 0 -0.46em,
      -0.297em -0.775em 0 -0.477em;
  }
  20% {
    box-shadow:
      0 -0.83em 0 -0.4em,
      -0.338em -0.758em 0 -0.42em,
      -0.555em -0.617em 0 -0.44em,
      -0.671em -0.488em 0 -0.46em,
      -0.749em -0.34em 0 -0.477em;
  }
  38% {
    box-shadow:
      0 -0.83em 0 -0.4em,
      -0.377em -0.74em 0 -0.42em,
      -0.645em -0.522em 0 -0.44em,
      -0.775em -0.297em 0 -0.46em,
      -0.82em -0.09em 0 -0.477em;
  }
  100% {
    box-shadow:
      0 -0.83em 0 -0.4em,
      0 -0.83em 0 -0.42em,
      0 -0.83em 0 -0.44em,
      0 -0.83em 0 -0.46em,
      0 -0.83em 0 -0.477em;
  }
}

@keyframes round {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.page-loader {
  background-color: #f8fafc;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-loader::after {
  content: "HASHMINER";
  font-size: 20px;
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translate(-50%);
  color: #dadada;
  font-weight: bold;
}

.page-loader::before {
  content: "Powered by";
  font-size: 16px;
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translate(-50%);
  color: #dadada;
}

.page-loader.light-load {
  background-color: #3d3d3d94;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

html,
body {
  touch-action: manipulation;
}
