@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
  --navy: #001d3c;
  --navy-deep: #000f21;
  --navy-panel: #032547;
  --navy-line: #0c3a63;
  --cyan: #00c2e4;
  --cyan-dim: #0a3a52;
  --ink: #eaf4fb;
  --slate: #82a0b8;
  --danger: #ff6b6b;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy-deep);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(circle at 15% -10%, rgba(0, 194, 228, 0.10), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(0, 194, 228, 0.06), transparent 35%);
  background-attachment: fixed;
}

h1, h2, h3, .brand-word {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* --- Top bar --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(0, 15, 33, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--navy-line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 0;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-mark img { height: 26px; width: auto; display: block; }

.search-form {
  flex: 1;
  display: flex;
  max-width: 480px;
}

.search-form input {
  width: 100%;
  background: var(--navy-panel);
  border: 1px solid var(--navy-line);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
}

.search-form input::placeholder { color: var(--slate); }
.search-form input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }

.topbar-links { margin-left: auto; display: flex; gap: 18px; font-size: 14px; color: var(--slate); }
.topbar-links a:hover { color: var(--ink); }

/* --- Category pills --- */

.category-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 18px 0 6px;
  scrollbar-width: thin;
}

.pill {
  white-space: nowrap;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--navy-line);
  background: var(--navy-panel);
  color: var(--slate);
  font-size: 13.5px;
  font-weight: 500;
}

.pill.active, .pill:hover { border-color: var(--cyan); color: var(--ink); }
.pill.active { background: var(--cyan-dim); }

.pill .count { color: var(--slate); margin-left: 4px; font-size: 12px; }

/* --- App grid / cards --- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px 0 60px;
}

.card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--navy-panel);
  border: 1px solid var(--navy-line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover { border-color: var(--cyan); transform: translateY(-2px); }

.icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--navy-line);
  flex-shrink: 0;
}

.icon.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 20px;
}

.card-body { min-width: 0; }
.card-body h3 { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body .dev { color: var(--slate); font-size: 13px; margin-top: 2px; }
.card-body .meta { color: var(--slate); font-size: 12.5px; margin-top: 8px; display: flex; gap: 10px; }
.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 8px;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--slate);
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  font-family: 'Manrope', sans-serif;
  border: none;
  cursor: pointer;
}

.btn-primary { background: var(--cyan); color: var(--navy-deep); }
.btn-primary:hover { background: #22d4f2; }
.btn-ghost { background: transparent; border: 1px solid var(--navy-line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--cyan); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* --- App detail --- */

.detail-header {
  display: flex;
  gap: 24px;
  padding: 40px 0 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.detail-header .icon { width: 96px; height: 96px; border-radius: 22px; }
.detail-header .icon.placeholder { font-size: 34px; }

.detail-meta h1 { font-size: 28px; margin-bottom: 6px; }
.detail-meta .dev { color: var(--slate); font-size: 15px; }
.detail-meta .stat-row { display: flex; gap: 20px; margin-top: 14px; color: var(--slate); font-size: 13.5px; }
.detail-meta .stat-row strong { display: block; color: var(--ink); font-size: 15px; }
.detail-actions { margin-left: auto; align-self: center; }

.screenshots {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 10px 0 30px;
}

.screenshots img {
  height: 380px;
  border-radius: 14px;
  border: 1px solid var(--navy-line);
  flex-shrink: 0;
}

.section-title { font-size: 18px; margin: 30px 0 12px; }
.description { color: #cfe3f0; line-height: 1.7; white-space: pre-line; max-width: 720px; }

/* --- Install handoff page --- */

.install-card {
  max-width: 480px;
  margin: 60px auto;
  background: var(--navy-panel);
  border: 1px solid var(--navy-line);
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
}

.install-card .icon { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 18px; }
.install-card p { color: var(--slate); font-size: 14.5px; line-height: 1.6; }
.install-card .divider { display: flex; align-items: center; gap: 10px; color: var(--slate); font-size: 12.5px; margin: 26px 0; }
.install-card .divider::before, .install-card .divider::after { content: ''; flex: 1; height: 1px; background: var(--navy-line); }

/* --- Forms (admin) --- */

.auth-shell {
  max-width: 380px;
  margin: 90px auto;
  background: var(--navy-panel);
  border: 1px solid var(--navy-line);
  border-radius: 20px;
  padding: 36px 32px;
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--slate); margin-bottom: 6px; font-weight: 500; }
.field input[type=text], .field input[type=password], .field input[type=number], .field textarea, .field select {
  width: 100%;
  background: var(--navy);
  border: 1px solid var(--navy-line);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
}

.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.field input[type=file] { color: var(--slate); font-size: 13px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.error-banner { background: rgba(255,107,107,0.1); border: 1px solid var(--danger); color: #ffb3b3; padding: 12px 16px; border-radius: 12px; font-size: 13.5px; margin-bottom: 18px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; }
.checkbox-field input { width: auto; }

/* --- Admin dashboard --- */

.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 60px; }
.admin-table th { text-align: left; color: var(--slate); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--navy-line); }
.admin-table td { padding: 12px; border-bottom: 1px solid var(--navy-line); font-size: 14px; vertical-align: middle; }
.admin-table tr:hover { background: rgba(0, 194, 228, 0.04); }
.row-app { display: flex; align-items: center; gap: 12px; }
.row-app .icon { width: 36px; height: 36px; border-radius: 9px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.on { background: var(--cyan); }
.status-dot.off { background: var(--slate); }
.actions-cell { display: flex; gap: 8px; }
.thumb-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.thumb-row .thumb { position: relative; }
.thumb-row img { width: 100px; height: 100px; object-fit: cover; border-radius: 10px; border: 1px solid var(--navy-line); }
.thumb-row form { position: absolute; top: 4px; right: 4px; }
.thumb-row button { background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 6px; width: 22px; height: 22px; cursor: pointer; }

.screenshot-thumb { cursor: zoom-in; }

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 8, 18, 0.92);
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 88vw; max-height: 84vh; border-radius: 10px; }
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--navy-line);
  color: var(--ink);
  border-radius: 999px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.lightbox-close { top: 24px; right: 24px; width: 44px; height: 44px; }
.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 30px; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { border-color: var(--cyan); color: var(--cyan); }

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 4px 10px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 8px;
}
.verified-badge-small { color: var(--cyan); font-weight: 700; }

.security-card {
  border: 1px solid var(--navy-line);
  background: var(--navy-panel);
  border-radius: var(--radius);
  max-width: 640px;
  padding: 8px 20px;
}
.security-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--navy-line);
}
.security-row:last-child { border-bottom: none; }
.security-icon { font-size: 18px; line-height: 1.4; opacity: 0.85; }
.security-row-title { font-size: 14.5px; font-weight: 600; }
.security-row-sub { font-size: 13px; color: var(--slate); margin-top: 2px; }
.checksum-mono { font-family: monospace; }

.footer { text-align: center; color: var(--slate); font-size: 13px; padding: 30px 0 50px; }

@media (max-width: 640px) {
  .topbar-links { display: none; }
  .detail-actions { margin-left: 0; width: 100%; }
  .detail-actions .btn { width: 100%; }
}
