:root {
  --nav-bg: #0a1a2b;
  --accent: #2874f0;
  --text-light: #e1e9f0;
  --text-muted: #a0aec0;
  --error-red: #ff4c4c;
  --bg-main: #071424;
  --input-bg: #12263f;
  --input-border-focus: var(--accent);
}
.rfid-card {
  background-color: #1a1a1a;
  padding: 1.5rem;
  border: 1px solid #333;
  border-radius: 12px;
  margin: 2rem 0;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.rfid-link-btn {
  margin-top: 1rem;
  padding: 0.6rem 1.2rem;
  background-color: #005eff;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.rfid-link-btn:hover {
  background-color: #0044cc;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1500;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background-color: #222;
  margin: 10% auto;
  padding: 2rem;
  border: 1px solid #555;
  width: 90%;
  max-width: 500px;
  border-radius: 12px;
  color: white;
  position: relative;
}

.modal-content input {
  width: 100%;
  padding: 0.6rem;
  margin-top: 1rem;
  border-radius: 6px;
  border: 1px solid #555;
  background: #111;
  color: white;
}

.modal-content .close {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: white;
}

.confirm-btn {
  background-color: #00b300;
  border: none;
  padding: 0.6rem 1.5rem;
  color: white;
  margin-top: 1rem;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
}

.confirm-btn:hover {
  background-color: #008c00;
}


/* Reset and basics */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg-main);
  color: var(--text-light);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Background animation */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a1a2b 0%, #071424 100%);
  animation: backgroundShift 30s linear infinite alternate;
  z-index: -1;
}

@keyframes backgroundShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

/* Navigation */
nav.topnav {
  background-color: var(--nav-bg);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  user-select: none;
}

.nav-left,
.nav-center,
.nav-right {
  display: flex;
  align-items: center;
}

.nav-center {
  flex-grow: 1;
  justify-content: center;
  font-size: 1.8rem;
}

.nav-right a {
  color: var(--text-light);
  text-decoration: none;
  margin-left: 1.1rem;
  font-weight: 600;
  transition: color 0.25s ease;
  user-select: none;
}

.nav-right a:hover,
.nav-right a:focus {
  color: var(--accent);
  outline: none;
}

.gear {
  font-size: 1.6rem;
  cursor: pointer;
  user-select: none;
}

/* Hamburger menu button - hidden on desktop, visible on mobile */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 2.4rem;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  z-index: 1500;
}

/* Dropdown menu for mobile */
.nav-dropdown {
  display: none;
  position: fixed;
  top: 3.8rem;
  right: 1rem;
  background-color: var(--nav-bg);
  padding: 1rem;
  border-radius: 8px;
  flex-direction: column;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
  z-index: 1400;
}

.nav-dropdown a {
  color: var(--text-light);
  margin: 0.5rem 0;
  text-decoration: none;
  font-weight: 600;
  user-select: none;
}

.nav-dropdown a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Settings popup panel */
.settings-popup {
  position: fixed;
  top: 3.8rem;
  right: 1rem;
  background-color: var(--nav-bg);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
  display: none;
  width: 220px;
  z-index: 1501;
  user-select: none;
}

.settings-popup.show {
  display: block;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-weight: 600;
}

.logout-btn {
  width: 100%;
  padding: 0.5rem 0;
  background: none;
  border: none;
  color: #f44336;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  user-select: none;
}

.logout-btn:hover {
  background-color: #b71c1c;
  color: white;
}

/* Theme switch */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Auth box container */
.auth-box {
  max-width: 400px;
  margin: 5rem auto 3rem;
  background: rgba(10, 26, 43, 0.85);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  color: var(--text-light);
  font-family: inherit;
  user-select: none;
}

.auth-box h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 700;
  font-size: 1.8rem;
}

.auth-box p {
  text-align: center;
}

.auth-box a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.auth-box a:hover {
  text-decoration: underline;
}

/* Inputs */
.auth-box input[type="text"],
.auth-box input[type="email"],
.auth-box input[type="password"] {
  background-color: var(--input-bg);
  border: 2px solid transparent;
  color: var(--text-light);
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  width: 100%;
  margin-bottom: 1rem;
  transition: border-color 0.3s ease;
}

.auth-box input[type="text"]:focus,
.auth-box input[type="email"]:focus,
.auth-box input[type="password"]:focus {
  border-color: var(--input-border-focus);
  outline: none;
  background-color: #0a0a0a;
}

/* Buttons */
.auth-box button[type="submit"] {
  background-color: var(--accent);
  color: white;
  font-weight: 700;
  border: none;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
}

.auth-box button[type="submit"]:hover,
.auth-box button[type="submit"]:focus {
  background-color: #1a5fe3;
  outline: none;
}

/* Error message */
.error-message {
  color: var(--error-red);
  font-weight: 700;
  min-height: 1.3em;
  margin-bottom: 1rem;
  user-select: none;
}

/* Password rules list */
.password-rules {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  user-select: none;
}

.password-rules li {
  margin-bottom: 0.25rem;
}

/* Popup message styling */
#popupMessage {
  display: none;
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--error-red);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  z-index: 3000;
  user-select: none;
  box-shadow: 0 0 8px rgba(255, 76, 76, 0.7);
}

#popupMessage .close-btn {
  margin-left: 1rem;
  cursor: pointer;
  font-weight: 900;
  user-select: none;
}

/* Media queries: show hamburger on mobile and hide nav-right links */
@media (max-width: 768px) {
  .nav-right {
    display: none;
  }
  .hamburger {
    display: block;
  }
  .auth-box {
    margin: 3rem 1rem 2rem;
    padding: 1.5rem;
  }
}

/* Larger mobile */
@media (max-width: 1024px) {
  .auth-box {
    max-width: 350px;
  }
}
/* NAVIGATION STYLING */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background-color: #000;
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-left .gear {
  font-size: 1.4rem;
  cursor: pointer;
}

.nav-center {
  font-size: 1.5rem;
}

.nav-right a {
  color: white;
  margin-left: 1rem;
  text-decoration: none;
  font-size: 1rem;
}

.nav-right a:hover {
  text-decoration: underline;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
}

/* Mobile only */
@media screen and (max-width: 600px) {
  .desktop-links {
    display: none;
  }

  .hamburger {
    display: block;
  }

  .nav-dropdown {
    display: none;
    flex-direction: column;
    background-color: #073763;
    position: absolute;
    top: 3.2rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 6px;
  }

  .nav-dropdown.show {
    display: flex;
  }

  .nav-dropdown a {
    color: white;
    margin: 0.5rem 0;
    text-decoration: none;
  }

  .nav-dropdown a:hover {
    text-decoration: underline;
  }
}
