/* Unified GhostESP Store — replaces the three duplicated inline
   marketplace style blocks (marketplace / asset-marketplace / scripts-marketplace). */

.store-hero {
  min-height: 42vh;
  display: flex;
  align-items: center;
  text-align: center;
  padding: 110px var(--spacing) 48px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #050505 0%, #000 100%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.store-hero .container {
  position: relative;
  z-index: 1;
}

.store-hero-copy {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.store-hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.1rem, 5.4vw, 3.9rem);
  line-height: 1.02;
  letter-spacing: -1.5px;
}

.store-hero p {
  max-width: 640px;
  color: var(--text-dim);
  font-size: 1.04rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* Device connection bar */
.store-device-bar {
  max-width: 820px;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(10, 10, 10, 0.85);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  z-index: 1;
}

.store-device-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  flex: 1 1 auto;
  min-width: 220px;
}

.store-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.store-status-dot.connected {
  background: #00ff80;
  box-shadow: 0 0 8px rgba(0, 255, 128, 0.6);
}

.store-status-dot.busy {
  background: #f5b301;
  animation: store-pulse 0.9s ease-in-out infinite;
}

.store-device-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.store-device-meta span { color: var(--text); }

.store-device-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.store-status-line {
  flex-basis: 100%;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  min-height: 1.1rem;
}

.store-status-line.ok { color: #00ff80; }
.store-status-line.err { color: #ff5c5c; }

@keyframes store-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Tabs */
.store-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.store-tab {
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.store-tab:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
}

.store-tab.active {
  color: #000;
  background: var(--text);
  border-color: var(--text);
}

.store-tab .store-tab-count {
  opacity: 0.65;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin-left: 0.35rem;
}

/* Toolbar */
.store-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: 1rem;
  margin: 0 auto 1.25rem;
  max-width: 760px;
}

.store-input,
.store-select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(0, 0, 0, 0.72);
  font: inherit;
}

.store-input:focus,
.store-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.store-list-meta {
  min-height: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.store-security-notice {
  max-width: 760px;
  margin: 0 auto 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 200, 87, 0.38);
  border-radius: var(--radius);
  color: rgba(255, 236, 188, 0.9);
  background: rgba(255, 200, 87, 0.07);
  font-size: 0.86rem;
  text-align: center;
}

/* Cards */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.25rem;
  justify-content: center;
  justify-items: center;
}

.store-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  width: 100%;
  max-width: 420px;
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(10, 10, 10, 0.9);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.store-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.store-card-head-inline {
  margin-bottom: 0.6rem;
}

.store-card-title {
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
}

.store-card-id {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.store-card-authors {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.84rem;
}

.store-card-authors span {
  color: var(--text-dim);
}

.store-card-description {
  flex: 1;
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.store-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.store-chip {
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.store-chip.store-chip-accent {
  border-color: rgba(0, 255, 128, 0.32);
  color: #00ff80;
  background: rgba(0, 255, 128, 0.06);
}

.store-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.store-meta-label {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.store-permission-chip {
  border-color: rgba(255, 200, 87, 0.35);
  color: rgba(255, 236, 188, 0.92);
  background: rgba(255, 200, 87, 0.06);
}

.store-chip.store-installed-chip {
  border-color: rgba(0, 255, 128, 0.35);
  color: #00ff80;
  background: rgba(0, 255, 128, 0.08);
}

.store-chip.store-update-chip {
  border-color: rgba(255, 200, 87, 0.55);
  color: #f5b301;
  background: rgba(255, 200, 87, 0.08);
  font-weight: 600;
}

.store-chip-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 auto 1rem;
  max-width: 760px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.store-chip-filter label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.store-chip-filter label em {
  font-style: normal;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.store-chip-filter .store-chip-filter-name {
  color: #00ff80;
}

.store-chip-filter input[type="checkbox"] {
  accent-color: #00ff80;
  cursor: pointer;
}

.store-actions-row {
  display: grid;
  gap: 0.5rem;
  margin-top: auto;
}

.store-install-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(0, 255, 128, 0.45);
  border-radius: 10px;
  color: #00ff80;
  background: rgba(0, 255, 128, 0.08);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.store-install-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(0, 255, 128, 0.14);
  box-shadow: 0 6px 18px rgba(0, 255, 128, 0.12);
}

.store-install-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.store-install-btn.store-install-busy {
  animation: store-pulse 1.2s ease-in-out infinite;
}

.store-install-status {
  margin: 0;
  min-height: 1.1rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-align: center;
}

.store-download-toggle {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #000;
  background: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.store-download-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 255, 255, 0.14);
}

.store-download-targets {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.store-download {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
}

.store-download:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.store-download span:last-child {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  white-space: nowrap;
}

.store-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.6rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-decoration: none;
}

.store-source-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.store-empty {
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-dim);
  background: rgba(10, 10, 10, 0.7);
}

.store-install-help {
  max-width: 820px;
  margin: 0 auto;
  color: var(--text-dim);
  text-align: center;
}

.store-install-help code {
  color: var(--text);
}

/* Screenshots */
.store-screenshots {
  display: flex;
  gap: 0.75rem;
  margin: -0.15rem 0 1rem;
  padding: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  border-radius: 14px;
  background: radial-gradient(circle at top right, rgba(201, 61, 255, 0.16), transparent 45%), rgba(0, 0, 0, 0.45);
}

.store-screenshot {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
  text-align: center;
}

.store-screenshot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.store-screenshot-eyebtn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.18rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.store-screenshot-caption {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
}

.store-preview {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .store-toolbar {
    grid-template-columns: 1fr;
  }

  .store-device-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .store-device-actions {
    margin-left: 0;
  }

  .store-device-actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .store-hero {
    min-height: auto;
    padding-top: 96px;
  }

  .store-actions .btn {
    width: 100%;
  }
}