/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Ensure the body is flexible and centered */
body {
  font-family: 'Lato', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(#f5f5f5, #e0e0e0);
  overflow-x: hidden;
  overflow-y: auto; /* Allow vertical scrolling on short screens */
}

/* Container for the form, default for mobile */
div.newContainer-form {
  width: 100%;
  max-width: 360px; /* Default for Z Flip folded */
  padding: 10px;
  margin: 10px auto; /* Small margin for vertical breathing room */
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Form wrapper */
.wrap-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Introductory paragraph */
div.newContainer-form p {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  text-align: center;
}

/* Form title and subtitle */
.form-title, .form-sub-title {
  font-size: 16px;
  color: #222;
  text-align: center;
  display: block;
}

.form-sub-title {
  font-size: 14px;
  color: #555;
}

/* Input wrapper */
.wrap-input {
  display: flex;
  align-items: center;
  background: #f0f0f0;
  border-radius: 5px;
  padding: 8px;
  margin: 10px 0;
  min-height: 44px; /* WCAG-compliant tap target */
}

/* Input field */
.input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  padding: 8px;
  color: #333;
  outline: none;
}

/* Icon styling */
.label-input i {
  font-size: 16px;
  color: #666;
  margin-right: 8px;
}

/* Select dropdown */
.wrap-notice select {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  color: #333;
  appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10"><path fill="%23333" d="M0 3l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-height: 44px; /* WCAG-compliant tap target */
}

/* Button styling */
.login-button {
  width: 100%;
  padding: 12px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
  min-height: 44px; /* WCAG-compliant tap target */
}

.login-button:hover {
  background: #0056b3;
}

.login-button:active {
  transform: scale(0.98);
}

/* Footer section */
section center {
  margin-top: 20px;
  font-size: 12px;
  color: #555;
}

section center p a {
  color: #007bff;
  text-decoration: none;
}

section center p a:hover {
  text-decoration: underline;
}

/* Media Query for Z Flip Folded Cover Screen (~720x748px) */
@media screen and (max-width: 360px) {
  div.newContainer-form {
    max-width: 100%;
    padding: 5px;
    margin: 5px auto;
  }

  div.newContainer-form p {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .form-title {
    font-size: 14px;
  }

  .form-sub-title {
    font-size: 12px;
  }

  .wrap-input {
    padding: 6px;
    margin: 8px 0;
  }

  .input {
    font-size: 12px;
    padding: 6px;
  }

  .login-button {
    padding: 10px;
    font-size: 14px;
  }

  section center {
    font-size: 11px;
  }
}

/* Media Query for Z Flip Unfolded and Small Devices (~361px–767px) */
@media screen and (min-width: 361px) and (max-width: 767px) {
  div.newContainer-form {
    max-width: 400px;
    padding: 12px;
  }

  div.newContainer-form p {
    font-size: 16px;
  }

  .form-title {
    font-size: 18px;
  }

  .form-sub-title {
    font-size: 14px;
  }

  .wrap-input {
    padding: 10px;
    margin: 12px 0;
  }

  .input {
    font-size: 16px;
    padding: 10px;
  }

  .login-button {
    padding: 14px;
    font-size: 18px;
  }
}

/* Media Query for Smart Displays (Nest Hub, 1024x600px) */
@media screen and (min-width: 768px) and (max-width: 1080px) and (max-height: 700px) {
  body {
    justify-content: flex-start; /* Align to top to avoid clipping */
    padding: 10px 0; /* Reduced padding for short viewport */
  }

  div.newContainer-form {
    max-width: 600px; /* Wider to utilize 1024px width */
    padding: 20px;
    margin: 10px auto;
    min-height: unset; /* Prevent overflow on short screens */
  }

  .wrap-form {
    gap: 15px; /* More spacing for touch */
  }

  div.newContainer-form p {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 12px;
  }

  .form-title {
    font-size: 22px;
  }

  .form-sub-title {
    font-size: 16px;
  }

  .wrap-input {
    padding: 12px;
    margin: 15px 0;
    min-height: 48px; /* Larger touch target for Nest Hub */
  }

  .input {
    font-size: 18px;
    padding: 12px;
  }

  .label-input i {
    font-size: 18px;
    margin-right: 10px;
  }

  .wrap-notice select {
    padding: 12px;
    font-size: 16px;
    min-height: 48px;
    background-position: right 12px center;
  }

  .login-button {
    padding: 16px;
    font-size: 20px;
    min-height: 48px;
  }

  section center {
    font-size: 14px;
    margin-top: 15px;
  }
}

/* Media Query for Tablets (e.g., iPad, ~1081px–1280px) */
@media screen and (min-width: 1081px) and (max-width: 1280px) {
  div.newContainer-form {
    max-width: 600px; /* Wider for tablets */
    padding: 20px;
  }

  div.newContainer-form p {
    font-size: 18px;
    line-height: 1.5;
  }

  .form-title {
    font-size: 24px;
  }

  .form-sub-title {
    font-size: 16px;
  }

  .wrap-input {
    padding: 12px;
    margin: 15px 0;
  }

  .input {
    font-size: 18px;
    padding: 12px;
  }

  .label-input i {
    font-size: 18px;
  }

  .wrap-notice select {
    padding: 12px;
    font-size: 16px;
  }

  .login-button {
    padding: 16px;
    font-size: 20px;
  }

  section center {
    font-size: 14px;
  }
}

/* Media Query for Large Tablets and Foldables (e.g., iPad Pro, ZenBook Fold, ~1281px–1920px) */
@media screen and (min-width: 1281px) and (max-width: 1920px) {
  div.newContainer-form {
    max-width: 800px; /* Wider for large tablets and foldables */
    padding: 25px;
  }

  div.newContainer-form p {
    font-size: 20px;
    line-height: 1.6;
  }

  .form-title {
    font-size: 28px;
  }

  .form-sub-title {
    font-size: 18px;
  }

  .wrap-input {
    padding: 14px;
    margin: 20px 0;
  }

  .input {
    font-size: 20px;
    padding: 14px;
  }

  .label-input i {
    font-size: 20px;
  }

  .wrap-notice select {
    padding: 14px;
    font-size: 18px;
  }

  .login-button {
    padding: 18px;
    font-size: 22px;
  }

  section center {
    font-size: 16px;
  }
}

/* Media Query for Desktops and Ultra-Wide Screens (>1920px) */
@media screen and (min-width: 1921px) {
  div.newContainer-form {
    max-width: 1000px; /* Widest for desktops */
    padding: 30px;
  }

  div.newContainer-form p {
    font-size: 20px;
    line-height: 1;
  }

  .form-title {
    font-size: 32px;
  }

  .form-sub-title {
    font-size: 20px;
  }

  .wrap-input {
    padding: 16px;
    margin: 25px 0;
  }

  .input {
    font-size: 22px;
    padding: 16px;
  }

  .label-input i {
    font-size: 22px;
  }

  .wrap-notice select {
    padding: 16px;
    font-size: 20px;
  }

  .login-button {
    padding: 20px;
    font-size: 24px;
  }

  section center {
    font-size: 18px;
  }
}

/* Flex Mode Support (Z Flip Partial Fold at ~90°) */
@media screen and (max-width: 1080px) and (orientation: landscape) and (max-height: 600px) {
  body {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
  }

  div.newContainer-form {
    max-width: 90%;
    padding: 12px;
    transform: translateY(-10%);
  }

  div.newContainer-form p {
    font-size: 14px;
  }

  .form-title, .form-sub-title {
    font-size: 16px;
  }

  .wrap-input {
    padding: 10px;
    margin: 12px 0;
  }

  .input {
    font-size: 16px;
    padding: 10px;
  }

  .login-button {
    padding: 12px;
    font-size: 16px;
  }
}