/* password.css
   Manages the style for the password modal
   so it stays on top of other elements and remains fully interactive.
*/

body {
  padding-top: env(safe-area-inset-top);
}

/* Base Modal Container */
#password-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  /* Ensure it's above covers, grids, etc. */
  z-index: 9999;

  display: flex;
  justify-content: center;
  align-items: center;

  /* Light overlay background; can adjust opacity as needed */
  background: rgb(255, 255, 255);

  /* Inherit text color from the body or fallback to black/white in media queries */
  color: inherit;

  /* Important for interactions */
  pointer-events: auto;

  /* Visible by default; can be toggled via .hidden class */
  visibility: visible;
  opacity: 1;

  /* Fade in/out transition if you hide/show the modal */
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* If you want to hide the modal (use JS to add/remove this class) */
#password-modal.hidden {
  visibility: hidden;
  opacity: 0;
}

/* Modal Card (Inner Dialog) */
.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin: 24px;
  text-align: center;

  /* Default background & text color; can be overridden in dark/light media queries */
  background: #ffffff;
  color: #000000;
}

.modal-header {
  margin-bottom: 1rem;
}

.modal-body {
  margin-top: 1rem;
}

.modal-text {
  font-size: 1rem;
  margin-bottom: 1rem;
}

/* Input Wrapper for spacing */
.input-wrapper {
  margin: 1rem 0;
}

/* Password Field */
#password-input {
  width: 100%;
  height: 50px;
  padding: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1rem;

  /* Subtle styling */
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;

  background-color: #f9f9f9;
  color: #333;
}

/* Placeholder text color */
#password-input::placeholder {
  color: #aaa;
}

/* Submit Button */
#password-submit {
  width: 100%;
  height: 50px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;

  /* Grayish initial background to indicate disabled state (if you want to enable after typing) */
  background-color: #e0e0e0;
  color: #555;
  cursor: not-allowed;

  transition: background-color 0.3s ease, color 0.3s ease;
}

/* When the button is "active" (JS toggles 'active' class) */
#password-submit.active {
  background-color: #007bff; 
  color: #fff;
  cursor: pointer;
}
#password-submit.active:hover {
  background-color: #0056b3;
}

/* Error Messages (if you have any) */
.password-error {
  color: red;
  margin-top: 1rem;
}

/* Light Mode Support (Optional) */
@media (prefers-color-scheme: light) {
  #password-modal {
    background: rgb(255, 255, 255);
  }

  .modal-card {
    background: #fff;
    color: #000;
  }

  #password-input {
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    color: #333;
  }

  #password-input::placeholder {
    color: #aaa;
  }

  #password-submit {
    background-color: #e0e0e0;
    color: #555;
  }

  #password-submit.active {
    background-color: #007bff;
    color: #fff;
  }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
  #password-modal {
    background: rgb(0, 0, 0);
  }

  .modal-card {
    background: #222;
    color: #fff;
  }

  #password-input {
    border: 1px solid #444;
    background-color: #333;
    color: #eee;
  }

  #password-input::placeholder {
    color: #bbb;
  }

  #password-submit {
    background-color: #444;
    color: #bbb;
  }

  #password-submit.active {
    background-color: #1a73e8;
    color: #fff;
  }

  /* Give the lock icon path the current text color */
  .icon.lock path {
    fill: currentColor;
  }
}
