/* ==========================================================
 * INDEX / LOGIN PAGE STYLES
 * Standalone page — intentionally different from dashboard
 * ========================================================== */

/* ==========================================================
 * 1. RESET & BASE
 * ========================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8eaf0, #d0d4dc);
  overflow: hidden;
  transition:
    background 0.3s ease,
    color 0.3s ease;
  position: relative;
  color: #000;
}

body.dark-mode {
  background: linear-gradient(135deg, #121212, #000);
  color: #fff;
}

/* ==========================================================
 * 2. BACKGROUND CANVAS
 * ========================================================== */

#backgroundCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ==========================================================
 * 3. MESSAGES / ERRORS
 * ========================================================== */

.messages {
  list-style: none;
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  background-color: rgba(255, 0, 0, 0.1);
  color: #b30000;
  border: 1px solid #ff4d4d;
  transition:
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

.messages li {
  margin-bottom: 6px;
}

body.dark-mode .messages {
  background-color: rgba(255, 0, 0, 0.2);
  color: #ff9999;
  border-color: #ff6666;
}

/* ==========================================================
 * 4. LOGIN CONTAINER
 * ========================================================== */

.container {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 16px;
  padding: 50px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
  text-align: center;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

body.dark-mode .container {
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5);
}

/* ==========================================================
 * 5. LOGO
 * ========================================================== */

.logo-top {
  margin-bottom: 15px;
  text-align: center;
  z-index: 2;
}

.logo-top img {
  width: 160px;
  height: auto;
}

/* ==========================================================
 * 6. TITLE & SUBTITLE
 * ========================================================== */

.login-box h3 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: inherit;
}

.login-box .subtitle {
  font-size: 0.9rem;
  margin-bottom: 20px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.6);
}

body.dark-mode .login-box .subtitle {
  color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================
 * 7. FORM
 * ========================================================== */

.form-group {
  margin-bottom: 18px;
  text-align: left;
  position: relative;
}

.form-group label {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 5px;
  display: block;
}

.form-group input {
  width: 100%;
  padding: 12px 44px 12px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.85);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.3s ease;
  color: #000;
}

.form-group input::placeholder {
  color: #666;
}

.form-group input:focus {
  outline: none;
  border-color: #ff7a00;
  box-shadow: 0 0 8px 3px rgba(255, 122, 0, 0.4);
}

body.dark-mode .form-group input {
  background: rgba(40, 40, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}

body.dark-mode .form-group input::placeholder {
  color: #aaa;
}

body.dark-mode .form-group input:focus {
  border-color: #ff7a00;
  box-shadow: 0 0 8px 3px rgba(255, 140, 60, 0.4);
}

/* ==========================================================
 * 8. FORGOT PASSWORD
 * ========================================================== */

.forgot-password {
  text-align: right;
  margin-top: 4px;
}

.forgot-password a {
  font-size: 0.8rem;
  text-decoration: none;
  color: #666;
  font-weight: 400;
  transition: color 0.3s ease;
}

.forgot-password a:hover {
  color: #000;
}

body.dark-mode .forgot-password a {
  color: #bbb;
}

body.dark-mode .forgot-password a:hover {
  color: #fff;
}

/* ==========================================================
 * 9. PASSWORD TOGGLE ICON
 * ========================================================== */

.password-group {
  position: relative;
}

.input-with-icon {
  position: relative;
}

#togglePassword {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.15rem;
  color: #444;
  cursor: pointer;
  z-index: 2;
  opacity: 0.9;
  user-select: none;
  transition: color 0.2s ease;
}

#togglePassword:hover {
  opacity: 1;
}

body.dark-mode #togglePassword {
  color: #ccc;
}

/* ==========================================================
 * 10. SIGN IN BUTTON
 * ========================================================== */

.sign-in-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #739ec9, #003399);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 12px;
}

.sign-in-btn:hover {
  background: linear-gradient(135deg, #3399ff, #0044cc);
  transform: translateY(-2px);
}

body.dark-mode .sign-in-btn {
  background: linear-gradient(135deg, #0066cc, #0044aa);
}

body.dark-mode .sign-in-btn:hover {
  background: linear-gradient(135deg, #3399ff, #0055cc);
}

/* Remove browser-native password controls */
input[type='password']::-ms-reveal,
input[type='password']::-ms-clear {
  display: none;
}

input[type='password']::-webkit-credentials-auto-fill-button,
input[type='password']::-webkit-clear-button {
  display: none !important;
  visibility: hidden;
}

/* ==========================================================
 * 11. FOOTER
 * ========================================================== */

.footer {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.7);
  text-align: center;
  z-index: 2;
}

body.dark-mode .footer {
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================
 * 12. THEME TOGGLE — icon only
 * ========================================================== */

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 1.1rem;
  font-family: 'Poppins', sans-serif;
  z-index: 10;
  transition:
    background 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

body.dark-mode .theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.theme-toggle:hover {
  transform: scale(1.05);
}

.theme-toggle #themeText {
  display: none !important;
}

/* ==========================================================
 * 13. UTILITIES
 * ========================================================== */

.hidden {
  display: none !important;
}

/* ==========================================================
 * 14. MOBILE (≤480px)
 * ========================================================== */

@media (max-width: 480px) {
  .logo-top img {
    width: 120px;
  }

  .logo-top {
    margin-bottom: 10px;
  }

  .container {
    padding: 28px 20px;
    max-width: 92%;
    margin-bottom: 14px;
  }

  .login-box h3 {
    font-size: 1.4rem;
  }

  .login-box .subtitle {
    font-size: 0.8rem;
    margin-bottom: 16px;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-group label {
    font-size: 0.85rem;
  }

  .form-group input {
    padding: 10px 40px 10px 12px;
    font-size: 16px;
  }

  .sign-in-btn {
    padding: 11px;
    font-size: 0.9rem;
    margin-top: 6px;
  }

  .theme-toggle {
    top: 14px;
    right: 14px;
    padding: 7px 9px;
    font-size: 1rem;
  }

  .footer {
    font-size: 0.7rem;
  }
}

/* ==========================================================
 * 15. EXTRA SMALL (≤375px)
 * ========================================================== */

@media (max-width: 375px) {
  .logo-top img {
    width: 100px;
  }

  .container {
    padding: 22px 16px;
    max-width: 95%;
  }

  .login-box h3 {
    font-size: 1.25rem;
  }

  .login-box .subtitle {
    font-size: 0.75rem;
  }

  .form-group input {
    font-size: 16px;
    padding: 10px 38px 10px 10px;
  }
}

/* ==========================================================
 * 16. CAPS LOCK WARNING
 * ========================================================== */

.caps-warning {
  font-size: 0.78rem;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.4);
  margin-top: 5px;
  padding: 0;
  background: none;
  border: none;
}

body.dark-mode .caps-warning {
  color: rgba(255, 255, 255, 0.35);
}