/* ------------------ THEME VARIABLES ------------------ */
:root {
  --bg: #f6f7f9;
  --card-bg: #ffffff;
  --text: #111;
  --subtext: #555;
  --accent: #2b7bff;
  --border: #e5e7eb;
  --shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.dark {
  --bg: #0d0f12;
  --card-bg: #1a1c20;
  --text: #f1f1f1;
  --subtext: #aaa;
  --accent: #4da3ff;
  --border: #2a2d33;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* ------------------ GLOBAL ------------------ */
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

h3 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 600;
}

/* ------------------ HEADER ------------------ */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}

.title {
  font-size: 20px;
  font-weight: 600;
}

/* ------------------ MENU ------------------ */
.menu-wrapper {
  position: relative;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 24px;
  padding: 6px;
  cursor: pointer;
  color: var(--text);
}

.menu-dropdown {
  position: absolute;
  right: 0;
  top: 36px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 30;
  display: none;
}

.menu-dropdown button {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

.menu-dropdown button:hover {
  background: rgba(0,0,0,0.06);
}

/* ------------------ CARDS ------------------ */
.card {
  background: var(--card-bg);
  margin: 16px;
  padding: 16px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: background 0.3s, border 0.3s;
}

.card label {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: var(--subtext);
}

.card input,
.card select {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s, border 0.3s;
}

/* ------------------ BUTTONS ------------------ */
button {
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  margin-top: 16px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: background 0.2s;
}

button:active {
  opacity: 0.85;
}

/* ------------------ STATUS BAR ------------------ */
.status-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.bg-value {
  font-size: 26px;
  font-weight: bold;
}

.bg-connection.offline {
  color: #dc2626;
}

.bg-connection.online {
  color: #16a34a;
}

/* ------------------ TOAST ------------------ */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 200;
  font-weight: 500;
}

#toast.show {
  opacity: 1;
}

/* ------------------ SETTINGS BOTTOM SHEET ------------------ */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: none;
}

.settings-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -100%;
  background: var(--card-bg);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 20px rgba(0,0,0,0.25);
  z-index: 60;
  max-height: 85vh;
  overflow-y: auto;
  transition: bottom 0.35s ease;
  display: none;
  border: 1px solid var(--border);
}

.settings-sheet.active {
  bottom: 0;
}

/* Sheet header */
.sheet-header {
  position: sticky;
  top: 0;
  background: var(--card-bg);
  padding: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-handle {
  width: 45px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  margin: 0 auto 10px auto;
}

.sheet-title {
  font-size: 20px;
  font-weight: 600;
}

.sheet-close {
  background: none;
  border: none;
  font-size: 24px;
  padding: 4px;
  cursor: pointer;
  color: var(--text);
}

/* Sheet content */
.sheet-content {
  padding: 18px;
}

/* Save button */
.save-btn {
  width: 100%;
  background: var(--accent);
  padding: 16px;
  border-radius: 14px;
  font-size: 17px;
  margin-top: 20px;
  font-weight: 600;
}
