/*
 * CookieShift — Contextual Live Scan Status Widget
 * Compact bottom-right notification; expands on demand. Scoped under .csgsb-*.
 */

.csgsb-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 8500;
  width: min(300px, calc(100vw - 32px));
  pointer-events: none;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.csgsb-inner {
  pointer-events: auto;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease;
  overflow: hidden;
}

.csgsb-root.csgsb-visible .csgsb-inner {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.csgsb-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
}

.csgsb-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: csgsb-pulse 1.6s ease-out infinite;
}

@keyframes csgsb-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.csgsb-summary {
  flex: 1 1 auto;
  min-width: 0;
}

.csgsb-line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.csgsb-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.csgsb-pct {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: #4f46e5;
  font-variant-numeric: tabular-nums;
}

.csgsb-count {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csgsb-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: #4f46e5;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.csgsb-open {
  flex: 0 0 auto;
}

.csgsb-btn:hover {
  background: #4338ca;
}

.csgsb-btn:active {
  transform: translateY(1px);
}

.csgsb-expand {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.csgsb-expand:hover {
  background: #e2e8f0;
}

.csgsb-chevron {
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -2px;
  transition: transform 0.2s ease;
}

.csgsb-root.csgsb-expanded .csgsb-chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
}

.csgsb-details {
  border-top: 1px solid #eef2f7;
  padding: 10px 14px 12px;
}

.csgsb-site {
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csgsb-current {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csgsb-eta {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.csgsb-progress {
  margin-top: 8px;
  height: 5px;
  width: 100%;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.csgsb-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #4f46e5);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.csgsb-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.csgsb-actions .csgsb-btn {
  flex: 1 1 0;
  text-align: center;
}

.csgsb-stop {
  background: #fee2e2;
  color: #b91c1c;
}

.csgsb-stop:hover {
  background: #fecaca;
}

.csgsb-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Keep widget clear of common bottom-right controls */
@media (max-width: 560px) {
  .csgsb-root {
    right: 12px;
    bottom: 12px;
    width: min(280px, calc(100vw - 24px));
  }

  .csgsb-compact {
    flex-wrap: wrap;
    gap: 8px;
  }

  .csgsb-open {
    width: 100%;
    order: 3;
  }

  .csgsb-expand {
    order: 2;
  }
}

@media (prefers-color-scheme: dark) {
  .csgsb-inner {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #1e293b;
    box-shadow: 0 10px 28px -6px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  }

  .csgsb-count {
    color: #cbd5e1;
  }

  .csgsb-pct,
  .csgsb-site {
    color: #a5b4fc;
  }

  .csgsb-current,
  .csgsb-eta {
    color: #94a3b8;
  }

  .csgsb-details {
    border-top-color: #1e293b;
  }

  .csgsb-progress {
    background: #1e293b;
  }

  .csgsb-expand {
    background: #1e293b;
    color: #94a3b8;
  }

  .csgsb-expand:hover {
    background: #334155;
  }

  .csgsb-stop {
    background: #3b1d1d;
    color: #fca5a5;
  }

  .csgsb-stop:hover {
    background: #4c2424;
  }
}
