/**
 * ATAD Product Queries widget – scoped under .product-queries-widget
 * Adapted from raw-product-query reference; preserves dark theme and glassmorphism.
 */

.product-queries-widget {
  --pqw-bg: #0b0b0b;
  --pqw-bg-elevated: #151515;
  --pqw-border-subtle: #2a2a2a;
  --pqw-text: #f5f5f5;
  --pqw-text-muted: #a3a3a3;
  --pqw-accent: #4f46e5;
  --pqw-accent-soft: rgba(79, 70, 229, 0.1);
  --pqw-accent-border: rgba(79, 70, 229, 0.4);
  --pqw-radius-lg: 0.75rem;
  --pqw-radius-md: 0.5rem;
  --pqw-radius-full: 999px;

  box-sizing: border-box;
  width: 100%;
  max-width: 1120px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  border-radius: 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow:
    0 24px 80px rgba(15, 23, 42, 0.9),
    0 0 0 1px rgba(148, 163, 184, 0.15);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.product-queries-widget *,
.product-queries-widget *::before,
.product-queries-widget *::after {
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .product-queries-widget {
    padding: 32px;
  }
}

/* Section: header / privacy */
.product-queries-widget .pqw-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-queries-widget .pqw-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pqw-text-muted);
}

.product-queries-widget .pqw-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--pqw-radius-full);
  background: radial-gradient(circle at top left, #22c55e33, transparent 55%);
  border: 1px solid rgba(34, 197, 94, 0.45);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #bbf7d0;
}

.product-queries-widget .pqw-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.35);
}

.product-queries-widget .pqw-section-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--pqw-text);
}

.product-queries-widget .pqw-section-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--pqw-text-muted);
  max-width: 44rem;
}

/* Private communication alert */
.product-queries-widget .pqw-private-alert {
  position: relative;
  width: 100%;
  border-radius: var(--pqw-radius-md);
  border: 1px solid rgba(0, 59, 122, 0.2);
  background: rgba(0, 59, 122, 0.05);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: 0 0.75rem;
  align-items: start;
}

.product-queries-widget .pqw-private-alert-icon {
  width: 1rem;
  height: 1rem;
  transform: translateY(0.125rem);
  color: #003b7a;
  flex-shrink: 0;
}

.product-queries-widget .pqw-private-alert-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.product-queries-widget .pqw-private-alert-title {
  font-weight: 600;
  color: var(--pqw-text);
}

.product-queries-widget .pqw-private-alert-text {
  margin: 0;
  color: var(--pqw-text-muted);
}

/* Info card */
.product-queries-widget .pqw-info-card {
  position: relative;
  padding: 16px 16px 16px 14px;
  border-radius: 1rem;
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.16), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--pqw-accent-border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: flex-start;
  overflow: hidden;
}

.product-queries-widget .pqw-info-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.4), transparent 60%),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.25), transparent 60%);
  opacity: 0.35;
  pointer-events: none;
}

.product-queries-widget .pqw-info-icon-badge {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 1.25rem;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 1),
    0 16px 45px rgba(15, 23, 42, 0.9);
  z-index: 1;
}

.product-queries-widget .pqw-info-icon-badge span {
  font-size: 18px;
}

.product-queries-widget .pqw-info-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-queries-widget .pqw-info-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--pqw-text);
}

.product-queries-widget .pqw-info-text {
  margin: 0;
  font-size: 0.9rem;
  color: #e5e7eb;
}

/* Ask card */
.product-queries-widget .pqw-ask-card {
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #020617);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-queries-widget .pqw-ask-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.product-queries-widget .pqw-ask-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--pqw-text);
}

.product-queries-widget .pqw-ask-hint {
  margin: 0.25em 0 0;
  font-size: 0.85rem;
  color: var(--pqw-text-muted);
}

.product-queries-widget .pqw-textarea {
  width: 100%;
  min-height: 80px;
  border-radius: 0.9rem;
  border: 1px solid var(--pqw-border-subtle);
  background: rgba(15, 23, 42, 0.97);
  color: var(--pqw-text);
  padding: 10px 11px;
  resize: vertical;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.product-queries-widget .pqw-textarea::placeholder {
  color: #64748b;
}

.product-queries-widget .pqw-textarea:focus {
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.7), 0 0 0 12px rgba(79, 70, 229, 0.35);
  background: #020617;
}

.product-queries-widget .pqw-ask-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--pqw-text-muted);
}

.product-queries-widget .pqw-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--pqw-radius-full);
  border: none;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow:
    0 8px 32px rgba(79, 70, 229, 0.75),
    0 0 0 1px rgba(248, 250, 252, 0.06);
  transition: transform 80ms ease, box-shadow 80ms ease, filter 80ms ease;
  white-space: nowrap;
}

.product-queries-widget .pqw-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow:
    0 12px 40px rgba(79, 70, 229, 0.9),
    0 0 0 1px rgba(248, 250, 252, 0.08);
  transform: translateY(-1px);
}

.product-queries-widget .pqw-btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow:
    0 4px 18px rgba(79, 70, 229, 0.8),
    0 0 0 1px rgba(248, 250, 252, 0.04);
}

.product-queries-widget .pqw-btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.product-queries-widget .pqw-form-status {
  font-size: 0.85rem;
}

.product-queries-widget .pqw-form-status-success {
  color: #86efac;
}

.product-queries-widget .pqw-form-status-error {
  color: #fca5a5;
}

/* Queries list section */
.product-queries-widget .pqw-queries-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-queries-widget .pqw-queries-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-queries-widget .pqw-queries-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--pqw-text);
}

.product-queries-widget .pqw-queries-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--pqw-text-muted);
}

.product-queries-widget .pqw-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-queries-widget .pqw-list-loading,
.product-queries-widget .pqw-list-error,
.product-queries-widget .pqw-list-empty {
  padding: 16px;
  border-radius: 1rem;
  border: 1px dashed rgba(75, 85, 99, 0.85);
  background: rgba(15, 23, 42, 0.8);
  font-size: 0.88rem;
  color: var(--pqw-text-muted);
}

.product-queries-widget .pqw-list-error {
  border-color: rgba(239, 68, 68, 0.5);
}

.product-queries-widget .pqw-error-msg {
  margin: 0;
  color: #fca5a5;
}

.product-queries-widget .pqw-muted {
  margin: 0;
  color: var(--pqw-text-muted);
}

/* Query card */
.product-queries-widget .pqw-query-card {
  border-radius: 1rem;
  border: 1px solid rgba(51, 65, 85, 0.9);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), #020617);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.product-queries-widget .pqw-query-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(148, 163, 184, 0.18), transparent 55%);
  opacity: 0.75;
  pointer-events: none;
}

.product-queries-widget .pqw-query-meta {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--pqw-text-muted);
  flex-wrap: wrap;
}

.product-queries-widget .pqw-query-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-queries-widget .pqw-query-avatar {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: radial-gradient(circle at top, #22c55e, #16a34a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.9),
    0 6px 16px rgba(22, 163, 74, 0.9);
}

.product-queries-widget .pqw-query-meta-name {
  font-weight: 500;
  color: #e5e7eb;
}

.product-queries-widget .pqw-query-meta-role {
  opacity: 0.8;
}

.product-queries-widget .pqw-query-date {
  font-size: 0.78rem;
  opacity: 0.9;
}

.product-queries-widget .pqw-query-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.product-queries-widget .pqw-query-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
}

.product-queries-widget .pqw-query-text {
  color: #e5e7eb;
}

.product-queries-widget .pqw-answer-block {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(75, 85, 99, 0.9);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.9rem;
}

.product-queries-widget .pqw-answer-meta {
  font-size: 0.78rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-queries-widget .pqw-vendor-name {
  font-weight: 500;
  color: #e5e7eb;
}

.product-queries-widget .pqw-vendor-role {
  opacity: 0.9;
}

.product-queries-widget .pqw-answer-text {
  color: #d1fae5;
}

/* ==========================================================================
   Light theme (from raw-product-query-dark.txt). Add .pqw-theme-light to widget root to use.
   ========================================================================== */
.product-queries-widget.pqw-theme-light {
  --pqw-bg: #f8fafc;
  --pqw-bg-elevated: #ffffff;
  --pqw-border-subtle: #e2e8f0;
  --pqw-text: #0f172a;
  --pqw-text-muted: #64748b;
  --pqw-accent: #4f46e5;
  --pqw-accent-soft: rgba(79, 70, 229, 0.08);
  --pqw-accent-border: rgba(79, 70, 229, 0.35);

  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.product-queries-widget.pqw-theme-light .pqw-pill {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #15803d;
}

.product-queries-widget.pqw-theme-light .pqw-pill-dot {
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.25);
}

.product-queries-widget.pqw-theme-light .pqw-info-card {
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.25);
}

.product-queries-widget.pqw-theme-light .pqw-info-card::before {
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.08), transparent 60%);
  opacity: 0.6;
}

.product-queries-widget.pqw-theme-light .pqw-info-icon-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.product-queries-widget.pqw-theme-light .pqw-info-text {
  color: #475569;
}

.product-queries-widget.pqw-theme-light .pqw-ask-card {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.product-queries-widget.pqw-theme-light .pqw-textarea {
  border: 1px solid var(--pqw-border-subtle);
  background: #f8fafc;
  color: var(--pqw-text);
}

.product-queries-widget.pqw-theme-light .pqw-textarea::placeholder {
  color: #94a3b8;
}

.product-queries-widget.pqw-theme-light .pqw-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: #ffffff;
}

.product-queries-widget.pqw-theme-light .pqw-btn-primary {
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.product-queries-widget.pqw-theme-light .pqw-btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.product-queries-widget.pqw-theme-light .pqw-btn-primary:active:not(:disabled) {
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.product-queries-widget.pqw-theme-light .pqw-form-status-success {
  color: #15803d;
}

.product-queries-widget.pqw-theme-light .pqw-form-status-error {
  color: #b91c1c;
}

.product-queries-widget.pqw-theme-light .pqw-list-loading,
.product-queries-widget.pqw-theme-light .pqw-list-error,
.product-queries-widget.pqw-theme-light .pqw-list-empty {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: var(--pqw-text-muted);
}

.product-queries-widget.pqw-theme-light .pqw-list-error {
  border-color: rgba(239, 68, 68, 0.5);
}

.product-queries-widget.pqw-theme-light .pqw-error-msg {
  color: #b91c1c;
}

.product-queries-widget.pqw-theme-light .pqw-query-card {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.product-queries-widget.pqw-theme-light .pqw-query-card::before {
  background: radial-gradient(circle at top right, rgba(148, 163, 184, 0.08), transparent 55%);
  opacity: 0.8;
}

.product-queries-widget.pqw-theme-light .pqw-query-meta-name {
  color: #1e293b;
}

.product-queries-widget.pqw-theme-light .pqw-query-text {
  color: #334155;
}

.product-queries-widget.pqw-theme-light .pqw-query-avatar {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.35);
}

.product-queries-widget.pqw-theme-light .pqw-query-label {
  color: #64748b;
}

.product-queries-widget.pqw-theme-light .pqw-answer-block {
  border-top: 1px dashed #cbd5e1;
}

.product-queries-widget.pqw-theme-light .pqw-answer-meta {
  color: #64748b;
}

.product-queries-widget.pqw-theme-light .pqw-vendor-name {
  color: #1e293b;
}

.product-queries-widget.pqw-theme-light .pqw-answer-text {
  color: #065f46;
}
