/* ========================================
   HIVEMIND - LOGIN & SIGNUP STYLES
   ======================================== */

/* Chrome-only notice replaces login content without affecting other pages. */
#login-page.main-page.chrome-only {
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 1rem;
  margin: 0;
  background: linear-gradient(135deg, #0c172b, #162640 55%, #111b2e);
}

#login-page.main-page.chrome-only:not(.hidden) {
  display: grid;
  place-items: center;
}

#login-page.chrome-only > :not(#chrome-only-notice) {
  display: none !important;
}

#chrome-only-notice {
  width: 100%;
  text-align: center;
}

#chrome-only-notice[hidden] { display: none; }

#chrome-only-notice img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  margin: auto;
  object-fit: contain;
}

/* === LOGIN PAGE SPECIFIC STYLES === */
#login-page.main-page {
  background-image: url('/Images/Login5.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

#login-video-tap-banner {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 40;
  background-color: var(--amber-color);
  border: 2px solid #000;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
  color: #000;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  line-height: 1.2;
  pointer-events: none;
  opacity: 1;
  transition: opacity 220ms ease, transform 220ms ease;
}

#login-video-tap-banner.is-hidden {
  opacity: 0;
  transform: translateY(-4px);
}

/* Input Group - Bottom Left (Default Desktop Styles) */
#login-input-group {
  position: absolute;
  bottom: 2vh;
  left: 5vw;
  width: 320px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
  opacity: 0;
  animation-name: slideInFromLeftInputs;
  animation-duration: 0.7s;
  animation-delay: 0.5s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

.login-field-wrapper {
  width: 100%;
}

/* Default Input Styling */
.login-input.form-control {
  background-color: rgba(255, 255, 255, 0.9);
  border: 2px solid #000;
  /* Block border */
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
  /* Block shadow */
  color: var(--text-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.login-input.form-control::placeholder {
  color: var(--light-text-color);
  opacity: 1;
}

.login-input.form-control::-ms-input-placeholder {
  color: var(--light-text-color);
}

.login-input.form-control:-ms-input-placeholder {
  color: var(--light-text-color);
}

.login-input.form-control:focus {
  background-color: #ffffff;
  border-color: var(--amber-color);
  color: var(--text-color);
  box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.35);
  outline: none;
}

/* Button Group Wrapper - Bottom Center (Default Desktop Styles) */
#login-button-group-wrapper {
  position: absolute;
  bottom: 5vh;
  right: 3vw;
  /* USER: Play with this for horizontal alignment */
  left: auto;
  transform: none;
  width: auto;
  max-width: 320px;
  z-index: 10;
  padding-bottom: 0;
}

/* Button Group (Content within the wrapper) */
#login-button-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
  opacity: 0;
  transform: translateY(50px);
  animation-name: slideUpAndFadeButtonGroupNoInitialTransform;
  animation-duration: 0.7s;
  animation-delay: 0.7s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

/* Default Action Button Styling */
#login-action-button.btn {
  background-color: var(--amber-color);
  border: 2px solid #000;
  /* Block border */
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
  /* Block shadow */
  color: var(--primary-color);
  padding: 0.75rem 1.25rem;
  font-size: 1.15rem;
  font-weight: bold;
  border-radius: 8px;
  width: 100%;
  transition: background-color 0.2s ease-in-out;
  cursor: pointer;
  text-transform: uppercase;
}

#login-action-button.btn:hover {
  background-color: #e0a800;
}

/* Default Login Links Styling */
#login-links {
  font-size: 1.2rem;
  text-align: center;
}

#login-links a {
  color: var(--amber-color);
  text-decoration: underline;
  transition: color 0.2s ease-in-out, text-shadow 0.2s ease-in-out;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
  font-weight: 500;
}

#login-links a:hover {
  color: #e0a800;
}

/* Error Messages on Login Page */
#login-input-group .login-error-message,
#login-button-group .login-error-message {
  font-size: 0.9rem;
  min-height: 1.2em;
  color: #ffdddd;
  background-color: rgba(100, 0, 0, 0.4);
  padding: 5px 8px;
  border-radius: 4px;
  text-shadow: 1px 1px 1px #000;
}

#login-input-group .login-error-message {
  text-align: left;
}

#login-button-group .login-error-message {
  text-align: center;
}

/* === SIGNUP PAGE STYLES === */
#signup-page.main-page {
  background-image: url('/Images/Login5.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 30px 20px;
  min-height: 100vh;
  position: relative;
}

/* === MEDIA QUERIES FOR RESPONSIVE LOGIN === */
@media (max-width: 768px) {
  #login-page.main-page {
    background-size: contain;
    background-position: center top;
    background-color: #333;
    position: relative;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
  }

  #login-input-group {
    position: absolute;
    bottom: 20vh;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 380px;
    gap: 0.8rem;
  }

  #login-button-group-wrapper {
    position: absolute;
    bottom: 4vh;
    right: 4vw;
    left: auto;
    transform: none;
    width: auto;
    max-width: 280px;
    padding-bottom: 0;
  }

  #login-button-group {
    align-items: flex-end;
    gap: 0.5rem;
  }

  .login-input.form-control,
  #login-page-enrollment-code-input {
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
  }

  #login-input-group .login-field-wrapper.mt-3 {
    margin-top: 0.75rem !important;
  }

  #login-action-button.btn {
    padding: 0.7rem 1.1rem;
    font-size: 1.1rem;
    width: 160px;
    max-width: 180px;
  }

  #login-links {
    font-size: 0.9rem;
    text-align: right;
  }
}

/* Optional: Further adjustments for very small phone screens */
@media (max-width: 400px) {
  #login-page.main-page {
    padding: 15px;
  }

  #login-input-group {
    bottom: 22vh;
    gap: 0.6rem;
  }

  #login-button-group-wrapper {
    bottom: 3vh;
    right: 3vw;
  }

  .login-input.form-control,
  #login-page-enrollment-code-input {
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
  }

  #login-action-button.btn {
    padding: 0.65rem 1rem;
    font-size: 1rem;
    width: auto;
    max-width: 150px;
  }

  #login-links {
    font-size: 0.85rem;
  }
}

/* Landscape orientation optimizations for login page - ONLY when overlay is active */
/* ... (existing content works fine, just ensuring context) ... */
/* (previous content ends) */

/* === RESTORED KEYFRAMES FOR ANIMATIONS === */
@keyframes slideInFromLeftInputs {
  0% {
    opacity: 0;
    transform: translateX(-50px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideUpAndFadeButtonGroupNoInitialTransform {
  0% {
    opacity: 0;
    transform: translateY(50px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  body.landscape-overlay-active #login-page.main-page {
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    padding: 5px !important;
    position: fixed !important;
    overflow: hidden !important;
    background-size: cover !important;
    background-position: center !important;
  }

  body.landscape-overlay-active #login-input-group {
    position: absolute !important;
    bottom: 20vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 85% !important;
    max-width: 380px !important;
    gap: 0.7rem !important;
  }

  body.landscape-overlay-active #login-button-group-wrapper {
    position: absolute !important;
    bottom: 5vh !important;
    right: 5vw !important;
    left: auto !important;
    transform: none !important;
    width: auto !important;
    max-width: 200px !important;
    padding-bottom: 0 !important;
  }

  body.landscape-overlay-active .login-input.form-control,
  body.landscape-overlay-active #login-page-enrollment-code-input {
    padding: 0.7rem 0.9rem !important;
    font-size: 0.95rem !important;
  }

  body.landscape-overlay-active #login-action-button.btn {
    padding: 0.7rem 1.2rem !important;
    font-size: 1rem !important;
    width: 100% !important;
    max-width: 180px !important;
  }

  body.landscape-overlay-active #login-links {
    font-size: 0.9rem !important;
    text-align: center !important;
  }

  body.landscape-overlay-active #login-button-group {
    align-items: center !important;
    gap: 0.6rem !important;
  }

  /* Ensure proper button spacing in landscape overlay */
  body.landscape-overlay-active #show-progress-btn {
    margin-bottom: 20px !important;
    /* Reset spacing since feedback button is now absolute positioned */
    padding: 12px 24px !important;
  }

  body.landscape-overlay-active #logout-button {
    bottom: 15px !important;
    left: 15px !important;
    z-index: 1050 !important;
  }

  body.landscape-overlay-active .exit-button {
    bottom: 15px !important;
    right: 15px !important;
    z-index: 1050 !important;
  }
}

/* Additional landscape optimizations for smaller devices - ONLY when overlay is active */
@media (orientation: landscape) and (max-height: 500px) {
  body.landscape-overlay-active #login-page.main-page {
    padding: 3px !important;
  }

  body.landscape-overlay-active #login-input-group {
    bottom: 15vh !important;
    gap: 0.5rem !important;
  }

  body.landscape-overlay-active #login-button-group-wrapper {
    bottom: 2vh !important;
    right: 2vw !important;
  }

  body.landscape-overlay-active .login-input.form-control,
  body.landscape-overlay-active #login-page-enrollment-code-input {
    padding: 0.5rem 0.7rem !important;
    font-size: 0.8rem !important;
  }

  body.landscape-overlay-active #login-action-button.btn {
    padding: 0.5rem 0.8rem !important;
    font-size: 0.9rem !important;
    max-width: 120px !important;
  }

  body.landscape-overlay-active #login-links {
    font-size: 0.7rem !important;
  }

  /* Ensure proper button spacing in small device landscape overlay */
  body.landscape-overlay-active #show-progress-btn {
    margin-bottom: 20px !important;
    /* Reset spacing since feedback button is now absolute positioned */
    padding: 10px 20px !important;
    font-size: 0.9rem !important;
  }

  body.landscape-overlay-active #logout-button {
    bottom: 10px !important;
    left: 10px !important;
    z-index: 1050 !important;
  }

  body.landscape-overlay-active .exit-button {
    bottom: 10px !important;
    right: 10px !important;
    z-index: 1050 !important;
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
  }

}

/* === WELCOME VIDEO === */
#welcome-video-container {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 300px;
  max-width: 90vw;
  z-index: 20;
  text-align: center;
}


/* === FULL SCREEN VIDEO (iPad Portrait+ & Desktop) === */
/* User requested: Video appears full screen on iPad/Desktop, with inputs/buttons on top */
@media (min-width: 600px) {
  #welcome-video-container {
    position: fixed !important;
    /* Fixed ensures it covers scrolling */
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    /* Override max-width: 90vw from default */
    z-index: 0 !important;
    /* Send to back */
    background-color: black;
    /* Fallback */
    margin: 0 !important;
    padding: 0 !important;
    right: auto !important;
    transform: none !important;
  }

  #login-welcome-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    /* Ensures video covers screen without stretching */
    border: none !important;
    border-radius: 0 !important;
    opacity: 0.6;
    /* Optional: Slight dim to make text readable? User didn't ask, but good practice. Checking if user asked... No. Keeping 100% opacity but maybe user wants it "background". */
    opacity: 1;
  }

  /* Ensure inputs are on top of video */
  #login-input-group {
    z-index: 10 !important;
  }

  /* Ensure buttons are on top of video */
  #login-button-group-wrapper {
    z-index: 10 !important;
  }



  /* Force block styling for ALL screens > 600px (iPad Portrait/Landscape + Desktop) */
  .login-input.form-control,
  #login-action-button.btn {
    border: 2px solid #000 !important;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 1) !important;
  }
}

/* === iPAD / TABLET PORTRAIT REFINEMENTS (User Requested) === */
@media (min-width: 600px) and (max-width: 900px) {

  /* ... (Previous iPad styles remain valid for positioning inputs/buttons) ... */
  #login-page.main-page {
    background-image: none !important;
    background-color: #000 !important;
  }

  /* Reposition Inputs to Bottom Left (Desktop-like) */
  #login-input-group {
    left: 5vw !important;
    bottom: 45vh !important;
    transform: none !important;
    width: 320px !important;
    gap: 1rem !important;
  }

  /* Explicitly enforce block styling on iPad to ensure it overrides any defaults */
  /* MOVED TO min-width: 600px BLOCK ABOVE TO COVER ALL TABLETS/DESKTOPS */

  /* Reposition Buttons to Bottom Right (Desktop-like) with Black Background */
  #login-button-group-wrapper {
    right: 5vw !important;
    left: auto !important;
    bottom: 45vh !important;
    background-color: rgba(0, 0, 0, 0.95) !important;
    padding: 20px !important;
    border-radius: 12px !important;
    transform: none !important;
    width: auto !important;
    max-width: 320px !important;
  }

  /* MOVED TO min-width: 600px BLOCK ABOVE */

  #login-button-group {
    align-items: center !important;
    gap: 1rem !important;
  }
}
