/* Styles for the /app demo (connection wizard + session).
   Loaded separately from site.css; classes use the app- prefix. */

.app-wrap {
  width: 50%;
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

@media (max-width: 1100px) {
  .app-wrap {
    width: 80%;
  }
}

@media (max-width: 700px) {
  .app-wrap {
    width: 94%;
  }
}

.app-muted {
  color: #8a929c;
}

.app-error {
  color: #e07a7a;
}

.app-footnote {
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* target / option cards */
.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.app-cards.setup {
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}

.app-btn,
.app-card,
.app-widget-btn,
.app-icon-btn {
  display: inline-block;
  border-radius: 0;
  border: 4px solid #444;
  background: #2d333c;
  color: inherit;
  font: inherit;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  user-select: none;
}

.app-btn,
.app-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 3rem;
  line-height: 1;
}

.app-icon-btn {
  width: 3rem;
  padding: 0;
}

.app-btn:hover,
.app-card:hover,
.app-widget-btn:hover,
.app-icon-btn:hover {
  background: #1d2127;
}

.app-btn:active,
.app-card:active,
.app-widget-btn:active,
.app-icon-btn:active {
  background: #262d36;
}

.app-btn.accent-blue:hover,
.app-btn.accent-gold:hover,
.app-btn.accent-red:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-fg-hover);
}

.app-btn.accent-blue:active,
.app-btn.accent-gold:active,
.app-btn.accent-red:active {
  background: var(--btn-bg-active);
}

.app-btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  border-color: #14171c;
  padding: 0.75rem;
}

.app-card:hover {
  background: #171b21;
  color: #fff;
}

.app-card small {
  line-height: 1.35;
}

.app-card-mod {
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.75rem;
}

.app-card-icon svg,
.app-dash-icon svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
  margin-bottom: 0.4rem;
}

.app-badge {
  position: absolute;
  top: 0;
  right: 0;
  font-style: normal;
  font-size: 0.7rem;
  text-transform: uppercase;
  background: #14171c;
  padding: 0.1rem 0.4rem;
}

.app-badge.draft {
  color: #e0b45f;
}

.app-badge.android {
  color: #71aee5;
}

/* connecting screen */
.app-progress {
  height: 22px;
  border: 4px solid #14171c;
  background: #171b21;
  position: relative;
  overflow: hidden;
}

.app-progress-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: #71aee5;
  transition: width 0.25s linear;
}

.app-progress.indeterminate .app-progress-fill {
  width: 30%;
  animation: app-slide 1.1s linear infinite;
}

@keyframes app-slide {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(380%);
  }
}

.app-console {
  height: 220px;
  overflow-y: auto;
  background: #111417;
  color: #cfd8cf;
  font: 12px/1.45 monospace;
  padding: 0.5rem;
  border: 4px solid #14171c;
  white-space: pre-wrap;
  word-break: break-word;
}

/* connected session: left screen nav + right screen container */
.app-session {
  display: flex;
  width: 100%;
  min-height: calc(100svh - var(--nav-h));
  align-items: stretch;
}

.app-screen-nav {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 13rem;
  border-right: 4px solid #14171c;
  background: #2d333c;
}

.app-screen-nav-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  border-bottom: 4px solid #14171c;
}

.app-screen-nav-item:hover {
  background: #171b21;
  color: #fff;
}

.app-screen-nav-item.active {
  background: #1d2127;
  color: #fff;
}

.app-screen {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.app-dash {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
}

.app-screen-placeholder {
  padding: 1.25rem;
}

@media (max-width: 700px) {
  .app-session {
    flex-direction: column;
  }

  .app-screen-nav {
    width: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 4px solid #14171c;
  }

  .app-screen-nav-item {
    flex-shrink: 0;
    border-bottom: 0;
    border-right: 4px solid #14171c;
  }
}

/* dashboard header */
.app-dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  border: 4px solid #14171c;
  background: #2d333c;
  padding: 0.75rem 1rem;
}

.app-dash-title {
  display: flex;
  flex-direction: column;
  margin-right: auto;
}

.app-batt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 3rem;
  min-width: 3.6rem;
}

.app-batt-icon svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* staggered widget grid (CSS columns masonry) */
.app-widgets {
  columns: 16rem 3;
  column-gap: 0.75rem;
  margin-top: 0.75rem;
}

.app-widget {
  break-inside: avoid;
  border: 4px solid #14171c;
  background: #2d333c;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.app-widget h4 {
  margin: 0 0 0.5rem;
}

.app-widget-btn {
  width: 100%;
}

/* square icon-only button (e.g. debug terminal) */
.app-icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
}

.app-widget select {
  outline: none;
  user-select: none;
}

.app-toggle {
  user-select: none;
}

.app-toggle input[type="checkbox"] {
  accent-color: #71aee5;
}

.app-slider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-slider input[type="range"] {
  flex: 1;
  accent-color: #71aee5;
  padding: 0;
  border: 0;
  background: transparent;
}

.app-graph {
  display: block;
  width: 100%;
  height: 90px;
  background: #171b21;
  border: 3px solid #14171c;
}

.app-graph-empty {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #171b21;
  border: 3px solid #14171c;
  color: #8a929c;
}

.app-graph-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #8a929c;
  margin-bottom: 0.25rem;
}

/* unsupported-target dialog */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 15, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.app-modal {
  background: #22272e;
  border: 4px solid #14171c;
  padding: 1.25rem 1.5rem 1rem;
  max-width: 28rem;
  width: 100%;
}

.app-modal h2 {
  margin: 0 0 0.5rem;
}

.app-modal img {
  display: block;
  margin: 0.75rem 0;
}

/* debug terminal window */
.app-terminal {
  max-width: 38rem;
}

.app-terminal .app-console {
  height: 260px;
}

.app-term-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.app-term-row input {
  flex: 1;
}
