/* ─────────────────────────────────────────────────────────────────
   css/smart-hub.css — Phase 3.6 (2026-05-25)
   Smart Hub MQTT broker config + tile-binding modal.
   Class namespace .smarthub-* — distinct from .bizpro-* / .aicm-*.
   Visual language matches business-profile.css (brand-blue CTAs,
   --surface elevation, --border, --radius tokens).
   ───────────────────────────────────────────────────────────────── */

/* Floating action button — bottom-right, slightly offset from
   .bizpro-fab (which sits at 1.25rem) so both can coexist when
   both modules are loaded. Z-index matches bizpro-fab. */
.smarthub-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 5.5rem;
  z-index: 1500;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--brand-blue, #1976D2);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(26, 26, 46, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background-color 120ms ease;
}
.smarthub-fab:hover { background: var(--brand-blue-dark, #0D47A1); transform: scale(1.05); }
.smarthub-fab:active { transform: scale(0.96); }
.smarthub-fab:focus-visible { outline: 3px solid var(--brand-blue-light, #64B5F6); outline-offset: 2px; }

/* Backdrop / Modal shell — same shape as .bizpro-* */
.smarthub-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(12, 21, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overscroll-behavior: contain;
}
.smarthub-card {
  background: var(--surface, var(--bg-elev, #fff));
  border: 1px solid var(--border, #E5DDD0);
  border-radius: var(--radius-lg, 18px);
  box-shadow: var(--shadow-xl, 0 16px 50px rgba(26, 26, 46, 0.16));
  width: min(620px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  color: var(--ink, #1A1A2E);
  font-family: 'DM Sans', sans-serif;
}

/* Header */
.smarthub-header {
  padding: 1.25rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border-light, #EDE8E0);
}
.smarthub-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}
.smarthub-subtitle {
  font-size: 0.85rem;
  color: var(--ink-soft, #4A4A5A);
  margin: 0;
  line-height: 1.4;
}

/* Connection status pill (top-right of header) */
.smarthub-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #ECEFF1;
  color: #455A64;
  margin-top: 0.25rem;
}
.smarthub-status.is-connected { background: #E8F5E9; color: #2E7D32; }
.smarthub-status.is-connecting { background: #FFF8E1; color: #B26A00; }
.smarthub-status.is-error { background: #FFEBEE; color: #C62828; }
.smarthub-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}

/* Tab strip */
.smarthub-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1.25rem 0;
}
.smarthub-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft, #4A4A5A);
  cursor: pointer;
  font-family: inherit;
}
.smarthub-tab.is-active {
  color: var(--brand-blue, #1976D2);
  border-bottom-color: var(--brand-blue, #1976D2);
}

/* Body / form sections */
.smarthub-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.smarthub-field { margin-bottom: 0.85rem; }
.smarthub-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft, #4A4A5A);
  margin-bottom: 0.25rem;
}
.smarthub-input,
.smarthub-select,
.smarthub-textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border, #E5DDD0);
  font-size: 16px; /* iOS-zoom defense — see mobile-tokens.css */
  font-family: inherit;
  background: #fff;
  color: var(--ink, #1A1A2E);
  box-sizing: border-box;
}
.smarthub-input:focus,
.smarthub-select:focus,
.smarthub-textarea:focus {
  outline: 2px solid var(--brand-blue, #1976D2);
  outline-offset: 1px;
}
.smarthub-textarea { min-height: 64px; resize: vertical; }
.smarthub-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-faint, #7A7A8E);
  margin-top: 0.2rem;
}

/* Binding list (per-tile rows) */
.smarthub-bindings {
  border: 1px solid var(--border-light, #EDE8E0);
  border-radius: 10px;
  padding: 0.25rem;
  max-height: 260px;
  overflow-y: auto;
}
.smarthub-binding-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border-light, #EDE8E0);
}
.smarthub-binding-row:last-child { border-bottom: none; }
.smarthub-binding-meta { min-width: 0; }
.smarthub-binding-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smarthub-binding-detail {
  font-size: 0.78rem;
  color: var(--ink-soft, #4A4A5A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smarthub-binding-empty {
  padding: 1rem;
  text-align: center;
  color: var(--ink-soft, #4A4A5A);
  font-size: 0.88rem;
}

/* Footer / button bar */
.smarthub-footer {
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid var(--border-light, #EDE8E0);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.smarthub-btn {
  min-height: 44px; /* touch target floor */
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: #ECEFF1;
  color: var(--ink, #1A1A2E);
}
.smarthub-btn:hover { background: #DDE2E6; }
.smarthub-btn.is-primary {
  background: var(--brand-blue, #1976D2);
  color: #fff;
  border-color: var(--brand-blue, #1976D2);
}
.smarthub-btn.is-primary:hover { background: var(--brand-blue-dark, #0D47A1); }
.smarthub-btn.is-danger { background: #FFEBEE; color: #C62828; }
.smarthub-btn.is-danger:hover { background: #FFCDD2; }
.smarthub-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.smarthub-btn-small {
  min-height: 32px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

/* Mobile compaction */
@media (max-width: 640px) {
  .smarthub-fab { right: 0.85rem; bottom: 4.75rem; }
  .smarthub-card { width: 100%; max-height: 95vh; border-radius: 14px; }
  .smarthub-header, .smarthub-body, .smarthub-footer { padding-left: 1rem; padding-right: 1rem; }
}
