/* =========================
   GLOBAL FIXES (CRITICAL)
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden; /* 🔥 removes right-side gap */
}

/* =========================
   ROOT / SCALE
========================= */

html {
  font-size: 16px;
}

/* =========================
   BASE / GLOBAL
========================= */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f3f4f6;
  margin: 0;
  padding-top: 1.25rem;
}

/* =========================
   APP CONTAINER
========================= */

.app-container {
  width: 100%;
  max-width: 56.25rem; /* 900px */
  margin: 0 auto;      /* ✅ correct centering */
  min-height: 28rem;
  background: #ffffff;
  padding: 2.25rem 2.75rem 2.75rem;
  border-radius: 1.375rem;
  box-shadow: 0 0.625rem 1.875rem rgba(0,0,0,0.12);
  position: relative;
}

/* =========================
   HEADINGS
========================= */

h2 {
  text-align: center;
  margin-bottom: 0.4rem;
  font-size: 1.5rem;
  font-weight: 800;
}

.subtitle {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
}

/* =========================
   HEADER
========================= */

.user-menu-wrapper {
  position: absolute;
  top: 1.25rem;
  left: 1.75rem;
  cursor: pointer;
}

.avatar-circle {
  width: 2.375rem;
  height: 2.375rem;
  background: #2563eb;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.user-dropdown {
  position: absolute;
  top: 3rem;
  left: 0;
  background: #ffffff;
  width: 11.25rem;
  border-radius: 0.625rem;
  box-shadow: 0 0.5rem 1.25rem rgba(0,0,0,0.15);
  padding: 0.4rem 0;
  display: none;
  z-index: 1000;
}

.user-dropdown a {
  display: block;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: #374151;
  text-decoration: none;
}

.user-dropdown a:hover {
  background: #f3f4f6;
}

.guest-links-topright {
  position: absolute;
  top: 1.625rem;
  right: 1.875rem;
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}

.guest-links-topright a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.guest-links-topright a:hover {
  color: #16a34a;
}

/* =========================
   AUTH CARD
========================= */

.auth-card {
  margin: 2rem auto 0;
  width: 100%;
  max-width: 26.25rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 1.125rem;
  padding: 1.6rem;
}

/* =========================
   TABS
========================= */

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.auth-tab {
  flex: 1;
  padding: 0.7rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-tab.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-color: #2563eb;
}

/* =========================
   FORM
========================= */

.form-group {
  margin-bottom: 1rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.3rem;
  display: block;
}

input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  font-size: 1rem;
}

/* =========================
   BUTTON
========================= */

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 999px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

/* =========================
   ERROR
========================= */

.error-message {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  text-align: center;
  display: none;
}

/* =========================
   MODALS
========================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 1rem;
  width: 90%;
  max-width: 32.5rem;
  position: relative;
}

.closeModal {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 1.4rem;
  cursor: pointer;
}

/* =========================
   MOBILE — FIXED & CLEAN
========================= */

@media (max-width: 768px) {

  body {
    padding: 0;
  }

  .app-container {
    max-width: 100%;
    min-height: 100vh;
    padding: 1.75rem 1.25rem 2.25rem;
    border-radius: 0;
    box-shadow: none;
  }

  h2 {
    font-size: 1.65rem;
  }

  .subtitle {
    font-size: 1rem;
    margin-bottom: 1.75rem;
  }

/* ===== MOBILE AVATAR POSITION TWEAK ===== */

.user-menu-wrapper {
  position: relative;
  margin: 0.5rem -1rem -0.75rem;  /* move block slightly UP */
  padding-left: 0.25rem;       /* allow closer to left edge */
}

.avatar-circle {
  margin-left: -0.25rem;       /* push further LEFT */
}

  
  /* Center the links nicely BELOW avatar */
  .guest-links-topright {
    position: relative;
    top: auto;
    right: auto;
  
    display: flex;
    justify-content: right;
    align-items: center;
    gap: 1.25rem;
  
    margin: 0.5rem 0 1.5rem 0;
    font-size: 0.95rem;
  }
  

  .auth-card {
    max-width: 100%;
    padding: 1.75rem 1.5rem;
    border-radius: 1.25rem;
    box-shadow: 0 0.75rem 2rem rgba(0,0,0,0.12);
  }

  .auth-tab {
    font-size: 1rem;
    padding: 0.9rem;
  }

  label {
    font-size: 0.95rem;
  }

  input {
    font-size: 1.125rem;
    padding: 0.9rem 1rem;
  }

  .btn-primary {
    font-size: 1.125rem;
    padding: 1rem;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  .guest-links-topright a {
    font-weight: 600;
  }
}
