/* ========================================
   LOGIN PAGE - MODERN AUTH DESIGN
   ======================================== */

/* Gradient background */
body.page-login {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #FFFFFF;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Header - transparent background */
body.page-login #app-header,
body.page-login header {
  background: transparent;
  background-color: transparent;
  border-bottom: none;
  position: relative;
  z-index: 1000;
  box-shadow: none;
  border: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Main container - FLEXBOX CENTERING */
body.page-login main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  grid-template-columns: none;
  column-gap: 0;
  grid-gap: 0;
  gap: 0;
}

/* Ensure main > * children are also properly contained */
body.page-login main > * {
  grid-column: unset;
}

/* ========================================
   DASHBOARD HEADER
   ======================================== */
body.page-login .dashboard-header {
  text-align: center;
  padding: 40px 20px 20px 20px;
  background: transparent;
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 20px;
}

.dashboard-header h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: #514f4f;
  margin: 0;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

.dashboard-header h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 5px;
  background: linear-gradient(90deg, #84c5ed 0%, #b9d4eb 100%);
  border-radius: 3px;
}

/* ========================================
   LOGIN FORM
   ======================================== */
body.page-login #search {
  margin: 0 auto 40px auto;
  padding: 0 20px;
  max-width: 450px;
  width: 100%;
  display: block;
  flex-wrap: initial;
  justify-content: initial;
  align-items: initial;
  box-sizing: border-box;
  /* Ensure it's centered within flexbox parent */
  align-self: center;
}

#loginForm {
  background: #F7E226;
  padding: 32px; /* Reduced from 40px for narrower look */
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(247, 226, 38, 0.15);
  border: 1px solid rgba(247, 226, 38, 0.2);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Prevent any expansion */
  min-height: 0;
  height: auto;
  box-sizing: border-box;
  display: block;
}

#loginForm:hover {
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(247, 226, 38, 0.3);
}

/* Labels */
#loginForm label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Password input wrapper for toggle button */
.password-input-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 24px;
  /* Fixed height to prevent size changes */
  min-height: 56px;
}

/* Input fields */
body.page-login #loginForm input[type="email"],
body.page-login #loginForm input[type="password"],
body.page-login #loginForm input[type="text"] {
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  padding: 16px 20px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  background: #ffffff;
  background-color: #ffffff;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
  box-sizing: border-box;
  /* Fixed height to prevent size changes */
  height: 56px;
  min-height: 56px;
  max-height: 56px;
}

/* Password input inside wrapper - no margin */
body.page-login .password-input-wrapper input[type="password"],
body.page-login .password-input-wrapper input[type="text"] {
  margin-bottom: 0;
  padding-right: 50px; /* Make space for toggle button */
  /* Ensure consistent styling when type changes */
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  width: 100%;
  border-radius: 12px;
}

/* Toggle password button */
body.page-login .toggle-password {
  position: absolute;
  right: 20px;
  top: 18px;
  transform: none;
  background: none;
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  color: #666;
  font-size: 18px;
  transition: color 0.3s ease;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  margin-bottom: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: normal;
  text-align: center;
}

body.page-login .toggle-password:hover {
  color: #84c5ed;
  transform: none;
  box-shadow: none;
  background: none;
  background-color: transparent;
}

body.page-login .toggle-password:active {
  color: #5a9fc5;
  transform: none;
  box-shadow: none;
  background: none;
  background-color: transparent;
}

body.page-login .toggle-password:focus-visible {
  outline: none;
  background: none;
  background-color: transparent;
}

body.page-login .toggle-password i {
  pointer-events: none;
  display: inline-block;
  line-height: 1;
  font-size: 18px;
  vertical-align: middle;
  /* Remove any margins/padding that Font Awesome might add */
  margin: 0;
  padding: 0;
}

/* Ensure Font Awesome icons are centered */
body.page-login .toggle-password .fa-eye,
body.page-login .toggle-password .fa-eye-slash {
  vertical-align: middle;
}

body.page-login #loginForm input[type="email"]:focus-visible,
body.page-login #loginForm input[type="password"]:focus-visible,
body.page-login #loginForm input[type="text"]:focus-visible {
  outline: none;
  border-color: #84c5ed;
  box-shadow: 0 0 0 4px rgba(132, 197, 237, 0.15);
  background: #ffffff;
  background-color: #ffffff;
  /* Maintain size on focus */
  height: 56px;
  border-radius: 12px;
}

#loginForm input::placeholder {
  color: #999;
  font-weight: 400;
}

/* Override autocomplete styles — browser requires !important */
#loginForm input[type="email"]:-webkit-autofill,
#loginForm input[type="password"]:-webkit-autofill,
#loginForm input[type="text"]:-webkit-autofill,
#loginForm input[type="email"]:-webkit-autofill:hover,
#loginForm input[type="password"]:-webkit-autofill:hover,
#loginForm input[type="text"]:-webkit-autofill:hover,
#loginForm input[type="email"]:-webkit-autofill:focus,
#loginForm input[type="password"]:-webkit-autofill:focus,
#loginForm input[type="text"]:-webkit-autofill:focus {
  -webkit-text-fill-color: #333 !important;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  box-shadow: 0 0 0px 1000px #ffffff inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
  /* Maintain size on autofill */
  height: 56px !important;
  border-radius: 12px !important;
}

/* Buttons */
#loginForm button {
  width: 100%;
  height: 52px;
  padding: 0 32px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
  box-shadow: none;
  flex: 0 0 auto;
  box-sizing: border-box;
}

#loginForm button[type="submit"] {
  background: linear-gradient(135deg, #84c5ed 0%, #b9d4eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(132, 197, 237, 0.4);
}

#loginForm button[type="submit"]:hover {
  background: linear-gradient(135deg, #b9d4eb 0%, #84c5ed 100%);
  box-shadow: 0 6px 24px rgba(132, 197, 237, 0.5);
  transform: translateY(-2px);
}

#loginForm button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(132, 197, 237, 0.3);
}

/* Forgot password button */
#loginForm button[type="button"]#forgotPasswordBtn {
  background: #ffffff;
  color: #555;
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-top: 16px;
}

#loginForm button[type="button"]#forgotPasswordBtn:hover {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.15);
  color: #333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Register button - light blue with white text */
.register-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 0 32px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
  background: linear-gradient(135deg, #84c5ed 0%, #b9d4eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(132, 197, 237, 0.4);
  box-sizing: border-box;
}

.register-btn:hover {
  background: linear-gradient(135deg, #b9d4eb 0%, #84c5ed 100%);
  box-shadow: 0 6px 24px rgba(132, 197, 237, 0.5);
  transform: translateY(-2px);
  color: #ffffff;
}

.register-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(132, 197, 237, 0.3);
}

/* Message */
#loginMessage {
  margin-top: 0; /* No margin when empty */
  margin-bottom: 0;
  padding: 0; /* No padding when empty */
  border-radius: 12px;
  font-weight: 500;
  font-size: 14px;
  text-align: center;
  min-height: 0; /* No height when empty */
  max-height: 0; /* Completely collapsed when empty */
  opacity: 0;
  transition: all 0.3s ease;
  display: block;
  overflow: hidden; /* Prevents content overflow during transition */
}

#loginMessage:not(:empty) {
  margin-top: 20px; /* Only add margin when there's content */
  opacity: 1;
  min-height: 46px; /* Only expand when there's content */
  max-height: 200px; /* Allow expansion when there's content */
  padding: 14px 18px; /* Only add padding when there's content */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Removed slideIn animation to prevent layout shifts */

#loginMessage.success {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  border: 2px solid #b1dfbb;
  color: #155724;
}

#loginMessage.error {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  border: 2px solid #f1b0b7;
  color: #721c24;
}

/* ========================================
   IMAGE
   ======================================== */
img {
  display: block;
  max-width: 1200px;
  width: 82%;
  margin: 40px auto 60px auto;
  border-radius: 24px;
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(132, 197, 237, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

img:hover {
  transform: scale(1.02) translateY(-4px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(132, 197, 237, 0.2);
}

/* ========================================
   RESPONSIVE - Small screens
   ======================================== */

/* Tablets */
@media (max-width: 1024px) {
  #loginForm {
    padding: 36px;
  }

  .dashboard-header h2 {
    font-size: 38px;
  }

  img {
    width: 90%;
    margin: 30px auto 50px auto;
  }
}

/* Medium mobile */
@media (max-width: 768px) {
  #loginForm {
    padding: 32px;
  }

  #loginForm input[type="email"],
  #loginForm input[type="password"] {
    padding: 14px 18px;
    font-size: 14px;
  }

  #loginForm button {
    height: 48px;
    padding: 0 28px;
    font-size: 15px;
  }

  .social-login-btn {
    height: 48px;
  }

  .register-btn {
    height: 48px;
    font-size: 15px;
  }

  .dashboard-header {
    padding: 30px 20px 16px 20px;
  }

  .dashboard-header h2 {
    font-size: 34px;
  }

  img {
    width: 92%;
    margin: 24px auto 40px auto;
    border-radius: 20px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  body.page-login #search {
    width: 95%; /* Allow some margin on mobile */
  }

  #loginForm {
    padding: 28px;
    border-radius: 16px;
  }

  #loginForm input[type="email"],
  #loginForm input[type="password"] {
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 20px;
  }

  #loginForm button {
    height: 46px;
    padding: 0 24px;
    font-size: 14px;
  }

  .social-login-btn {
    height: 46px;
  }

  .register-btn {
    height: 46px;
    font-size: 14px;
  }

  #loginForm label {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .dashboard-header {
    padding: 24px 16px 12px 16px;
  }

  .dashboard-header h2 {
    font-size: 30px;
  }

  .dashboard-header h2::after {
    width: 60px;
    height: 4px;
    bottom: -8px;
  }

  img {
    width: 94%;
    margin: 20px auto 30px auto;
    border-radius: 16px;
  }

  #loginMessage {
    font-size: 13px;
  }

  #loginMessage:not(:empty) {
    min-height: 42px;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  body.page-login #search {
    width: 98%; /* Narrow margin on very small screens */
  }

  #loginForm {
    padding: 24px;
    border-radius: 14px;
  }

  #loginForm input[type="email"],
  #loginForm input[type="password"] {
    padding: 10px 14px;
    font-size: 12px;
  }

  #loginForm button {
    height: 44px;
    padding: 0 20px;
    font-size: 13px;
  }

  .social-login-btn {
    height: 44px;
  }

  .register-btn {
    height: 44px;
    font-size: 13px;
  }

  .dashboard-header h2 {
    font-size: 26px;
  }

  img {
    width: 96%;
    border-radius: 14px;
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body.page-login {
  animation: fadeIn 0.5s ease;
}

/* Accessibility improvements — standard requires !important */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
