/* ==========================================================================
   Audit Report – Standalone Light-Theme Styles
   Extracted from Vue scoped styles (audit-result-viewer.vue + audit-report-body.vue)
   All hsl(var(--xxx)) replaced with fixed light-theme values.
   ========================================================================== */

/* ---------- Root ---------- */
.audit-result-viewer {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #000;
  line-height: 1.5;
  background: #fff;
  border-radius: 12px;
}

/* ---------- Loading spinner ---------- */
@keyframes audit-spin {
  to { transform: rotate(360deg); }
}
.audit-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #63d300;
  border-radius: 50%;
  animation: audit-spin 0.8s linear infinite;
}
.audit-loading-text {
  font-size: 0.9375rem;
  color: #333;
  margin-top: 1rem;
}
.audit-loading-hint {
  font-size: 0.8125rem;
  color: #999;
  margin-top: 0.375rem;
}

/* ---------- Status colors ---------- */
.audit-viewer-status--completed { color: #16a34a; }
.audit-viewer-status--running   { color: #2563eb; }
.audit-viewer-status--pending   { color: #ca8a04; }
.audit-viewer-status--failed    { color: #dc5d4e; }
.audit-viewer-status--default   { color: #4b5563; }

/* ---------- Header card ---------- */
.audit-header-card {
  align-items: stretch;
  border: 1px solid #f2f2f2;
  border-radius: 22px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 30px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .audit-header-card {
    flex-direction: row;
    align-items: stretch;
  }
}

@media (max-width: 639px) {
  .audit-header-card {
    padding: 20px 16px 24px;
  }
}

/* ---------- Score ring (left) ---------- */
.audit-score-ring {
  width: 260px;
  min-width: 260px;
  padding: 0;
  background: transparent;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (max-width: 639px) {
  .audit-score-ring {
    width: 100%;
    min-width: 0;
    padding-bottom: 20px;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .audit-score-ring {
    width: 200px;
    min-width: 200px;
  }
}

.audit-score-ring__gauge {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 220px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    #242427 0%,
    #272729 30%,
    rgba(39, 39, 41, 0.92) 55%,
    rgba(36, 36, 39, 0.6) 78%,
    transparent 100%
  );
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

@media (max-width: 639px) {
  .audit-score-ring__gauge {
    max-width: min(200px, 72vw);
  }
}

/* Hide green arc when not completed */
.audit-score-ring__gauge:not(.audit-score-ring__gauge--completed) .audit-score-ring__fill {
  stroke: none !important;
}

/* Completed: thick arcs */
.audit-score-ring__gauge--completed .audit-score-ring__bg,
.audit-score-ring__gauge--completed .audit-score-ring__fill {
  stroke-width: 24;
}

.audit-score-ring__svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: geometricPrecision;
}

.audit-score-ring__bg {
  stroke: rgba(255, 255, 255, 0.12);
}

.audit-score-ring__inner {
  stroke: rgba(255, 255, 255, 0.06);
}

.audit-score-ring__fill {
  stroke: url(#audit-score-arc-gradient);
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-dasharray 0.4s ease;
  shape-rendering: geometricPrecision;
}

/* ---------- Sweep animation ---------- */
.audit-score-ring__sweep {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  transform-origin: 50% 50%;
  animation: audit-score-sweep 5s linear infinite;
  background: conic-gradient(
    from 0deg,
    rgba(131, 250, 154, 0.72) 0deg,
    rgba(131, 250, 154, 0.58) 0.8deg,
    rgba(131, 250, 154, 0.38) 1.8deg,
    rgba(131, 250, 154, 0.22) 4deg,
    rgba(131, 250, 154, 0.12) 12deg,
    rgba(131, 250, 154, 0.05) 35deg,
    transparent 68deg,
    transparent 360deg
  );
  mask-image: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    black 0%,
    rgba(0, 0, 0, 0.9) 28%,
    rgba(0, 0, 0, 0.55) 52%,
    rgba(0, 0, 0, 0.18) 78%,
    transparent 98%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    black 0%,
    rgba(0, 0, 0, 0.9) 28%,
    rgba(0, 0, 0, 0.55) 52%,
    rgba(0, 0, 0, 0.18) 78%,
    transparent 98%
  );
}

@keyframes audit-score-sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Radar dots ---------- */
.audit-score-ring__dots {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}

.audit-score-ring__dot {
  position: absolute;
  border-radius: 50%;
  background: #83FA9A;
  box-shadow: 0 0 6px 1px rgba(131, 250, 154, 0.45);
  transition: opacity 0.08s ease-out;
  will-change: transform, opacity;
  overflow: visible;
}

.audit-score-ring__dot::before,
.audit-score-ring__dot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  margin-left: -50%;
  margin-top: -50%;
  border-radius: 50%;
  border: 2px solid rgba(131, 250, 154, 0.7);
  background: transparent;
  transform-origin: 50% 50%;
  transform: scale(0.3);
  opacity: 0.8;
  animation: audit-dot-ripple 2s ease-out infinite;
  pointer-events: none;
}

.audit-score-ring__dot::after {
  animation-delay: 0.7s;
}

@keyframes audit-dot-ripple {
  0% {
    transform: scale(0.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ---------- Score center text ---------- */
.audit-score-ring__center {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.audit-score-ring__label {
  display: block;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #83fa9a;
  text-align: center;
  line-height: 1.43;
}

.audit-score-ring__value {
  display: block;
  text-align: center;
  margin-top: 5px;
  line-height: 1.1;
}

.audit-score-ring__value-num {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #83fa9a;
}

.audit-score-ring__value-max {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 639px) {
  .audit-score-ring__label { font-size: 12px; }
  .audit-score-ring__value-num { font-size: 20px; }
  .audit-score-ring__value-max { font-size: 12px; }
}

/* ---------- Header right ---------- */
.audit-header-right {
  padding-left: 24px;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 1024px) {
  .audit-header-right { padding-left: 94px; }
}

@media (max-width: 639px) {
  .audit-header-right { padding-left: 0; }
}

.audit-header-right__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audit-header-title-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 1024px) {
  .audit-header-title-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }
}

.audit-header-title {
  margin: 0;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #000;
  line-height: 1.2;
  min-height: 45px;
  display: flex;
  align-items: center;
}

@media (max-width: 639px) {
  .audit-header-title {
    font-size: 22px;
    min-height: auto;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .audit-header-title {
    font-size: 24px;
    min-height: auto;
  }
}

.audit-header-url {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 18px;
  color: #3C7553;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.audit-header-url:hover {
  text-decoration: underline;
  color: #2d5a3f;
}

@media (max-width: 639px) {
  .audit-header-url {
    font-size: 16px;
    word-break: break-all;
  }
}

/* ---------- Divider ---------- */
.audit-header-divider {
  height: 1px;
  background: #f7f7f7;
  margin: 8px 0;
  border: 0;
  flex-shrink: 0;
}

/* ---------- Times / Meta ---------- */
.audit-header-times,
.audit-header-meta-row {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 16px;
  color: #000;
}

.audit-header-times {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audit-header-times__group {
  display: flex;
  align-items: center;
  font-size: 14px;
  gap: 10px;
}

.audit-header-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.audit-header-meta-row strong {
  color: #000;
  font-weight: 700;
}

@media (max-width: 639px) {
  .audit-header-times,
  .audit-header-meta-row {
    font-size: 14px;
  }
  .audit-header-times {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .audit-header-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ---------- State ---------- */
.audit-state-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.audit-state-label {
  color: #000;
  font-weight: 400;
  font-size: 14px;
}

.audit-status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.audit-state-fail { color: #dc5d4e; }
.audit-status-dot--fail { background-color: #dc5d4e; color: #fff; }
.audit-status-dot--ok   { background-color: #16a34a; color: #fff; }
.audit-status-dot--pending { background-color: #eab308; color: #000; }

/* ---------- Progress bar ---------- */
.audit-progress-bar {
  width: 100%;
  min-width: 0;
  height: 4px;
  border-radius: 10px;
  background: #e5e5e5;
  overflow: hidden;
  margin-top: 4px;
  margin-bottom: 40px;
}

.audit-progress-bar__fill {
  display: block;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #3c7553 0%, #83fa9a 100%);
  transition: width 0.3s ease;
}

@media (max-width: 639px) {
  .audit-progress-bar { margin-bottom: 20px; }
  .audit-header-right__content { gap: 12px; }
}

/* ---------- Action buttons ---------- */
.audit-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

@media (min-width: 1024px) {
  .audit-header-actions { gap: 34px; }
}

@media (max-width: 639px) {
  .audit-header-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
    align-items: stretch;
  }
  .audit-header-actions .audit-header-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .audit-header-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
    align-items: stretch;
  }
  .audit-header-actions .audit-header-btn {
    width: 100%;
    justify-content: center;
  }
}

.audit-header-btn {
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 16px;
  padding: 10px 21px;
  min-height: 42px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.audit-header-btn:hover {
  background: #f5f5f5;
  border-color: #000;
  color: #000;
}

.audit-header-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 639px) {
  .audit-header-btn {
    padding: 8px 16px;
    min-height: 40px;
    font-size: 14px;
  }
}

.audit-header-btn--primary {
  background: #000 !important;
  border-color: #000 !important;
  color: #83fa9a !important;
}

.audit-header-btn--primary:hover {
  background: #171717 !important;
  border-color: #171717 !important;
  color: #83fa9a !important;
}

.audit-header-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- Report body ---------- */
.audit-report-body {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #1a1a1a;
  line-height: 1.5;
}

.audit-report-section {
  margin-bottom: 1.5rem;
}

.audit-section-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.audit-section-title {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  padding: 1.25rem 1.5rem 1rem;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}

.audit-section-divider {
  height: 1px;
  background: #eee;
  margin: 0;
}

.audit-section-table-wrap {
  overflow-x: auto;
}

.audit-section-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Three equal columns */
.audit-section-table .audit-th-type,
.audit-section-table .audit-td-type { width: 33.33%; }
.audit-section-table .audit-th-qty,
.audit-section-table .audit-td-qty { width: 33.33%; min-width: 3.5rem; text-align: center; }
.audit-section-table .audit-th-desc,
.audit-section-table .audit-td-desc { width: 33.34%; text-align: center; }

@media (max-width: 767px) {
  .audit-section-table .audit-th-desc,
  .audit-section-table .audit-td-desc { display: none; }
  .audit-section-table .audit-th-type,
  .audit-section-table .audit-td-type { width: 72%; }
  .audit-section-table .audit-th-qty,
  .audit-section-table .audit-td-qty { width: 28%; min-width: 3rem; }
}

.audit-th {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-align: left;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #eee;
  box-sizing: border-box;
  letter-spacing: 0.02em;
}

.audit-th-type { padding-left: 1.5rem; }

.audit-tr-main {
  user-select: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.audit-tr-main:hover {
  background: #fafafa;
}

.audit-td {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 14px;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
  box-sizing: border-box;
  line-height: 1.45;
}

.audit-tr-main:last-child .audit-td {
  border-bottom-color: transparent;
}

.audit-section-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 16px;
}
.audit-section-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 16px;
}

.audit-td-type { padding-left: 1.5rem; }

.audit-td-type-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.audit-td-type-text {
  flex: 1;
  min-width: 0;
  color: #1a1a1a;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.audit-td-qty {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dc5d4e;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.audit-td-desc {
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- Chevron ---------- */
.audit-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #f1f5f9;
  transition: transform 0.2s ease, background 0.15s ease;
}

.audit-tr-main:hover .audit-chevron {
  background: #e2e8f0;
}

.audit-tr--expanded .audit-chevron {
  transform: rotate(90deg);
  background: #e2e8f0;
}

.audit-chevron-icon {
  width: 14px;
  height: 14px;
  color: #64748b;
}

/* ---------- Detail row ---------- */
.audit-tr-detail .audit-td-detail-cell {
  padding: 0;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  user-select: text;
}

.audit-issue-items {
  padding: 1rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Mobile-only description in expand area */
.audit-detail-description-wrap.audit-detail-description--sm-only {
  display: none;
}

@media (max-width: 767px) {
  .audit-detail-description-wrap.audit-detail-description--sm-only {
    display: block;
  }
}

.audit-detail-description {
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-weight: bold;
}

/* ---------- Issue item card ---------- */
.audit-issue-item {
  padding: 1rem 1.25rem;
  background: #F9F9F9;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.audit-item-fields {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin: 0;
  font-size: 13px;
}

.audit-item-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: flex-start;
  gap: 0.25rem 1.25rem;
  padding: 0.375rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.audit-item-row:last-child {
  border-bottom: none;
}

@media (max-width: 767px) {
  .audit-item-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.audit-item-label {
  color: #64748b;
  font-weight: 500;
}

.audit-item-value {
  color: #1e293b;
  word-break: break-all;
}

.audit-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}

.audit-list li {
  margin-bottom: 0.25rem;
}

.audit-url-object-extra {
  font-size: 12px;
  color: #64748b;
}

.audit-link {
  color: #2563eb;
  text-decoration: none;
}

.audit-link:hover {
  text-decoration: underline;
}

/* ---------- Toast notification ---------- */
.audit-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.audit-toast--visible { opacity: 1; }
.audit-toast--success { background: #16a34a; }
.audit-toast--error   { background: #dc5d4e; }
