/* ═══════════════════════════════════════════════
   AUTH MODAL — STYLES
   ═══════════════════════════════════════════════ */

/* Overlay backdrop */
.am-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.am-overlay.am-visible {
  opacity: 1;
  pointer-events: auto;
}
.am-overlay[hidden] { display: none !important; }

/* Card */
.am-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 28px;
  padding: 36px 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1);
  max-height: 94vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.am-overlay.am-visible .am-card {
  transform: translateY(0) scale(1);
}
.am-card::-webkit-scrollbar       { width: 4px; }
.am-card::-webkit-scrollbar-track { background: transparent; }
.am-card::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Close button */
.am-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}
.am-close:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: scale(1.08);
}

/* ── Spinner animation ──────────────────────── */
@keyframes am-rotate {
  to { transform: rotate(360deg); }
}
.am-spin-svg {
  animation: am-rotate 0.75s linear infinite;
  display: block;
}

/* ── Tab switcher ───────────────────────────── */
.am-tabs {
  display: flex;
  position: relative;
  background: #f1f5f9;
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 28px;
  gap: 2px;
}
.am-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 11px;
  color: #64748b;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.2s;
  position: relative;
  z-index: 1;
}
.am-tab.active { color: #0f172a; }
.am-tab-bar {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}
.am-tabs[data-tab="register"] .am-tab-bar {
  transform: translateX(calc(100% + 2px));
}

/* ── Panel ──────────────────────────────────── */
.am-panel { animation: am-fade-in 0.22s ease both; }
.am-panel-hidden { display: none !important; }
@keyframes am-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Brand icon */
.am-brand-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

/* Headings */
.am-panel-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
  text-align: center;
  letter-spacing: -0.3px;
}
.am-panel-sub {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 22px;
  text-align: center;
}

/* Alert */
.am-alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.5;
}
.am-alert.err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}
.am-alert.suc {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
}

/* Form fields */
.am-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.am-field { margin-bottom: 16px; }
.am-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.am-optional {
  font-size: 0.72rem;
  font-weight: 400;
  color: #94a3b8;
}
.am-forgot {
  font-size: 0.75rem;
  color: #16a34a;
  text-decoration: none;
  font-weight: 500;
}
.am-forgot:hover { text-decoration: underline; }

/* Inputs */
.am-pass-wrap { position: relative; }
.am-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  color: #0f172a;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.am-input:focus {
  border-color: #16a34a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}
.am-input.err {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}
.am-input::placeholder { color: #94a3b8; }

/* Password toggle */
.am-eye {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.am-eye:hover { color: #475569; }

/* Strength meter */
.am-strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.am-strength-bar {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.am-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.am-strength-lbl {
  font-size: 0.68rem;
  color: #64748b;
  white-space: nowrap;
  min-width: 44px;
  font-weight: 500;
}

/* Buttons */
.am-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
}
.am-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}
.am-btn-primary {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(22,163,74,0.3);
}
.am-btn-primary:hover:not(:disabled) {
  background: #15803d;
  box-shadow: 0 6px 18px rgba(22,163,74,0.35);
  transform: translateY(-1px);
}
.am-btn-primary:active:not(:disabled) { transform: translateY(0); }

.am-btn-logout {
  background: #fff;
  color: #dc2626;
  border: 1.5px solid #fca5a5;
  margin-top: 4px;
}
.am-btn-logout:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #ef4444;
}
.am-logout-icon { flex-shrink: 0; }

/* Switch hint */
.am-switch-hint {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  margin-top: 16px;
}
.am-link-btn {
  background: none;
  border: none;
  color: #16a34a;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.am-link-btn:hover { color: #15803d; }

/* ── Logged-in panel ─────────────────────────── */
.am-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
}
.am-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #16a34a;
}
.am-avatar-initials {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.02em;
}
.am-online-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}
.am-greeting {
  font-size: 0.82rem;
  color: #64748b;
  text-align: center;
  margin: 0 0 2px;
}
.am-name {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  text-align: center;
  margin: 0 0 4px;
}
.am-email {
  font-size: 0.82rem;
  color: #64748b;
  text-align: center;
  margin: 0 0 22px;
}

.am-account-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}
.am-acct-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #1e293b;
  text-decoration: none;
  transition: background 0.15s;
}
.am-acct-link:hover {
  background: #f1f5f9;
  color: #16a34a;
}
.am-link-ico {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  color: #475569;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.am-acct-link:hover .am-link-ico {
  background: #dcfce7;
  color: #16a34a;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 480px) {
  .am-card {
    padding: 28px 20px 22px;
    border-radius: 20px;
  }
  .am-panel-title { font-size: 1.3rem; }
  .am-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}