/**
 * PrintMoney — Premium Auth Page Styles
 * Trading terminal aesthetic: animated grid bg, frosted glass card, green accents
 */

/* ── Animated Background ──────────────────────────────────────────────────── */

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0a0e17;
}

.login-bg-grid {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image:
    linear-gradient(rgba(34, 197, 94, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridDrift 30s linear infinite;
}

@keyframes gridDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

.login-bg-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 800px;
  height: 800px;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    ellipse at center,
    rgba(34, 197, 94, 0.08) 0%,
    rgba(34, 197, 94, 0.03) 30%,
    transparent 70%
  );
  animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* Subtle price chart lines drifting across background */
.login-bg-lines {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.06;
}

.login-bg-lines svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
}

/* ── Auth Page Layout ─────────────────────────────────────────────────────── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
}

/* ── Frosted Glass Card ───────────────────────────────────────────────────── */

.auth-card {
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(34, 197, 94, 0.12);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(34, 197, 94, 0.04);
  animation: cardAppear 0.5s ease-out;
}

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

/* ── Branding ─────────────────────────────────────────────────────────────── */

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(59, 130, 246, 0.15));
  border: 2px solid rgba(34, 197, 94, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logoPulse 4s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { border-color: rgba(34, 197, 94, 0.3); box-shadow: 0 0 20px rgba(34, 197, 94, 0.05); }
  50% { border-color: rgba(34, 197, 94, 0.5); box-shadow: 0 0 30px rgba(34, 197, 94, 0.1); }
}

.logo-icon {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #22c55e, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-app-name {
  font-size: 24px;
  font-weight: 700;
  color: #e6edf3;
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}

.login-tagline {
  font-size: 13px;
  color: #8b949e;
  margin: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── Passkey Section ──────────────────────────────────────────────────────── */

#passkey-section {
  margin-bottom: 20px;
}

.btn-passkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #e6edf3;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-passkey:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(59, 130, 246, 0.2));
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.1);
}

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

.btn-passkey .passkey-icon {
  width: 22px;
  height: 22px;
  fill: #22c55e;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */

.login-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  gap: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(48, 54, 61, 0.8);
}

.login-divider span {
  font-size: 12px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

/* ── Auth Method Tabs ─────────────────────────────────────────────────────── */

.login-tabs {
  display: flex;
  gap: 4px;
  background: rgba(13, 17, 23, 0.6);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #8b949e;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-tab:hover {
  color: #e6edf3;
}

.login-tab.active {
  color: #e6edf3;
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ── Tab Content Panels ───────────────────────────────────────────────────── */

.login-tab-content {
  display: none;
  animation: tabFadeIn 0.25s ease-out;
}

.login-tab-content.active {
  display: block;
}

@keyframes tabFadeIn {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── Form Styles (premium upgrade) ────────────────────────────────────────── */

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: #e6edf3;
  background: rgba(13, 17, 23, 0.8);
  border: 1px solid rgba(48, 54, 61, 0.8);
  border-radius: 8px;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  font-family: inherit;
}

.form-group input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-group input::placeholder {
  color: #484f58;
}

/* ── Password Toggle ──────────────────────────────────────────────────────── */

.password-wrapper {
  position: relative;
}

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

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b949e;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: #e6edf3;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

/* ── Trust Device Checkbox ────────────────────────────────────────────────── */

.form-group-inline {
  margin-top: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #8b949e;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(48, 54, 61, 0.8);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.checkbox-label input:checked + .checkmark {
  background: #22c55e;
  border-color: #22c55e;
}

.checkbox-label input:checked + .checkmark::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

/* ── Error / Success States ───────────────────────────────────────────────── */

.form-error {
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
  margin-bottom: 16px;
  animation: errorAppear 0.3s ease-out;
}

.form-success {
  padding: 10px 14px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  color: #22c55e;
  font-size: 13px;
  margin-bottom: 16px;
}

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

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

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

/* ── Primary Button ───────────────────────────────────────────────────────── */

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: #22c55e;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary:hover {
  background: #16a34a;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-full { width: 100%; }

/* ── Loading Spinner ──────────────────────────────────────────────────────── */

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── PIN Pad ──────────────────────────────────────────────────────────────── */

.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 20px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(48, 54, 61, 0.8);
  background: transparent;
  transition: all 0.2s ease;
}

.pin-dot.filled {
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.pin-dot.error {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-key {
  width: 100%;
  aspect-ratio: 1.5;
  font-size: 22px;
  font-weight: 600;
  color: #e6edf3;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-family: inherit;
}

.pin-key:hover {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
}

.pin-key:active {
  transform: scale(0.93);
  background: rgba(34, 197, 94, 0.15);
}

.pin-key.pin-key-empty {
  visibility: hidden;
}

.pin-key.pin-key-action {
  font-size: 14px;
  color: #8b949e;
}

.pin-key.pin-key-action:hover {
  color: #e6edf3;
}

.pin-key.pin-key-action svg {
  width: 22px;
  height: 22px;
}

.pin-lockout {
  text-align: center;
  color: #ef4444;
  font-size: 13px;
  margin-top: 12px;
}

/* ── Setup page extras ────────────────────────────────────────────────────── */

.form-divider {
  display: flex;
  align-items: center;
  margin: 28px 0 20px;
  gap: 12px;
}

.form-divider::before,
.form-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(48, 54, 61, 0.8);
}

.form-divider span {
  font-size: 12px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.form-hint {
  display: block;
  font-size: 12px;
  color: #484f58;
  margin-top: 8px;
}

.pin-pad-small {
  max-width: 220px;
}

.pin-pad-small .pin-key {
  font-size: 18px;
  aspect-ratio: 1.8;
  border-radius: 8px;
}

.pin-display-small {
  gap: 8px;
  margin: 16px 0 12px;
}

.pin-display-small .pin-dot {
  width: 10px;
  height: 10px;
}

/* ── Settings sections ────────────────────────────────────────────────────── */

.settings-card {
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(48, 54, 61, 0.5);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #e6edf3;
  margin: 0 0 4px;
}

.settings-card p {
  font-size: 13px;
  color: #8b949e;
  margin: 0 0 16px;
}

.device-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

.device-item:last-child {
  border-bottom: none;
}

.device-info {
  flex: 1;
}

.device-name {
  font-size: 14px;
  color: #e6edf3;
  font-weight: 500;
}

.device-meta {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}

.btn-danger-sm {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger-sm:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #e6edf3;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

.credential-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

.credential-item:last-child {
  border-bottom: none;
}

.no-items {
  color: #484f58;
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

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

@media (max-width: 480px) {
  .auth-card {
    padding: 28px 20px;
  }
  .pin-pad {
    max-width: 240px;
  }
  .pin-key {
    font-size: 20px;
  }
}
