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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f7fafc;
  color: #1a202c;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== NAVBAR ========== */
.navbar {
  background: #1a202c;
  color: #fff;
  padding: 0.85rem 1rem;
  position: relative;
  z-index: 100;
  min-height: 56px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 1rem;
}

.nav-brand {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  font-weight: 700;
  font-size: 1.1rem;
  position: static;
  transform: none;
}

.hamburger {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  position: static;
  transform: none;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  z-index: 110;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

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

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

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

.nav-links {
  grid-column: 1 / -1;
  grid-row: 2;
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  background: #2d3748;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
  margin: 0;
  padding: 0;
  z-index: 105;
}

.navbar.nav-open .nav-links {
  max-height: 320px;
  opacity: 1;
  transform: translateY(0);
}

.nav-links li a {
  display: block;
  padding: 0.9rem 1.25rem;
  color: #edf2f7;
  text-decoration: none;
}

.nav-links li a:hover {
  background: #4a5568;
}

#adminNav {
  display: none;
}

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

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 90;
}

.nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ========== MAIN ========== */
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.login-card,
.dashboard-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.dashboard-card {
  max-width: 640px;
}

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

.login-card h1,
.dashboard-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.login-card h1,
.login-card .subtitle {
  text-align: left;
}

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

/* ========== FORMS ========== */
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
  text-align: left;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
}

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

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

.checkbox-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.checkbox-group label {
  margin: 0;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

button,
.btn {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #3182ce;
  color: #fff;
  min-height: 44px;
}

button:hover,
.btn:hover {
  background: #2b6cb0;
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.server-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  display: none;
}

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

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

/* ========== LISTS ========== */
.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.user-row button {
  width: auto;
  padding: 0.45rem 0.75rem;
  background: #e53e3e;
  font-size: 0.85rem;
  min-height: 36px;
}

.user-row button:hover {
  background: #c53030;
}

/* ========== PASSWORD STRENGTH ========== */
.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;
}

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

/* ========== FOOTER ========== */
.footer {
  text-align: center;
  padding: 1rem;
  color: #718096;
  font-size: 0.85rem;
}

/* ========== DESKTOP ========== */
@media (min-width: 768px) {
  .navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .nav-brand {
    position: static;
  }

  .hamburger {
    display: none !important;
  }

  .nav-links {
    position: static;
    display: flex;
    align-items: center;
    width: auto;
    max-height: none;
    opacity: 1;
    transform: none;
    background: transparent;
    overflow: visible;
  }

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

  .nav-overlay {
    display: none;
  }
}