/* panels.css — glassmorphism panels for Aasmaan V2 (Worker 3: Panels).
 * Light, calm, app-like. Scoped to panel components only (#widgets,
 * #toolbar, #suggest and their prefixed classes) so other workers' styles
 * are untouched. Mobile-first.
 */

:root {
  --as-glass: rgba(255, 255, 255, 0.78);
  --as-glass-strong: rgba(255, 255, 255, 0.92);
  --as-border: rgba(15, 23, 42, 0.10);
  --as-text: #0f172a;
  --as-muted: #64748b;
  --as-accent: #0284c7;
  --as-accent-soft: rgba(2, 132, 199, 0.12);
  --as-green: #16a34a;
  --as-gray-dot: #cbd5e1;
  --as-shadow: 0 8px 32px rgba(15, 23, 42, 0.14);
  --as-radius: 16px;
  --as-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}

:root[data-theme="dark"] {
  --as-glass: rgba(17, 26, 42, 0.82);
  --as-glass-strong: rgba(17, 26, 42, 0.95);
  --as-border: rgba(232, 238, 246, 0.14);
  --as-text: #e8eef6;
  --as-muted: #9fb0c3;
  --as-accent: #60a5fa;
  --as-accent-soft: rgba(96, 165, 250, 0.16);
  --as-green: #34d399;
  --as-gray-dot: #475569;
  --as-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#widgets, #toolbar, #suggest {
  font-family: var(--as-font);
  color: var(--as-text);
}

/* ============ search suggestions ============ */
#suggest.sg {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, calc(100vw - 20px));
  max-height: min(60vh, 420px);
  overflow-y: auto;
  z-index: 60;
  background: var(--as-glass-strong);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow);
  padding: 6px;
}
#suggest[hidden] { display: none; }

.sg-group { padding: 2px 0 4px; }
.sg-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--as-muted);
  padding: 8px 10px 4px;
}
.sg-item {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.sg-item:hover, .sg-item.active { background: var(--as-accent-soft); }
.sg-main { font-weight: 600; color: var(--as-text); white-space: nowrap; }
.sg-sub {
  font-size: 12px;
  color: var(--as-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}
.sg-empty {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--as-muted);
}

/* ============ widgets side panel ============ */
#widgets {
  position: fixed;
  left: 16px;
  top: 84px;
  width: 322px;
  max-height: calc(100dvh - 200px);
  overflow-y: auto;
  z-index: 30;
  background: var(--as-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow);
  padding: 6px 6px 16px;
  scrollbar-width: thin;
}

.wsec { border-radius: 12px; }
.wsec + .wsec { margin-top: 2px; }

.wsec-head {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--as-text);
  text-align: left;
}
.wsec-head:hover { background: rgba(15, 23, 42, 0.045); }
.wsec-chev {
  font-size: 12px;
  color: var(--as-muted);
  transition: transform 0.18s ease;
  flex: none;
}
.wsec.collapsed .wsec-chev { transform: rotate(-90deg); }
.wsec-live {
  font-size: 11px;
  font-weight: 600;
  color: var(--as-accent);
  letter-spacing: 0.02em;
}
.wsec-body { padding: 0 2px 6px; }

.wrows { list-style: none; margin: 0; padding: 0; }
.wrows li { margin: 0; padding: 0; }

.wrow {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "dot main" "dot sub";
  column-gap: 8px;
  width: 100%;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.wrow:hover { background: var(--as-accent-soft); }
.wrow-main {
  grid-area: main;
  font-weight: 600;
  color: var(--as-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wrow-dim { font-weight: 400; color: var(--as-muted); font-size: 12px; }
.wrow-sub {
  grid-area: sub;
  font-size: 12px;
  color: var(--as-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wrow .wdot { grid-area: dot; }

/* Card-style rows (flights near you) — matches right panel .aa-kv cards */
.wrows-cards { display: grid; gap: 8px; }
.wrows-cards li { margin: 0; }
.wcard {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--aa-border, rgba(128,128,128,0.15));
  border-radius: 12px;
  background: var(--aa-card, rgba(255,255,255,0.04));
  cursor: pointer;
  text-align: left;
}
.wcard:hover { background: var(--aa-card-hover, rgba(255,255,255,0.08)); }
.wcard-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.wcard-cs {
  font-size: 16px;
  font-weight: 700;
  color: var(--aa-ink, #fff);
}
.wcard-al {
  font-size: 12px;
  color: var(--aa-dim, #8a8f98);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wcard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.wcard-stat {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 6px 8px;
}
.wcard-k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--aa-dim, #8a8f98);
}
.wcard-v {
  font-size: 14px;
  font-weight: 600;
  color: var(--aa-ink, #fff);
}

/* rows without a status dot (nearby / recent / notable) span full width */
.wsec[data-wsec="nearby"] .wrow,
.wsec[data-wsec="recent"] .wrow,
.wsec[data-wsec="notable"] .wrow {
  grid-template-columns: 1fr;
  grid-template-areas: "main" "sub";
}

.wdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--as-gray-dot);
  flex: none;
}
.wdot.live { background: var(--as-green); box-shadow: 0 0 6px rgba(22, 163, 74, 0.55); }

.wbadge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--as-accent);
  background: var(--as-accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: 1px;
}

.wempty { padding: 6px 10px 10px; font-size: 13px; color: var(--as-muted); }
.wempty p { margin: 0 0 8px; line-height: 1.45; }

.wcta {
  display: inline-block;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--as-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wcta:hover { background: #0369a1; }

.wclear {
  display: block;
  margin: 0 10px 4px auto;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: var(--as-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.wclear:hover { text-decoration: underline; }

/* ============ bottom toolbar ============ */
#toolbar.tbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--as-glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--as-border);
  border-radius: 999px;
  box-shadow: var(--as-shadow);
}

.tb-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px; /* thumb-friendly */
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--as-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tb-btn svg { flex: none; }
.tb-btn:hover { background: rgba(15, 23, 42, 0.06); color: var(--as-text); }
.tb-btn.active { background: var(--as-accent); color: #fff; }
.tb-btn.active:hover { background: #0369a1; }
.tb-btn:focus-visible,
.wrow:focus-visible,
.sg-item:focus-visible,
.wsec-head:focus-visible,
.wcta:focus-visible {
  outline: 2px solid var(--as-accent);
  outline-offset: 2px;
}

/* ============ mobile ============ */
@media (max-width: 760px) {
  #suggest.sg {
    top: 60px;
    width: calc(100vw - 20px);
  }
  /* widgets become a bottom sheet above the toolbar */
  #widgets {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 84px;
    width: auto;
    max-height: 42dvh;
    border-radius: 18px;
  }
  #toolbar.tbar {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 16px);
    width: max-content;
    padding: 4px;
    gap: 2px;
  }
  .tb-btn {
    padding: 8px 12px;
    flex: 0 1 auto;
    min-width: 0;
    justify-content: center;
  }
  .tb-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
  .tb-txt {
    font-size: 12px;
    white-space: nowrap;
  }
}

/* ============ mobile toolbar: iOS-style tab bar ============ */
@media (max-width: 760px) {
  #toolbar.tbar {
    width: calc(100vw - 20px);
    max-width: 480px;
    padding: 6px 4px;
    gap: 0;
    border-radius: 22px;
  }
  .tb-btn {
    flex: 1 1 0;
    flex-direction: column;
    gap: 3px;
    min-height: 52px;
    padding: 8px 2px 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 16px;
  }
  .tb-btn svg { width: 20px; height: 20px; }
  .tb-txt {
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wsec-chev { transition: none; }
}
