* {
  box-sizing: border-box;
  font-family: "Rubik", "Assistant", sans-serif;
  margin: 0;
  padding: 0;
}

/* ACCENT COLOR SYSTEM */
:root {
  --accent-main: #007da8;
  --accent-secondary: #0099cc;
}

:root[data-accent="blue"] {
  --accent-main: #007da8;
  --accent-secondary: #0099cc;
}

:root[data-accent="teal"] {
  --accent-main: #008c7a;
  --accent-secondary: #00b89a;
}

:root[data-accent="purple"] {
  --accent-main: #6d28d9;
  --accent-secondary: #8b5cf6;
}

/* THEMES */
body.dark-theme {
  background: linear-gradient(120deg, #0e0e0f, #1b1c1f 30%, var(--accent-main) 90%);
  color: #fff;
}

body.light-theme {
  background: linear-gradient(120deg, #f3f4f6, #e5e7eb 30%, #c7d2fe 90%);
  color: #111827;
}

/* GLOBAL LAYOUT */
body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 40px;
  position: relative;
}

/* decorative floating glow circle */
.circle {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 125, 168, 0.5), transparent 70%);
  top: -150px;
  right: -150px;
  animation: float 8s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes float {
  from { transform: translateY(0px); }
  to { transform: translateY(25px); }
}

/* SETTINGS BUTTON (Bubble style pill) */
.settings-button {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 3;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 18px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.8);
  color: #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body.light-theme .settings-button {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
}

.settings-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.45);
}

/* SETTINGS PANEL (like HA sidebar popout) */
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 80vw;
  background: rgba(15, 23, 42, 0.97);
  color: #e5e7eb;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.7);
  transform: translateX(110%);
  transition: transform 0.25s ease-out;
  z-index: 4;
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
}

body.light-theme .settings-panel {
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.settings-header span {
  letter-spacing: 0.03em;
}

.close-settings {
  border: none;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  background: rgba(31, 41, 55, 0.9);
  color: #e5e7eb;
  font-size: 16px;
}

body.light-theme .close-settings {
  background: rgba(209, 213, 219, 0.9);
  color: #111827;
}

.settings-section {
  margin-top: 16px;
  padding: 12px 10px 10px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.18), transparent 70%);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.settings-section h2 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 8px;
}

body.light-theme .settings-section h2 {
  color: #6b7280;
}

.switch-row,
.select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.95rem;
}

.switch-row span,
.select-row span {
  margin-right: 8px;
}

/* TOGGLE SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #4b5563;
  border-radius: 999px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: linear-gradient(90deg, var(--accent-main), var(--accent-secondary));
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* SELECT */
.select-row select {
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.85rem;
  outline: none;
}

body.light-theme .select-row select {
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  border-color: #9ca3af;
}

.settings-footer {
  margin-top: 14px;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* LOGO ABOVE THE BOX */
.logo-wrapper {
  z-index: 2;
  margin-bottom: 25px;
}

.logo-wrapper img {
  width: 280px;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.5));
}

/* MAIN LOGIN BOX */
.container {
  position: relative;
  z-index: 1;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.5);
  backdrop-filter: blur(18px);
  border-radius: 24px;
  padding: 45px 40px 35px;
  text-align: center;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  animation: fadeIn 1s ease;
}

body.light-theme .container {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(209, 213, 219, 0.9);
  color: #111827;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  color: #e5e7eb;
}

body.light-theme h1 {
  color: #111827;
}

p {
  font-size: 1rem;
  color: #9ca3af;
  margin-bottom: 24px;
}

body.light-theme p {
  color: #4b5563;
}

/* INPUT */
input[type="text"] {
  width: 100%;
  padding: 15px 18px;
  font-size: 1.05rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
  text-align: center;
  transition: all 0.25s ease;
}

body.light-theme input[type="text"] {
  background: rgba(243, 244, 246, 0.95);
  color: #111827;
}

input[type="text"]:focus {
  border-color: var(--accent-main);
  box-shadow: 0 0 0 1px var(--accent-main), 0 0 14px rgba(0, 125, 168, 0.7);
  outline: none;
  background: #020617;
}

body.light-theme input[type="text"]:focus {
  background: #ffffff;
}

/* SITE CHIPS (examples) */
.site-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.site-chips button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.85);
  padding: 5px 12px;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease, border-color 0.2s ease;
}

body.light-theme .site-chips button {
  background: rgba(243, 244, 246, 0.95);
  color: #111827;
}

.site-chips button:hover {
  border-color: var(--accent-main);
  background: rgba(15, 23, 42, 1);
  transform: translateY(-1px);
}

body.light-theme .site-chips button:hover {
  background: #ffffff;
}

/* CONTINUE BUTTON */
button#continueBtn {
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--accent-main), var(--accent-secondary));
  color: #fff;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

button#continueBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.85);
}

/* ERROR MESSAGE */
.error {
  color: #fcd34d;
  font-size: 0.9rem;
  margin-top: 12px;
  display: none;
}

/* FOOTER */
footer {
  margin-top: 30px;
  font-size: 0.9rem;
  color: #9ca3af;
  line-height: 1.6;
}

body.light-theme footer {
  color: #6b7280;
}

footer a {
  color: var(--accent-secondary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: #38bdf8;
}

/* RESPONSIVE */
@media (max-width: 480px) {
  .container {
    padding: 30px 22px 26px;
  }

  h1 {
    font-size: 1.7rem;
  }

  .logo-wrapper img {
    width: 220px;
  }

  .settings-panel {
    width: 280px;
  }
}
