/* Web PixelFlow — browser-based Pixelhue device control */

.wpf-app { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Connection panel */
.wpf-connect {
  background: var(--color-bg-alt, #f6f6f6);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
  padding: 28px;
  margin-bottom: 24px;
}
.wpf-connect h2 { text-align: left; margin: 0 0 18px; font-size: 1.15rem; }
.wpf-connect-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  align-items: end;
}
.wpf-connect-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  align-items: end;
}
.wpf-field { display: flex; flex-direction: column; gap: 4px; }
.wpf-field label { font-size: .82rem; font-weight: 600; color: var(--color-muted, #666); text-transform: uppercase; letter-spacing: .04em; }
.wpf-connect-actions { display: flex; gap: 10px; margin-top: 18px; }

/* Status indicator */
.wpf-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.wpf-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.wpf-status-dot.connected { background: #22c55e; }
.wpf-status-dot.disconnected { background: #ef4444; }
.wpf-status-dot.connecting { background: #f59e0b; animation: wpf-pulse 1s infinite; }
@keyframes wpf-pulse { 0%,100% { opacity:1 } 50% { opacity:.4 } }

/* Dashboard cards */
.wpf-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.wpf-card {
  background: #fff;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
  padding: 20px;
}
.wpf-card-label {
  font-size: .78rem;
  color: var(--color-muted, #666);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.wpf-card-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text, #111);
  word-break: break-all;
}

/* Tables */
.wpf-table-wrap { overflow-x: auto; margin: 14px 0; }
.wpf-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .9rem;
}
.wpf-table th {
  background: var(--color-bg-alt, #f6f6f6);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  border: 1px solid var(--color-border, #e0e0e0);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.wpf-table td {
  padding: 10px 14px;
  border: 1px solid var(--color-border, #e0e0e0);
}
.wpf-table tr:hover td { background: #fafbfc; }
.wpf-table tr.wpf-row-active td { background: #eff6ff; }

/* Signal badges */
.wpf-signal { display: inline-flex; align-items: center; gap: 6px; }
.wpf-signal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wpf-signal-ok { background: #22c55e; }
.wpf-signal-none { background: #ef4444; }
.wpf-signal-na { background: #9ca3af; }

/* TAKE button */
.wpf-take-btn {
  background: #dc2626;
  color: #fff;
  padding: 12px 36px;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: background .15s;
}
.wpf-take-btn:hover { background: #b91c1c; }
.wpf-take-btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* Cert guide callout */
.wpf-cert-guide {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  padding: 20px;
  margin: 14px 0;
  line-height: 1.7;
}
.wpf-cert-guide h3 { margin: 0 0 10px; font-size: 1rem; color: #92400e; }
.wpf-cert-guide ol { margin: 10px 0; padding-left: 24px; }
.wpf-cert-guide code {
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: .88rem;
  word-break: break-all;
}

/* Section headers */
.wpf-section { margin: 30px 0; }
.wpf-section h2 {
  text-align: left;
  font-size: 1.2rem;
  border-bottom: 2px solid var(--color-primary, #0064c8);
  padding-bottom: 8px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form inputs */
.wpf-input {
  padding: 9px 12px;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  font-size: .92rem;
  font-family: inherit;
  width: 100%;
  background: #fff;
}
.wpf-input:focus { border-color: var(--color-primary, #0064c8); outline: none; box-shadow: 0 0 0 2px rgba(0,100,200,.15); }
.wpf-select {
  padding: 9px 12px;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  font-size: .92rem;
  font-family: inherit;
  background: #fff;
  min-width: 140px;
}

/* Buttons */
.wpf-btn {
  padding: 9px 20px;
  border: 1px solid var(--color-primary, #0064c8);
  border-radius: 4px;
  background: var(--color-primary, #0064c8);
  color: #fff;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  white-space: nowrap;
}
.wpf-btn:hover { background: var(--color-primary-hover, #0055b0); }
.wpf-btn:disabled { background: #9ca3af; border-color: #9ca3af; cursor: not-allowed; }
.wpf-btn-outline {
  padding: 9px 20px;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  background: #fff;
  color: var(--color-text, #111);
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s;
  white-space: nowrap;
}
.wpf-btn-outline:hover { border-color: var(--color-primary, #0064c8); color: var(--color-primary, #0064c8); }

/* Error banner */
.wpf-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 4px;
  padding: 14px 18px;
  color: #991b1b;
  margin: 14px 0;
  font-size: .92rem;
}

/* Recent devices pills */
.wpf-recent { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.wpf-recent-pill {
  background: #fff;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: .84rem;
  font-family: inherit;
  transition: all .15s;
}
.wpf-recent-pill:hover { border-color: var(--color-primary, #0064c8); background: #eff6ff; }
.wpf-recent-clear {
  background: none;
  border: none;
  color: var(--color-muted, #666);
  font-size: .8rem;
  cursor: pointer;
  padding: 5px 8px;
  font-family: inherit;
}
.wpf-recent-clear:hover { color: #ef4444; }

/* Action log */
.wpf-log {
  background: #1e293b;
  color: #94a3b8;
  font-family: 'Roboto Mono', 'Consolas', monospace;
  font-size: .8rem;
  padding: 14px;
  max-height: 140px;
  overflow-y: auto;
  margin: 14px 0;
  border-radius: 4px;
  line-height: 1.6;
}
.wpf-log-entry { margin: 1px 0; }
.wpf-log-time { color: #64748b; }
.wpf-log-ok { color: #22c55e; }
.wpf-log-err { color: #ef4444; }
.wpf-log-warn { color: #f59e0b; }

/* Switching controls */
.wpf-switch-controls {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
  margin: 18px 0;
  padding: 18px;
  background: var(--color-bg-alt, #f6f6f6);
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
}

/* Scan result cards */
.wpf-scan-card {
  background: #fff;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.wpf-scan-card:hover { border-color: var(--color-primary, #0064c8); }

/* Hidden until connected */
.wpf-hidden { display: none !important; }

/* Tab bar */
.wpf-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border, #e0e0e0);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.wpf-tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: var(--color-muted, #666);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.wpf-tab-btn:hover { color: var(--color-primary, #0064c8); }
.wpf-tab-btn.wpf-tab-active {
  color: var(--color-primary, #0064c8);
  border-bottom-color: var(--color-primary, #0064c8);
}
.wpf-tab-content-wrap { min-height: 300px; }

/* Layer canvas */
.wpf-canvas-area {
  background: #1a1a2e;
  border: 2px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
  margin: 0 auto;
}
.wpf-canvas-layer {
  transition: box-shadow .1s;
}
.wpf-canvas-layer:hover {
  z-index: 20 !important;
  filter: brightness(1.1);
}
.wpf-canvas-selected {
  z-index: 10 !important;
}

/* API Explorer */
.wpf-api-cat {
  margin-bottom: 16px;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 6px;
  overflow: hidden;
}
.wpf-api-cat-title {
  padding: 12px 18px;
  background: var(--color-bg-alt, #f6f6f6);
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  user-select: none;
}
.wpf-api-cat-title:hover { background: #eef; }
.wpf-api-endpoint {
  border-top: 1px solid var(--color-border, #e0e0e0);
  padding: 10px 18px;
}
.wpf-api-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wpf-method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: .75rem;
  font-weight: 700;
  font-family: 'Roboto Mono', 'Consolas', monospace;
  letter-spacing: .03em;
}
.wpf-method-get { background: #dbeafe; color: #1d4ed8; }
.wpf-method-put { background: #fef3c7; color: #92400e; }
.wpf-method-post { background: #d1fae5; color: #065f46; }
.wpf-method-delete { background: #fee2e2; color: #991b1b; }
.wpf-api-path {
  font-family: 'Roboto Mono', 'Consolas', monospace;
  font-size: .85rem;
  color: var(--color-text, #111);
}
.wpf-api-panel {
  margin-top: 10px;
  padding: 12px;
  background: #fafbfc;
  border: 1px solid var(--color-border, #e0e0e0);
  border-radius: 4px;
}
.wpf-api-body {
  font-family: 'Roboto Mono', 'Consolas', monospace;
  font-size: .82rem;
  resize: vertical;
  min-height: 60px;
}
.wpf-api-result { margin-top: 10px; }
.wpf-api-response {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 4px;
  font-family: 'Roboto Mono', 'Consolas', monospace;
  font-size: .78rem;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 6px 0 0;
}

/* Responsive */
@media (max-width: 768px) {
  .wpf-connect-form { grid-template-columns: 1fr; }
  .wpf-connect-row { flex-direction: column; }
  .wpf-dashboard { grid-template-columns: repeat(2, 1fr); }
  .wpf-switch-controls { flex-direction: column; }
}
@media (max-width: 480px) {
  .wpf-app { padding: 0 12px; }
  .wpf-dashboard { grid-template-columns: 1fr; }
  .wpf-connect { padding: 18px; }
}
