/* ============================================================================
   overlays/dialogs.css
   Standalone dialog surfaces — feature dialog content rendered in the
   shared modal shell (shortcuts, sleep timer, stats dashboard) and the
   PWA install / update banners
   ============================================================================ */


/* ===== 1. KEYBOARD SHORTCUTS HELP ===== */
.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
@media (min-width: 480px) {
  .shortcuts-grid {
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
  }
}
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(var(--bgPopups) / 0.7);
}
.shortcut-desc {
  font-size: 12px;
  color: rgba(var(--textSecondary));
}
.kbd {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(var(--bgButtons));
  border: 1px solid rgba(var(--borderSubtle) / 0.5);
  border-bottom-width: 2px;
  color: rgba(var(--textPrimary));
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}


/* ===== 2. SLEEP TIMER OPTIONS ===== */
.sleep-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sleep-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(var(--borderSubtle) / 0.3);
  border-radius: 12px;
  background: rgba(var(--bgPopups));
  color: rgba(var(--textPrimary));
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.sleep-option:hover {
  background: rgba(var(--bgButtons));
}
.sleep-option.active {
  border-color: rgba(var(--colorOrange));
  background: rgba(var(--colorOrange) / 0.12);
}
.sleep-option-off {
  color: rgba(var(--textSecondary));
}


/* ===== 3. LISTENING STATS DASHBOARD ===== */
.stats-dash-btn {
  display: block;
  margin: 14px auto 0;
  padding: 8px 18px;
  border: 1px solid rgba(var(--borderSubtle) / 0.35);
  border-radius: 9999px;
  background: rgba(var(--bgButtons) / 0.6);
  color: rgba(var(--textSecondary));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.stats-dash-btn:hover {
  background: rgba(var(--bgButtons));
  color: rgba(var(--textPrimary));
}
.stats-total-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stats-total-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(var(--bgPopups));
  text-align: center;
}
.stats-total-value {
  font-size: 22px;
  font-weight: 800;
  color: rgba(var(--colorOrange));
}
.stats-total-label {
  margin-top: 2px;
  font-size: 11px;
  color: rgba(var(--textSecondary));
}
.stats-dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 560px) {
  .stats-dash-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.stats-dash-heading {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(var(--textSecondary));
}
.stats-dash-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: rgba(var(--bgPopups) / 0.7);
}
.stats-dash-rank {
  width: 18px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: rgba(var(--colorPink));
  flex-shrink: 0;
}
.stats-dash-thumb {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
}
.stats-dash-thumb-square {
  border-radius: 9px;
}
.stats-dash-info {
  min-width: 0;
}
.stats-dash-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-dash-sub {
  font-size: 11px;
  color: rgba(var(--textSecondary));
}
.stats-dash-empty {
  padding: 10px;
  font-size: 12px;
  color: rgba(var(--textSecondary));
}


/* ===== 4. PWA INSTALL BANNER ===== */
.installBanner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 400px;
  background: rgba(22, 22, 24, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55),
      0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  z-index: 999999;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: -apple-system, "Inter", system-ui, sans-serif;
  color: #f5f5f7;
  cursor: pointer;
  animation: slideDown 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition: all 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.installBanner:hover {
  background: rgba(30, 30, 34, 0.9);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
      0 0 0 0.5px rgba(255, 255, 255, 0.1) inset;
}

.installBanner:active {
  transform: translateX(-50%) translateY(0);
  transition: all 0.1s ease;
}

.installBanner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: linear-gradient(to bottom, #4da6ff, #0969da);
  border-radius: 0 3px 3px 0;
}

.bannerText {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bannerTitle {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.bannerDesc {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.1px;
  line-height: 1.3;
  margin: 0;
}

.bannerArrow {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.installBanner:hover .bannerArrow {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(2px);
}

.bannerArrow svg {
  width: 14px;
  height: 14px;
  stroke: rgba(255, 255, 255, 0.8);
  stroke-width: 2;
  fill: none;
}


/* ===== 5. PWA UPDATE BANNER ===== */
.updateBanner {
  position: fixed;
  bottom: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 400px;
  background: rgba(22, 22, 24, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55),
      0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  z-index: 999998;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: -apple-system, "Inter", system-ui, sans-serif;
  color: #f5f5f7;
  cursor: pointer;
  animation: slideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition: all 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(120%);
}

.updateBanner.visible {
  opacity: 1;
  pointer-events: auto;
  animation: slideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.updateBanner.dismissing {
  animation: slideUpOut 0.3s cubic-bezier(0.55, 0, 1, 0.45) forwards;
  pointer-events: none;
}

.updateBanner:hover {
  background: rgba(30, 30, 34, 0.92);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6),
      0 0 0 0.5px rgba(255, 255, 255, 0.1) inset;
}

.updateBanner.visible:hover {
  transform: translateX(-50%) translateY(-2px);
}

.updateBanner:active {
  transform: translateX(-50%) translateY(0);
  transition: all 0.1s ease;
}

.updateBanner.visible:active {
  transform: translateX(-50%) translateY(0);
}

.updateBanner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: linear-gradient(to bottom, #34c759, #1a8c3a);
  border-radius: 0 3px 3px 0;
}

.updateBannerClose {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.updateBannerClose:hover {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

.updateBannerContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.updateBannerTitle {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.updateBannerDesc {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.1px;
  line-height: 1.3;
  margin: 0;
}

.updateBannerRefresh {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.updateBanner:hover .updateBannerRefresh {
  background: rgba(52, 199, 89, 0.35);
  transform: rotate(-30deg);
}

.updateBannerRefresh svg {
  width: 14px;
  height: 14px;
  stroke: #34c759;
  stroke-width: 2.5;
  fill: none;
}


/* ===== 6. BANNER RESPONSIVE ===== */
@media (max-width: 380px) {
  .installBanner {
    padding: 12px 14px;
  }

  .bannerTitle {
    font-size: 0.85rem;
  }

  .bannerDesc {
    font-size: 0.7rem;
  }

  .updateBanner {
    padding: 12px 14px;
  }

  .updateBannerTitle {
    font-size: 0.85rem;
  }

  .updateBannerDesc {
    font-size: 0.7rem;
  }
}


/* ===== 7. BANNER KEYFRAMES ===== */
@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-120%);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) translateY(6%);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(120%);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) translateY(-6%);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideUpOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(120%);
  }
}