/* Mobile-First Auth Pages */
:root {
  --auth-yellow: #FFC107;
  --auth-dark: #121212;
  --auth-gray: #f5f5f7;
  --auth-border: #e0e0e0;
}

body.auth-page {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--auth-gray);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.auth-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  height: 100dvh;
  position: relative;
  overflow-y: auto; /* Allow scrolling gracefully ONLY if it absolutely overflows */
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* Login specific header */
.auth-header-login {
  position: relative;
  height: 38vh;
  min-height: 220px;
  background-image: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.8)), url('/images/auth-bg.jpg');
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 30px 20px 15px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.auth-header-login .logo {
  text-align: center;
  margin-bottom: 10px;
}
.auth-header-login .logo img {
  height: 40px;
  filter: brightness(0) invert(1); /* Ensure the black logo becomes pure white */
}

.auth-header-login h1 {
  font-size: 1.4rem;
  margin: 0 0 6px 0;
  font-weight: 700;
  line-height: 1.2;
}
.auth-header-login h1 span {
  color: var(--auth-yellow);
}

.auth-header-login p {
  font-size: 0.8rem;
  opacity: 0.9;
  margin: 0;
  max-width: 250px;
}

/* Curved bottom for header */
.auth-curve-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: #fff;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
}

/* Register specific header */
.auth-header-register {
  padding: 15px 15px 5px;
  background: #fff;
  text-align: center;
  position: relative;
}
.auth-back-btn {
  position: absolute;
  top: 15px;
  left: 15px;
  color: #000;
  text-decoration: none;
  font-size: 1.5rem;
}
.auth-header-register .logo img {
  height: 40px;
}
.auth-header-register h1 {
  font-size: 1.3rem;
  margin: 10px 0 5px 0;
  font-weight: 700;
}
.auth-header-register p {
  color: #666;
  font-size: 0.75rem;
  margin: 0 auto;
  max-width: 280px;
  line-height: 1.2;
}

/* Form Area */
.auth-form-area {
  padding: 5px 20px 15px;
  background: #fff;
  flex: 1;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  margin-top: -20px;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
}
.auth-form-area.flex-grow {
  justify-content: flex-start;
}

.auth-form-area h2 {
  font-size: 1.4rem;
  margin: 0 0 5px 0;
}
.auth-form-area p.sub-heading {
  color: #666;
  margin: 0 0 12px 0;
  font-size: 0.8rem;
}

.auth-input-group {
  position: relative;
  margin-bottom: 10px;
}

.auth-input-group .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.auth-input-group input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  font-size: 0.85rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.3s;
}
.auth-input-group input:focus {
  border-color: #000;
}

.auth-input-group .toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0;
  display: flex;
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.75rem;
}

.auth-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #333;
}
.auth-options input[type="checkbox"] {
  accent-color: var(--auth-yellow);
  width: 14px;
  height: 14px;
}
.auth-options a {
  color: var(--auth-yellow);
  text-decoration: none;
  font-weight: 500;
}

.auth-btn {
  width: 100%;
  padding: 10px;
  background: var(--auth-yellow);
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  transition: opacity 0.3s;
}
.auth-btn:active {
  opacity: 0.8;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #999;
  font-size: 0.7rem;
  margin-bottom: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #eee;
}
.auth-divider::before { margin-right: .5em; }
.auth-divider::after { margin-left: .5em; }

.social-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.social-btn {
  width: 100%;
  padding: 10px;
  border: 1px solid #eee;
  background: #fff;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  color: #333;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.social-btn:hover {
  opacity: 0.85;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.social-btn.apple {
  background: #000;
  color: #fff;
  border-color: #000;
}
.social-btn img, .social-btn svg {
  width: 16px;
  height: 16px;
}

.auth-footer-link {
  text-align: center;
  font-size: 0.8rem;
  margin-top: auto;
  padding-top: 10px;
  color: #666;
}
.auth-footer-link a {
  color: var(--auth-yellow);
  text-decoration: none;
  font-weight: 600;
}

/* Trust card for register bottom */
.trust-card {
  background: #fdfaf0;
  border-radius: 12px;
  padding: 10px 15px;
  margin: 5px 15px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.trust-card h3 {
  margin: 0;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trust-features {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #555;
  text-align: center;
}
.trust-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.trust-feature svg {
  width: 16px;
  height: 16px;
}

.register-bottom-img {
  position: relative;
  height: 60px;
  flex-shrink: 0;
  background-image: url('/images/auth-bg.jpg');
  background-size: cover;
  background-position: bottom;
  margin-top: auto;
}
.register-bottom-img::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom, #fff, transparent);
}
.register-bottom-img img {
  position: absolute;
  bottom: 5px;
  right: 15px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* Extremely small screens (e.g., height < 700px) */
@media (max-height: 700px) {
  .trust-card { display: none; }
  .auth-header-login { height: 30vh; min-height: 200px; padding-top: 15px; }
  .register-bottom-img { height: 40px; }
  .auth-input-group { margin-bottom: 8px; }
}

/* Tablet and Desktop adjustments */
@media (min-width: 600px) {
  body.auth-page {
    padding: 40px 20px;
    justify-content: center;
    align-items: center;
    height: auto;
    overflow: auto;
  }
  .auth-container {
    border-radius: 20px;
    height: auto;
    min-height: 700px;
    overflow-y: visible;
  }
  .auth-header-login {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
  }
  .register-bottom-img {
    height: 120px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
  }
}
