/* ─────────────────────────────────────────
   Bakkakot Portal — Design System
   Nordic / Icelandic Dark Theme
───────────────────────────────────────── */

:root {
  --bg-base:        #08111f;
  --bg-surface:     #0d1a2e;
  --bg-card:        #112240;
  --bg-card-hover:  #152a4e;
  --border:         rgba(100, 180, 255, 0.12);
  --border-hover:   rgba(100, 180, 255, 0.28);

  --accent-blue:    #3b82f6;
  --accent-teal:    #14b8a6;
  --accent-green:   #22c55e;
  --accent-amber:   #f59e0b;
  --accent-red:     #ef4444;
  --accent-purple:  #8b5cf6;

  --text-primary:   #e2eaf8;
  --text-secondary: #7da4c8;
  --text-muted:     #4a6583;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.6);
  --glow-blue:  0 0 32px rgba(59,130,246,0.15);

  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);

  font-family: 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,17,31,0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(100,200,255,0.4));
}

.brand-name {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #e2eaf8 0%, #7da4c8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-green);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 0 0 rgba(34,197,94,0.5);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.header-time {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.header-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────
   MAIN CONTAINER
───────────────────────────────────────── */
.portal-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* ─────────────────────────────────────────
   SECTIONS
───────────────────────────────────────── */
.section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-icon { font-size: 1.1rem; }

/* ─────────────────────────────────────────
   CARD BASE
───────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(59,130,246,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow), var(--glow-blue);
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────
   WEATHER
───────────────────────────────────────── */
.weather-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.weather-current {
  text-align: center;
  padding: 2rem 1.5rem;
  background: linear-gradient(160deg, #112240 0%, #0d1a35 100%);
}

.weather-emoji-large {
  font-size: 4.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 24px rgba(100,200,255,0.3));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.weather-temp-large {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #e2eaf8 30%, #7da4c8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.weather-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.weather-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.weather-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Forecast */
.weather-forecast { padding: 1.5rem; }

.forecast-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1rem;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.forecast-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.forecast-row:last-child { border-bottom: none; }

.forecast-row:hover {
  background: rgba(59,130,246,0.05);
  border-radius: var(--radius-sm);
  padding-left: 0.5rem;
}

.forecast-emoji {
  font-size: 1.5rem;
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.forecast-weekday {
  font-weight: 600;
  font-size: 0.9rem;
  width: 7.5rem;
  flex-shrink: 0;
}

.forecast-desc {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.forecast-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  text-align: right;
}

.forecast-temp {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.forecast-wind {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────
   HOUSES GRID
───────────────────────────────────────── */
.houses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.house-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.house-card.offline { opacity: 0.6; }

.house-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.house-icon {
  font-size: 2.25rem;
  width: 3rem;
  text-align: center;
  filter: drop-shadow(0 0 8px rgba(100,200,255,0.2));
}

.house-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.house-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.house-status.online { color: var(--accent-green); }
.house-status.offline { color: var(--accent-red); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.house-status.online .status-dot {
  animation: pulse-green 2s infinite;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.5);
}

.house-metrics {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 0;
}

.metric { display: flex; flex-direction: column; gap: 0.4rem; }

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1;
}

.temp-value { color: #fbbf24; }

.metric-unit {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
}

/* Progress bars */
.temp-bar-wrap,
.humidity-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}

.temp-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3b82f6, #f59e0b, #ef4444);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.humidity-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #14b8a6, #3b82f6);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* Doors */
.doors-section { display: flex; flex-direction: column; gap: 0.5rem; }

.doors-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.doors-list { display: flex; flex-direction: column; gap: 0.4rem; }

.door-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: var(--transition);
}

.door-item.door-closed {
  background: rgba(34,197,94,0.08);
  color: var(--accent-green);
}

.door-item.door-unknown {
  background: rgba(128,128,128,0.08);
  color: var(--text-muted);
}

.door-item.door-open {
  background: rgba(239,68,68,0.08);
  color: var(--accent-red);
}

.door-icon { font-size: 0.9rem; }
.door-name { flex: 1; font-weight: 500; }

.door-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

.house-footer {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
}

.cam-start-btn {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 3px 10px;
  border: none;
  border-radius: 6px;
  background: var(--accent, #3b82f6);
  color: #fff;
  cursor: pointer;
}
.cam-start-btn:disabled { opacity: 0.5; cursor: default; }

.sim-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(128,128,128,0.12);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 4px;
  vertical-align: middle;
  title: "Hermd gögn";
}

/* ─────────────────────────────────────────
   WEBCAMS — SUÐURKOT
───────────────────────────────────────── */
.cams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.cam-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.cam-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.cam-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-green 2s infinite;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.5);
  flex-shrink: 0;
}

.offline-dot {
  background: var(--text-muted);
  animation: none;
  box-shadow: none;
}

.cam-embed {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 480/394;
  background: #000;
}

.cam-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.cam-empty .cam-embed,
.cam-placeholder {
  aspect-ratio: 16/9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem;
}

.cam-placeholder-icon { font-size: 2rem; opacity: 0.4; }

/* ─────────────────────────────────────────
   WEBCAMS — HELLISHEIÐI
───────────────────────────────────────── */
.cams-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.cam-image-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.cam-image-link {
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.cam-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  transition: var(--transition);
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--bg-surface);
}

.cam-image-link:hover .cam-image { transform: scale(1.02); }

.cam-image-error {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.cam-load-error .cam-image-error { display: flex !important; }

/* ─────────────────────────────────────────
   LINKS SECTION
───────────────────────────────────────── */
.links-card { padding: 0.5rem; }

.links-list {
  list-style: none;
}

.link-item {
  border-bottom: 1px solid var(--border);
}

.link-item:last-child { border-bottom: none; }

.link-anchor {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.link-anchor:hover {
  background: rgba(59,130,246,0.08);
  color: var(--accent-blue);
  padding-left: 1.25rem;
}

.link-icon { font-size: 1rem; flex-shrink: 0; }
.link-label { flex: 1; font-size: 0.9rem; font-weight: 500; }
.link-arrow {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: var(--transition);
}

.link-anchor:hover .link-arrow { transform: translateX(4px); color: var(--accent-blue); }

/* ─────────────────────────────────────────
   ERROR CARD
───────────────────────────────────────── */
.error-card {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: #fca5a5;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-domain {
  color: var(--accent-blue);
  font-weight: 500;
}

.refresh-notice {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0 2rem;
}

/* ─────────────────────────────────────────
   FADE-IN ANIMATION
───────────────────────────────────────── */
.section {
  animation: fadeInUp 0.5s ease both;
}

.section:nth-child(1) { animation-delay: 0.05s; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.15s; }
.section:nth-child(4) { animation-delay: 0.2s; }
.section:nth-child(5) { animation-delay: 0.25s; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────
   AURORA BACKGROUND EFFECT
───────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -10%;
  width: 50%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(20,184,166,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: aurora1 20s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 55%;
  height: 55%;
  background: radial-gradient(ellipse, rgba(59,130,246,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: aurora2 25s ease-in-out infinite alternate;
}

@keyframes aurora1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(5%, 8%) scale(1.1); }
}

@keyframes aurora2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-5%, -5%) scale(1.15); }
}

.portal-container, .site-header, .site-footer {
  position: relative;
  z-index: 1;
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 900px) {
  .weather-grid {
    grid-template-columns: 1fr;
  }
  .weather-current { text-align: left; }
  .weather-emoji-large { font-size: 3rem; }
  .weather-temp-large { font-size: 2.5rem; }
}

@media (max-width: 640px) {
  .header-meta .live-indicator { display: none; }
  .portal-container { padding: 1.25rem 1rem 3rem; gap: 2rem; }
  .forecast-weekday { width: 5.5rem; }
  .forecast-desc { display: none; }
  .houses-grid { grid-template-columns: 1fr; }
  .cams-grid { grid-template-columns: 1fr; }
  .cams-images-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: column; gap: 0.25rem; text-align: center; }
}

@media (max-width: 400px) {
  .cams-images-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────
   HEADER NAV
───────────────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.nav-link.active { color: var(--accent-blue); background: rgba(59,130,246,0.12); }

/* ─────────────────────────────────────────
   SMARTTHINGS
───────────────────────────────────────── */
.success-card {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  color: #86efac;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Setup / Connect */
.st-setup-card, .st-connect-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 3rem 2rem;
  max-width: 560px;
}

.st-setup-icon, .st-connect-icon {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 16px rgba(59,130,246,0.3));
}

.st-setup-card h3, .st-connect-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.st-setup-card p, .st-connect-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.code-block {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: #7dd3fc;
  text-align: left;
  white-space: pre;
  overflow-x: auto;
  width: 100%;
}

.st-setup-note {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
}

.st-setup-note a { color: var(--accent-blue); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-blue);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}

/* Device list */
.st-devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.st-device-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}

.st-device-card:hover { border-color: var(--border-hover); }

.st-device-card.st-device-inuse {
  border-color: rgba(16,185,129,0.55);
  background: linear-gradient(135deg, rgba(16,185,129,0.18) 0%, var(--bg-card) 60%);
}

.st-inuse-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(16,185,129,0.15);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.35);
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.st-device-icon {
  font-size: 2rem;
  width: 3rem;
  text-align: center;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(100,200,255,0.2));
}

.st-device-info { flex: 1; min-width: 0; }

.st-device-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-device-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.st-device-caps { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.cap-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: rgba(59,130,246,0.12);
  color: var(--accent-blue);
  border-radius: 999px;
  font-weight: 500;
}

.cap-more { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.st-device-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}

.st-device-card:hover .st-device-arrow { transform: translateX(4px); color: var(--accent-blue); }

.st-disconnect-link {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-red);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-transform: none;
  letter-spacing: 0;
}

.st-disconnect-link:hover { background: rgba(239,68,68,0.1); }

.st-back-link {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  transition: var(--transition);
}

.st-back-link:hover { color: var(--accent-blue); }

.st-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem;
  font-size: 2rem;
  color: var(--text-muted);
}

.st-empty p { font-size: 0.9rem; }

/* API note */
.st-api-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.api-link {
  color: var(--accent-teal);
  text-decoration: none;
  font-family: monospace;
  font-size: 0.8rem;
}

.api-link:hover { color: var(--accent-blue); }
.api-text { font-family: monospace; color: var(--text-secondary); font-size: 0.8rem; }
.api-sep { color: var(--text-muted); }

/* Device detail */
.st-device-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem;
}

.st-meta-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.st-meta-row:last-child { border-bottom: none; }

.st-meta-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  width: 6rem;
  flex-shrink: 0;
}

.st-meta-value {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.st-component { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.st-component-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.st-component-title span { color: var(--accent-teal); }

.st-capability {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.st-capability-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 0.6rem;
}

.st-attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.st-attr-table th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.st-attr-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.st-attr-table tr:last-child td { border-bottom: none; }
.st-attr-table tr:hover td { background: rgba(255,255,255,0.02); }

.attr-name { color: var(--text-secondary); font-weight: 500; }
.attr-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.val-on  { color: var(--accent-green); }
.val-off { color: var(--text-muted); }
.attr-unit { color: var(--text-muted); font-size: 0.78rem; }
.attr-ts   { color: var(--text-muted); font-size: 0.75rem; font-family: monospace; }

/* ── Fullscreen cam modal ──────────────────────────────────────────── */
.cam-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  cursor: zoom-out;
}

.cam-modal.cam-modal-open { display: flex; }

.cam-modal-img {
  max-width: 80vw;
  max-height: 80vh;
  width: 80vw;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  cursor: default;
}

.cam-modal-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  z-index: 10000;
}

.cam-modal-close:hover { background: rgba(255,255,255,0.25); }

.cam-modal-label {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.cam-iframe-wrap { position: relative; cursor: zoom-in; }
.cam-iframe-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: zoom-in;
}

.nest-modal-frame {
  width: 80vw;
  height: 80vh;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

/* ── Battery pills ──────────────────────────────────────────────────── */
.battery-pill { font-variant-numeric: tabular-nums; }

.battery-pill-low {
  background: rgba(239,68,68,0.18) !important;
  color: #f87171 !important;
  border-color: rgba(239,68,68,0.4) !important;
}

.battery-low-row td { background: rgba(239,68,68,0.05); }

.battery-low-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  background: rgba(239,68,68,0.18);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
