@import url('https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,400,500,700,900&display=swap');

/* ----------------------------------------------
   Root Variables
---------------------------------------------- */
:root {
  --primary: #007bff;
  --primary-dark: #0056b3;
  --blue: #03a9f4;
  
  /* Theme Colors */
  --dark-bg: #0e1417;
  --dark-nav: rgba(14,20,23,0.8);
  --dark-container: rgba(27,36,41,0.9);
  --dark-text: #ffffff;
  --light-bg: #f7f9fa;
  --light-nav: rgba(255,255,255,0.9);
  --light-container: rgba(255,255,255,0.9);
  --light-text: #333333;

  /* For progress bars, cards, etc. */
  --card-bg-dark: #1b2429;
  --card-bg-light: #ffffff;
  --card-border-dark: #2e3a40;
  --card-border-light: #e0e0e0;

  /* Transitions & Sizing */
  --transition-speed: 0.3s;
  --border-radius: 8px;
  --box-padding: 20px;
  --container-max-width: 1200px;

  /* Font Sizing */
  --title-font-size: 1.6rem;
  --subtitle-font-size: 1.1rem;
  --heading-font-size: 1.3rem;
  --regular-font-size: 1rem;
}

/* ----------------------------------------------
   Reset & Base
---------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  height: 100%;
}
body {
  font-family: 'Roboto', sans-serif;
  /* RESTORE the background image here: */
  background: url('background.webp') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-speed);
}
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  margin-bottom: 0.5em;
}
p {
  font-size: var(--regular-font-size);
  line-height: 1.4;
  margin-bottom: 1em;
}
a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-speed);
}
button {
  cursor: pointer;
  border: none;
  outline: none;
  background: var(--primary);
  color: #fff;
  padding: 0.7em 1.2em;
  border-radius: var(--border-radius);
  font-size: var(--regular-font-size);
  font-weight: 500;
  transition: background-color 0.2s, transform 0.2s;
}
button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

/* ----------------------------------------------
   Light & Dark Theme Classes
---------------------------------------------- */
body.theme-light {
  background-color: var(--light-bg);
  color: var(--light-text);
}
body.theme-light .navbar {
  background-color: var(--light-nav);
  backdrop-filter: blur(10px);
}
body.theme-light .container {
  background-color: var(--light-container);
}
body.theme-light .footer {
  background-color: var(--light-nav);
  color: #333;
}
body.theme-light .device-row {
  background-color: var(--card-bg-light);
  border: 1px solid var(--card-border-light);
}
body.theme-light .progress-bar-container {
  background-color: #e9ecef;
}
body.theme-light .progress-bar {
  background-color: var(--primary);
}

body.theme-dark {
  background-color: var(--dark-bg);
  color: var(--dark-text);
}
body.theme-dark .navbar {
  background-color: var(--dark-nav);
  backdrop-filter: blur(10px);
}
body.theme-dark .container {
  background-color: var(--dark-container);
}
body.theme-dark .footer {
  background-color: var(--dark-nav);
  color: #fff;
}
body.theme-dark .device-row {
  background-color: var(--card-bg-dark);
  border: 1px solid var(--card-border-dark);
}
body.theme-dark .progress-bar-container {
  background-color: var(--card-border-dark);
}
body.theme-dark .progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--blue));
}

/* ----------------------------------------------
   Navbar
---------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 999;
  padding: 0.6em 1em;
  display: flex;
  justify-content: center;
  transition: background-color var(--transition-speed);
}
.nav-inner {
  width: 100%;
  max-width: var(--container-max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-left a {
  font-size: 1.3rem;
  font-weight: 700;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
.nav-links a {
  font-size: 1rem;
  padding: 0.4em 0.8em;
  border-radius: var(--border-radius);
  color: inherit;
  font-weight: 500;
}
.nav-links a:hover {
  background-color: rgba(255,255,255,0.15);
}
.nav-links a.active {
  background-color: rgba(255,255,255,0.25);
  font-weight: 700;
}
.logout-link {
  color: #ff5555 !important;
  font-weight: 500;
}

/* ----------------------------------------------
   Container
---------------------------------------------- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 1.5em auto;
  border-radius: var(--border-radius);
  padding: var(--box-padding);
  backdrop-filter: blur(10px);
  overflow-x: hidden; /* prevent horizontal scroll on small screens */
}

/* ----------------------------------------------
   Headings, Titles, and Text
---------------------------------------------- */
h1 {
  font-size: var(--title-font-size);
  margin-bottom: 0.5em;
}
.monitor-title {
  font-size: var(--heading-font-size);
  font-weight: 600;
  margin: 1.2em 0 0.8em 0;
}
.device-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4em;
}
.status-text {
  font-size: 0.95rem;
  opacity: 0.85;
  margin: 0.4em 0;
}

/* ----------------------------------------------
   Device Row & Progress Bar
---------------------------------------------- */
.device-row {
  margin-bottom: 1em;
  padding: 1em;
  border-radius: var(--border-radius);
  transition: background-color var(--transition-speed);
}
.progress-bar-container {
  position: relative;
  border-radius: var(--border-radius);
  height: 12px;
  width: 100%;
  max-width: 600px;
  margin: 0.6em 0;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--border-radius);
  transition: width 0.5s ease-in-out;
}
.progress-label-right {
  float: right;
  font-size: 0.9rem;
  margin-top: -1.6em;
  font-weight: 500;
  opacity: 0.9;
}

/* ----------------------------------------------
   Admin Boxes (login, settings, etc.)
---------------------------------------------- */
.admin-box {
  background-color: rgba(255,255,255,0.08);
  border-radius: var(--border-radius);
  margin-top: 1.5em;
  padding: 1em;
  transition: background-color var(--transition-speed);
}
body.theme-light .admin-box {
  background-color: #fff;
}
.error {
  color: #ff5555;
  margin-bottom: 10px;
  font-style: italic;
}
.success {
  color: #3ddc97;
  margin-bottom: 10px;
  font-weight: 500;
}

/* ----------------------------------------------
   Form Inputs
---------------------------------------------- */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.6em 0.8em;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  margin-top: 0.3em;
  font-size: 0.95rem;
  transition: border 0.2s;
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border: 1px solid var(--primary);
}
body.theme-dark input[type="text"],
body.theme-dark input[type="password"] {
  background-color: #1b2429;
  color: #ffffff;
  border: 1px solid #333;
}
body.theme-dark input[type="text"]:focus,
body.theme-dark input[type="password"]:focus {
  border: 1px solid var(--blue);
}

/* ----------------------------------------------
   Toggles (Switches)
---------------------------------------------- */
.switch-container {
  display: flex;
  align-items: center;
  margin-bottom: 0.8em;
}
.switch-label {
  margin-left: 0.6em;
  font-size: 0.95rem;
}
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #00b300;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* ----------------------------------------------
   Footer
---------------------------------------------- */
.footer {
  padding: 1em 0;
  text-align: center;
  backdrop-filter: blur(10px);
  background-color: rgba(0,0,0,0.3);
  color: #fff;
  transition: background-color var(--transition-speed);
  margin-top: auto;
  font-size: 0.9rem;
}
body.theme-light .footer {
  background-color: rgba(255,255,255,0.7);
  color: var(--light-text);
}

/* ----------------------------------------------
   Buttons (global override)
---------------------------------------------- */
button {
  display: inline-block;
  margin: 0.5em 0;
  text-align: center;
  font-size: 1rem;
}
button[type="submit"],
button[type="button"] {
  width: auto;
}

/* ----------------------------------------------
   Mobile Responsiveness
---------------------------------------------- */
@media (max-width: 768px) {
  .nav-inner {
    flex-direction: column;
    align-items: center;
    gap: 0.8em;
  }
  .nav-left a {
    margin-bottom: 0.4em;
  }
  .nav-links {
    flex-direction: column;
    gap: 0.6em;
  }
  .nav-links a {
    width: 100%;
    text-align: center;
    padding: 0.6em;
  }
  .container {
    margin: 0;
    border-radius: 0;
    padding: 1em;
  }
  .admin-box {
    padding: 1em;
  }
  button {
    width: 100%;
    margin: 0.6em 0;
  }
  .progress-bar-container {
    width: 100%;
  }
}
