/* ==========================================================
   auth.css — Login/Register modal + account menu
   Append this file's <link> after main.css on every page,
   or merge its contents into main.css if you prefer one file.
   Uses the same CSS custom properties already defined in
   main.css (--blue, --blue-dark, --blue-light, --text, etc.)
   with safe fallbacks in case a token isn't present.
   ========================================================== */

/* ── Sign In trigger button (desktop nav) ───────────────── */
.btn-signin {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Account menu (logged-in state) ──────────────────────── */
.account-menu {
  position: relative;
}
.account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #1a1a1a);
  transition: border-color .15s, box-shadow .15s;
}
.account-trigger:hover {
  border-color: rgba(0,0,0,.22);
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue, #1457c0);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  text-transform: uppercase;
}
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-trigger svg {
  flex-shrink: 0;
  transition: transform .15s;
  color: #9CA3AF;
}
.account-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
  border: 1px solid rgba(0,0,0,.06);
  min-width: 220px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 200;
}
.account-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.account-dropdown-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid #F0F2F5;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-dropdown-head strong {
  font-size: 14px;
  color: var(--text, #1a1a1a);
}
.account-dropdown-head span {
  font-size: 12px;
  color: var(--text-muted, #888);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-dropdown a,
.account-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text, #1a1a1a);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
.account-dropdown a:hover,
.account-dropdown button:hover {
  background: #F5F7FA;
}
.account-dropdown button#logoutBtn {
  color: #C0392B;
}

/* ══════════════════════════════════════════════════════════
   MODAL OVERLAY + CARD
   ══════════════════════════════════════════════════════════ */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
  padding: 20px;
}
.auth-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.auth-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: scale(.96) translateY(8px);
  transition: transform .18s ease;
  max-height: 92vh;
  overflow-y: auto;
}
.auth-modal-overlay.open .auth-modal {
  transform: scale(1) translateY(0);
}

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #F5F7FA;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #666;
  transition: background .15s;
}
.auth-modal-close:hover { background: #E8ECF0; }

.auth-modal-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.auth-modal-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--blue, #1457c0);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-modal-logo-icon svg { width: 26px; height: 26px; }

.auth-modal-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text, #1a1a1a);
  margin: 0 0 6px;
}
.auth-modal-sub {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted, #888);
  margin: 0 0 20px;
  line-height: 1.4;
}

/* ── Tabs ─────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  background: #F0F2F5;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted, #888);
  padding: 9px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab.active {
  background: #fff;
  color: var(--blue, #1457c0);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ── Social buttons ──────────────────────────────────── */
.auth-social {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1.5px solid #E5E9F0;
  background: #fff;
  border-radius: 10px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #1a1a1a);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.auth-social-btn:hover {
  background: #F8F9FB;
  border-color: #D5DAE3;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #B0B6C0;
  font-size: 12px;
  margin-bottom: 16px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #EEF1F5;
}
.auth-divider span { padding: 0 12px; }

/* ── Error banner ─────────────────────────────────────── */
.auth-error {
  background: #FDECEA;
  color: #C0392B;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ── Form ─────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #1a1a1a);
}
.auth-field input {
  border: 1.5px solid #E5E9F0;
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text, #1a1a1a);
  transition: border-color .15s;
  outline: none;
}
.auth-field input:focus {
  border-color: var(--blue, #1457c0);
}
.auth-submit {
  background: var(--blue, #1457c0);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  transition: background .15s, opacity .15s;
}
.auth-submit:hover { background: var(--blue-dark, #0f4399); }
.auth-submit:disabled { opacity: .65; cursor: default; }

.auth-modal-foot {
  text-align: center;
  font-size: 11.5px;
  color: #ABB1BC;
  margin: 18px 0 0;
  line-height: 1.5;
}
.auth-modal-foot a {
  color: var(--blue, #1457c0);
  text-decoration: none;
}
.auth-modal-foot a:hover { text-decoration: underline; }

/* ── Highlight active nav link (optional, used by header.php) ── */
.nav-links a.nav-active {
  color: var(--blue, #1457c0);
  font-weight: 700;
}

/* ── Mobile tweaks ────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-modal { padding: 26px 20px 20px; border-radius: 16px; }
  .account-name { display: none; }
}
