/* ==========================================================================
   Tokens / Reset
========================================================================== */
:root {
  --navbar-h: 56px;
  /* match your navbar height */
  --bg: #f5f5f5;
  --card: #fff;
  --text: #333;
  --muted: #555;

  --primary: #2196F3;
  --primary-hover: #0b7dda;
  --primary-active: #065a9e;

  --neutral: #ccc;
  --neutral-hover: #aaa;

  --border: #ccc;
  --shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

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

/* ==========================================================================
   Base Layout
========================================================================== */
/* layout baseline (you already have most of this) */
html,
body {
  font-family: Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* header sits at the top */
header {
  flex: 0 0 auto;
}

/* main content fills the space */
#content {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* prevents flex overflow */
}

/* footer gets pushed to the bottom when content is short */
footer {
  margin-top: auto;
}

#resendVerification {
  padding: 10px 12px;
  border: 1px solid var(--neutral);
  background: #fafafa;
  border-radius: 6px;
  cursor: pointer;
  color: #333;
  font-size: 14px;
  transition: all 0.2s ease;
}

#resendVerification:hover:not(:disabled) {
  background: #f0f0f0;
}

#resendVerification:disabled {
  background: #e0e0e0;
  border-color: #ccc;
  color: #888;
  cursor: not-allowed;
  opacity: 0.7;
}



@supports (height:100svh) {
  body {
    min-height: 100svh;
  }

  /* iOS URL bar safe height */
}

/* Header spans full width so the hamburger sits ABOVE the form on mobile */
header {
  width: 100%;
  flex: 0 0 auto;
}

/* Reserve space for the fixed navbar ONLY on desktop */
@media (min-width:769px) {
  body::before {
    content: "";
    display: block;
    height: var(--navbar-h);
    /* push content below fixed navbar */
    flex: 0 0 auto;
  }
}

/* No navbar offset on mobile (navbar is relative there) */
@media (max-width:768px) {
  body::before {
    content: none;
  }
}

/* Small, consistent breathing room under nav */
.login-container {
  margin-top: 16px;
}


/* ==========================================================================
   Cards
========================================================================== */
.login-container,
.signup-container {
  background-color: var(--card);
  padding: 40px 30px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin-inline: auto;
}

.login-container h2 {
  margin-bottom: 5px;
}

h3 {
  margin-top: 0;
}

/* Smaller padding on very small screens */
@media (max-width:480px) {

  .login-container,
  .signup-container {
    padding: 20px 15px;
  }
}

/* ==========================================================================
   Form Elements
========================================================================== */
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

input[type="email"]:focus-visible,
input[type="password"]:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(33, 150, 243, .2);
}

/* Buttons */
button {
  width: 100%;
  padding: 12px;
  background-color: var(--primary);
  border: none;
  color: #fff;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
  transition: background-color .3s ease;
}

button:hover {
  background-color: var(--primary-hover);
}

button:active {
  background-color: var(--primary-active);
}

button:focus-visible {
  outline: 2px solid rgba(33, 150, 243, .6);
  outline-offset: 2px;
}

/* Secondary actions */
button#goBackLogin,
button#goToSettings {
  background-color: var(--neutral);
  color: var(--text);
}

button#goBackLogin:hover,
button#goToSettings:hover {
  background-color: var(--neutral-hover);
}

button#goBackLogin:active,
button#goToSettings:active {
  background-color: #8d99ae;
  color: #fff;
  border-color: #6c757d;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .15) inset;
}

/* Make the app area a flex column so children can auto-center */
#app {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}


#loggedInActions {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 100%;
  max-width: 400px;
}



#loggedInActions button {
  width: 100%;
  margin-top: 10px;
  max-width: 300px;
}
#logout{
  background-color: #e53935;
}

#logout:hover {
  background-color: #cc0000;
  border-color: #a30000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}

#logout:active {
  background-color: #8d99ae;
  color: #fff;
  border-color: #6c757d;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .15) inset;
}

/* ==========================================================================
   Messaging
========================================================================== */
.error-message {
  color: red;
  margin-top: 10px;
  font-size: 14px;
}

.message {
  margin-top: 10px;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  transition: opacity .3s ease;
}

/* ==========================================================================
   Misc Content
========================================================================== */
#newHere {
  color: var(--muted);
  padding-top: 50px;
  display: block;
  text-align: left;
}

#signup {
  color: #007bff;
  text-decoration: underline;
}

#signup:hover {
  color: #0056b3;
}

#secondTitle {
  font-style: italic;
  border-top: 2px solid var(--muted);
  margin-top: 30px;
  padding-top: 30px;
}

img {
  max-width: 200px;
  width: 45%;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, .2);
  margin-bottom: -10px;
}

@media (max-width:480px) {
  img {
    width: 60%;
  }
}

#logout {
  padding-top: 10px;
}

/* ==========================================================================
   Loading Screen (above nav)
========================================================================== */
#loadingScreen {
  position: fixed;
  inset: 0;
  /* top:0; right:0; bottom:0; left:0 */
  width: 100%;
  height: 100vh;
  background: #fff;
  z-index: 9999;
  /* above nav */

  display: flex;
  /* new */
  align-items: center;
  /* new: vertical centering */
  justify-content: center;
  /* new: horizontal centering */
  text-align: center;
  /* safe: if multiline */
}

@supports (height:100svh) {
  #loadingScreen {
    height: 100svh;
  }
}

/* ==========================================================================
   Reduced Motion
========================================================================== */
@media (prefers-reduced-motion:reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Page-specific: Login layout normalization with :has()
   (Keeps spacing sane ONLY when the login card is present)
========================================================================== */
body:has(.login-container) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start !important;
  padding-top: 0 !important;
}

/* kill any accidental spacer from earlier experiments */
body:has(.login-container)::before {
  content: none !important;
}

/* header should not create extra space */
body:has(.login-container) header {
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

/* desktop: put the card just below the fixed navbar */
@media (min-width:769px) {
  :root {
    --navbar-h: 56px;
  }

  /* adjust if your nav is taller */
  body:has(.login-container) .login-container {
    margin-top: calc(var(--navbar-h) + 16px) !important;
  }
}

/* mobile: navbar is relative; just a small top margin */
@media (max-width:768px) {
  body:has(.login-container) .login-container {
    margin-top: 16px !important;
  }
}


/* Apply the same layout normalization to signup & logout views */
body:has(.signup-container),
body:has(#loggedInActions),
body:has(#logout) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start !important;
  padding-top: 0 !important;
}

/* Kill any spacer */
body:has(.signup-container)::before,
body:has(#loggedInActions)::before,
body:has(#logout)::before {
  content: none !important;
}

/* Header shouldn’t add space on these pages either */
body:has(.signup-container) header,
body:has(#loggedInActions) header,
body:has(#logout) header {
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

/* Desktop: put the card just below the fixed navbar */
@media (min-width: 769px) {

  /* if your nav height changes, adjust var(--navbar-h) */
  :root {
    --navbar-h: 56px;
  }

  /* login, signup, and logout-like cards share the same top offset */
  body:has(.login-container) :is(.login-container),
  body:has(.signup-container) :is(.signup-container),
  body:has(#logout) :is(#logout) {
    margin-top: calc(var(--navbar-h) + 16px) !important;
  }
}

/* Mobile: small, consistent top margin */
@media (max-width: 768px) {

  body:has(.login-container) :is(.login-container),
  body:has(.signup-container) :is(.signup-container),
  body:has(#logout) :is(#logout) {
    margin-top: 16px !important;
  }
}