/* ═══════════════════════════════════════════════
   Verpa Hub — hub.css
   ═══════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  --orange:        #E8500A;
  --orange-light:  #FFF3EE;
  --orange-mid:    #FDDDD0;
  --blue:          #2438A8;
  --blue-light:    #EEF1FF;
  --bg:            #F4F5F8;
  --surface:       #FFFFFF;
  --border:        #E4E6EC;
  --border-strong: #CDD0DC;
  --text-primary:  #13151C;
  --text-secondary:#5A5F72;
  --text-muted:    #9298AD;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.06);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════
   HEADER
══════════════════════════════ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-xs);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.logo-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo-title span { color: var(--orange); }

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.header-search {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.header-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.header-search input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,80,10,.12);
  background: white;
}

.header-search input::placeholder { color: var(--text-muted); }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-count-pill {
  background: var(--orange-light);
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--orange-mid);
}

/* ── ICON BUTTON ── */
.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color .15s, color .15s, background .15s;
  flex-shrink: 0;
}
.icon-btn:hover  { border-color: var(--orange); color: var(--orange); background: var(--orange-light); }
.icon-btn.active { border-color: var(--orange); color: var(--orange); background: var(--orange-light); }

/* ══════════════════════════════
   HERO STRIP
══════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, #1a2d8a 100%);
  padding: 36px 32px 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 120px;
  width: 160px; height: 160px;
  background: rgba(232,80,10,.15);
  border-radius: 50%;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.hero-logo {
  width: 56px; height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.hero-text h1 {
  font-size: 24px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.hero-text p {
  font-size: 14px;
  color: rgba(255,255,255,.65);
}

/* ══════════════════════════════
   FILTER BAR
══════════════════════════════ */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
}

.filter-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-inner::-webkit-scrollbar { display: none; }

.filter-btn {
  padding: 14px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}

.filter-btn:hover { color: var(--orange); }
.filter-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
  font-weight: 600;
}

/* ══════════════════════════════
   MAIN / SECTIONS
══════════════════════════════ */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

.section { margin-bottom: 36px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════
   APP GRID
══════════════════════════════ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

/* ══════════════════════════════
   APP CARD
══════════════════════════════ */
.app-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s, transform .12s;
  position: relative;
  cursor: pointer;
}

.app-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--orange);
  transform: translateY(-2px);
}

.app-card:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.app-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,.06);
}

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

.app-name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22C55E;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,.2);
}

.status-dot.dev {
  background: #F59E0B;
  box-shadow: 0 0 0 2px rgba(245,158,11,.2);
}

.app-category {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.app-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.app-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.open-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  white-space: nowrap;
  transition: gap .15s;
}

.app-card:hover .open-btn { gap: 8px; }

/* ══════════════════════════════
   EMPTY STATE
══════════════════════════════ */
.empty-state {
  display: none;
  text-align: center;
  padding: 80px 20px;
}

.empty-state.visible { display: block; }
.empty-icon  { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-sub   { font-size: 13px; color: var(--text-muted); }

/* ══════════════════════════════
   FOOTER
══════════════════════════════ */
footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ══════════════════════════════
   SETTINGS BACKDROP
══════════════════════════════ */
.settings-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0);
  z-index: 299;
  pointer-events: none;
  transition: background .25s;
}
.settings-backdrop.open {
  background: rgba(0,0,0,.35);
  pointer-events: all;
}

/* ══════════════════════════════
   SETTINGS PANEL
══════════════════════════════ */
.settings-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.settings-panel.open { transform: translateX(0); }

.sp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sp-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text-primary);
}
.sp-close {
  width: 32px; height: 32px;
  border: none; background: none;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
  transition: background .15s, color .15s;
}
.sp-close:hover { background: var(--bg); color: var(--text-primary); }

.sp-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.sp-body::-webkit-scrollbar { width: 4px; }
.sp-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sp-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.sp-section:last-child { border-bottom: none; }

.sp-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.sp-section-sub {
  font-size: 12px; color: var(--text-muted);
  margin-top: -8px; margin-bottom: 14px;
  line-height: 1.5;
}

.sp-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sp-row:last-child { border-bottom: none; }
.sp-row-info { flex: 1; min-width: 0; }
.sp-row-label { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
.sp-row-sub   { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ── SEGMENTED CONTROL ── */
.seg-ctrl {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.seg-btn {
  padding: 5px 10px;
  border: none; background: transparent;
  border-radius: 5px;
  font-family: inherit; font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ── TOGGLE ── */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #D1D5DB; border-radius: 22px; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--orange); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── SELECT ── */
.sp-select {
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; color: var(--text-primary);
  background: var(--surface); outline: none; cursor: pointer;
  transition: border-color .15s;
  flex-shrink: 0;
}
.sp-select:focus { border-color: var(--orange); }

/* ── APP VISIBILITY LIST ── */
.av-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.av-row:last-child { border-bottom: none; }
.av-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.av-name { flex: 1; font-size: 13.5px; font-weight: 500; }
.av-cat  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ── INFO BLOCK ── */
.sp-info-block {
  background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border); overflow: hidden;
}
.sp-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sp-info-row:last-child { border-bottom: none; }
.sp-info-row span:first-child { color: var(--text-secondary); }
.sp-info-row span:last-child  { font-weight: 600; color: var(--text-primary); }

/* ── SP FOOTER ── */
.sp-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sp-reset-btn {
  width: 100%; padding: 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: border-color .15s, color .15s;
}
.sp-reset-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ══════════════════════════════
   LAYOUT MODES
══════════════════════════════ */
.app-grid.layout-list { grid-template-columns: 1fr !important; }
.app-grid.layout-list .app-card { flex-direction: row; align-items: center; gap: 16px; padding: 14px 20px; }
.app-grid.layout-list .card-top { flex: 1; }
.app-grid.layout-list .app-desc { display: none; }
.app-grid.layout-list .card-footer { border-top: none; padding-top: 0; margin-top: 0; flex-shrink: 0; }

/* ── CARD SIZE MODES ── */
.app-grid.size-compact .app-card  { padding: 13px 16px; gap: 10px; }
.app-grid.size-compact .app-icon  { width: 36px; height: 36px; font-size: 17px; }
.app-grid.size-compact .app-name  { font-size: 13px; }
.app-grid.size-compact .app-desc  { font-size: 12px; }
.app-grid.size-large .app-card    { padding: 26px 24px; gap: 18px; }
.app-grid.size-large .app-icon    { width: 54px; height: 54px; font-size: 26px; }
.app-grid.size-large .app-name    { font-size: 16px; }

/* ── UTILITY ── */
.hidden { display: none !important; }
.hide-url .app-url { display: none; }

/* ══════════════════════════════
   RESPONSIVE
══════════════════════════════ */
@media (max-width: 640px) {
  header { padding: 0 16px; gap: 12px; }
  .hero  { padding: 24px 16px 20px; }
  main   { padding: 20px 16px 60px; }
  .filter-bar { padding: 0 16px; }
  .app-grid { grid-template-columns: 1fr; }
  .header-search { max-width: 200px; }
  .settings-panel { width: 100vw; }
}
