/* ECO-ESS Customer Portal — Dark theme matching setup tool */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2a2d3a;
  --text: #e4e6ef;
  --text-muted: #8b8fa3;
  --accent: #50ab31;
  --accent-hover: #45952a;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --warning: #f39c12;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout ─────────────────────────────────────────── */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.header {
  text-align: center;
  padding: 32px 0 16px;
}

.header h1 {
  color: var(--accent);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Forms ──────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--accent);
}

.form-group input::placeholder {
  color: #555;
}

/* ── Buttons ────────────────────────────────────────── */

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  text-align: center;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
  display: inline-block;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  width: auto;
  display: inline;
}

/* ── Messages ───────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.alert-success {
  background: rgba(80, 171, 49, 0.15);
  color: var(--accent);
  border: 1px solid rgba(80, 171, 49, 0.3);
}

.alert-info {
  background: rgba(52, 152, 219, 0.15);
  color: #5dade2;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

/* ── Devices ────────────────────────────────────────── */

.device-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.device-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.device-card .device-site {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.device-card .device-id {
  color: var(--text-muted);
  font-size: 11px;
  font-family: monospace;
}

/* ── Toggle Switches ────────────────────────────────── */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-row label {
  font-size: 14px;
  color: var(--text);
}

.toggle-row .toggle-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  margin-left: 12px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch .slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ── Push notification banner ───────────────────────── */

.push-banner {
  background: rgba(80, 171, 49, 0.1);
  border: 1px solid rgba(80, 171, 49, 0.3);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

.push-banner p {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text);
}

.push-banner .push-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Section Headers ────────────────────────────────── */

.section-title {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Account Section ────────────────────────────────── */

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.account-row .label {
  color: var(--text-muted);
  font-size: 13px;
}

.account-row .value {
  font-size: 14px;
}

/* ── Loading ────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  display: none;
}

.loading-overlay.show {
  display: flex;
}

/* ── Footer ─────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 24px 0;
  font-size: 11px;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Smart Home Buttons ────────────────────────────── */

.smarthome-buttons {
  display: flex;
  gap: 12px;
}

.btn-smarthome {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  border: none;
}

.btn-smarthome:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-smarthome:active {
  transform: translateY(0);
}

.btn-google {
  background: #fff;
  color: #3c4043;
}

.btn-alexa {
  background: #232f3e;
  color: #00caff;
  border: 1px solid #394b5f;
}

@media (max-width: 360px) {
  .smarthome-buttons {
    flex-direction: column;
  }
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 480px) {
  .container {
    padding: 16px 12px;
  }

  .card {
    padding: 18px;
  }
}

/* ── Utility ────────────────────────────────────────── */

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.hidden { display: none; }
