/* ===== MOBILE FIRST ===== */

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #333;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.97);
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 100;
}

.nav-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: #5a67d8;
}

/* Hamburger button */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 22px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 110;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  background: #4a5568;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* Overlay backdrop */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Animate to X when open */
.navbar.nav-open .hamburger span:nth-child(1) {
  transform: translateY(9.5px) rotate(45deg);
}

.navbar.nav-open .hamburger span:nth-child(2) {
  opacity: 0;
}

.navbar.nav-open .hamburger span:nth-child(3) {
  transform: translateY(-9.5px) rotate(-45deg);
}

/* Mobile nav links - animated slide */
.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 0;
  gap: 0.25rem;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);

  /* Animation start state */
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.3s ease, margin-top 0.3s ease;
}

.navbar.nav-open .nav-links {
  max-height: 320px;          /* enough room for the links */
  opacity: 1;
  transform: translateY(0);
  margin-top: 0.75rem;
  pointer-events: auto;
}

.nav-links li {
  width: 100%;
}

.nav-links a {
  display: block;
  text-decoration: none;
  color: #4a5568;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.9rem 1.1rem;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a:focus {
  background: #f7fafc;
  color: #5a67d8;
}

/* Hide admin link by default (shown only for jeff via JS) */
#adminNav {
  display: none;
}

#adminNav.show {
  display: block;
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem 1rem;
}

/* Cards */
.login-card,
.dashboard-card {
  background: white;
  padding: 1.75rem 1.25rem;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  width: 100%;
  max-width: 100%;
}

.dashboard-card {
  text-align: center;
}

.admin-card {
  text-align: left;
}

.login-card h1,
.dashboard-card h1 {
  font-size: 1.55rem;
  margin-bottom: 0.35rem;
  color: #2d3748;
}

.subtitle,
.welcome-text {
  color: #718096;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.15rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #4a5568;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

input.invalid {
  border-color: #e53e3e;
}

.error-message {
  display: block;
  color: #e53e3e;
  font-size: 0.8rem;
  margin-top: 0.3rem;
  min-height: 1.1rem;
}

.remember-me {
  margin-bottom: 1.35rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: #4a5568;
  user-select: none;
  min-height: 44px;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #667eea;
  cursor: pointer;
  flex-shrink: 0;
}

/* Buttons */
.login-btn {
  width: 100%;
  min-height: 48px;
  padding: 0.9rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
  background: #5a67d8;
}

.login-btn:active {
  transform: scale(0.98);
}

.login-btn:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

.logout-btn {
  background: #e53e3e;
  color: white;
  border: none;
  min-height: 48px;
  padding: 0.9rem 1.6rem;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.logout-btn:hover {
  background: #c53030;
}

.server-message {
  margin-top: 1.1rem;
  padding: 0.85rem;
  border-radius: 10px;
  text-align: center;
  font-size: 0.95rem;
  display: none;
}

.server-message.success {
  display: block;
  background: #c6f6d5;
  color: #276749;
}

.server-message.error {
  display: block;
  background: #fed7d7;
  color: #c53030;
}

.form-footer {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.95rem;
  color: #718096;
}

.form-footer a {
  color: #667eea;
  font-weight: 600;
  text-decoration: none;
}

.form-footer a:hover {
  text-decoration: underline;
}

/* Admin list */
.users-list {
  margin: 1.25rem 0;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  gap: 0.75rem;
}

.user-row span {
  font-weight: 500;
  word-break: break-all;
}

.delete-btn {
  background: #e53e3e;
  color: white;
  border: none;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}

.delete-btn:hover {
  background: #c53030;
}

.delete-btn:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

.password-hint {
  font-size: 0.8rem;
  color: #718096;
  margin-top: 0.35rem;
}

.strength-meter {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.strength-text {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  color: #718096;
  min-height: 1.1rem;
}

.strength-text.weak { color: #e53e3e; }
.strength-text.fair { color: #dd6b20; }
.strength-text.good { color: #3182ce; }
.strength-text.strong { color: #38a169; }

/* Footer */
.footer {
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
  padding: 1rem;
  font-size: 0.875rem;
  color: #4a5568;
}

/* ===== TABLET AND UP (hamburger disappears) ===== */
@media (min-width: 640px) {
  .hamburger {
    display: none;
  }

  .navbar {
    flex-wrap: nowrap;
    padding: 1rem 1.5rem;
  }

  .nav-links {
    display: flex;
    flex-direction: row;
    width: auto;
    margin-top: 0;
    gap: 0.5rem 1.5rem;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }

  .nav-links a {
    padding: 0.4rem 0.6rem;
  }

  #adminNav.show {
    display: list-item;
  }

  .login-card,
  .dashboard-card {
    padding: 2rem 1.75rem;
    max-width: 420px;
  }

  .admin-card {
    max-width: 500px;
  }

  .login-card h1,
  .dashboard-card h1 {
    font-size: 1.7rem;
  }
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
  .navbar {
    padding: 1rem 2rem;
  }

  .main-content {
    padding: 2rem 1.5rem;
  }

  .login-card,
  .dashboard-card {
    padding: 2.5rem;
    max-width: 440px;
    border-radius: 16px;
  }

  .admin-card {
    max-width: 520px;
  }

  .login-card h1,
  .dashboard-card h1 {
    font-size: 1.85rem;
  }
}