/* Prettier print width: 80 */
:root {
  color-scheme: dark;
  --accent: #6366f1;
  --accent-2: #4f46e5;
  --panel: #0b1220;
  --panel-2: #0a0f1c;
  --border: #1f2937; /* Made slightly more visible */
  --muted: #94a3b8;
  --muted-2: #9ca3af;
  --glow-soft: 0 0 15px rgba(99, 102, 241, 0.2); /* Simplified glow */
  --glow-strong: 0 0 25px rgba(99, 102, 241, 0.35);
}

/* Canvas */
.bg-grid {
  background:
    radial-gradient(1000px 600px at 10% -10%, #0b1220 0%, #0a0f1c 55%),
    radial-gradient(1200px 700px at 120% 0%, #0b1424 0%, #0a0f1c 60%),
    #0a0f1c;
}

/* Layout */
.layout {
  display: grid;
  grid-template-rows: 1fr auto; /* Make footer stick to bottom */
  grid-template-columns: 18rem 1fr;
  min-height: 100vh;
}

.sidebar {
  grid-row: 1 / 3;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.9);
  backdrop-filter: blur(6px);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.4rem;
}
.badge {
  height: 2rem;
  width: 2rem;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.title {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #e5e7eb;
}

.menu {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.nav-link {
  color: #cbd5e1;
  padding: 0.45rem 0.6rem;
  border-radius: 0.6rem;
  transition: all 0.15s ease-in-out;
  display: block;
}
.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  box-shadow: 0 0 0 1px #374151 inset;
  transform: translateX(2px);
}
.nav-link.active {
   box-shadow: 0 0 0 1px var(--accent) inset, 0 0 16px rgba(99, 102, 241, 0.35);
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 0.5rem;
}

.content {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.content > .route:not(.hidden) {
  flex: 1 1 auto;
}

/* Sections */
.section-header {
  margin-bottom: 0.9rem;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.section-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Card - Simplified Hover */
.card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border-radius: 0.9rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-strong);
}

.card-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-title {
  font-weight: 800;
  letter-spacing: 0.2px;
}
.card-body {
  padding: 1rem;
}

/* Inputs */
.textarea,
.input,
select {
  width: 100%;
  border-radius: 0.6rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: #e5e7eb;
  padding: 0.75rem;
  line-height: 1.4;
  transition: all 0.2s ease;
}
.input:focus,
.textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5); /* Clearer focus ring */
}
.label {
  display: block;
  margin-bottom: 0.25rem;
  color: #cbd5e1;
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  padding: 0.5rem 0.8rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border);
  background: #111827;
  color: #e5e7eb;
  transition: all 0.15s ease;
  cursor: pointer;
}
.btn:hover {
  background: #0b1220;
  box-shadow: var(--glow-soft);
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  border-color: #4338ca;
}
.btn-primary:hover {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
}
.btn-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

/* Severity chips */
.finding-severity {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
}
.sev-critical {
  background: rgba(220, 38, 38, 0.16);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.35);
}
.sev-high {
  background: rgba(234, 88, 12, 0.16);
  color: #fed7aa;
  border: 1px solid rgba(234, 88, 12, 0.35);
}
.sev-medium {
  background: rgba(202, 138, 4, 0.16);
  color: #fde68a;
  border: 1px solid rgba(202, 138, 4, 0.35);
}
.sev-low {
  background: rgba(22, 163, 74, 0.16);
  color: #bbf7d0;
  border: 1px solid rgba(22, 163, 74, 0.35);
}
.sev-info {
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

/* Chips for cookie risks */
.chip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.chip-ok {
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.35);
}
.chip-low {
  background: rgba(22, 163, 74, 0.16);
  color: #bbf7d0;
  border-color: rgba(22, 163, 74, 0.35);
}
.chip-medium {
  background: rgba(202, 138, 4, 0.16);
  color: #fde68a;
  border-color: rgba(202, 138, 4, 0.35);
}
.chip-high {
  background: rgba(220, 38, 38, 0.16);
  color: #fecaca;
  border-color: rgba(220, 38, 38, 0.35);
}

/* Code blocks */
.code-block,
pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: #e5e7eb;
  border-radius: 0.55rem;
  padding: 0.75rem;
  overflow: auto;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Score */
.score-indicator {
  font-size: 1.6rem;
  font-weight: 900;
  color: #e5e7eb;
}

/* Diff */
.diff-pane {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  overflow: hidden;
  background: #0b1220;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.diff-pane:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-soft);
  border-color: var(--accent);
}
.diff-title {
  padding: 0.4rem 0.6rem;
  background: #0d1528;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: #93c5fd;
  font-weight: 700;
}
.diff-body {
  max-height: 480px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
}
.diff-line {
  padding: 2px 8px;
  border-left: 3px solid transparent;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-eq {
  background: transparent;
  color: #e5e7eb;
}
.diff-add {
  background: rgba(16, 185, 129, 0.12);
  border-left-color: #10b981;
  color: #d1fae5;
}
.diff-del {
  background: rgba(239, 68, 68, 0.12);
  border-left-color: #ef4444;
  color: #fee2e2;
}

/* HAR dropzone (improved UI) */
.dropzone {
  min-height: 72px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1.5px dashed #334155;
  border-radius: 0.8rem;
  color: var(--muted);
  background: linear-gradient(
      to bottom,
      rgba(99, 102, 241, 0.05),
      rgba(99, 102, 241, 0.03)
    ),
    var(--panel-2);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.dropzone:hover,
.dropzone:focus {
  border-color: var(--accent);
  box-shadow: var(--glow-soft);
  outline: none;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: linear-gradient(
      to bottom,
      rgba(99, 102, 241, 0.09),
      rgba(99, 102, 241, 0.06)
    ),
    var(--panel-2);
}

/* Styled File Input */
.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-name-display {
    color: var(--muted-2);
    font-size: 0.875rem;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* App Footer */
.app-footer {
    grid-column: 2 / 3;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background-color: var(--panel-2);
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #a78bfa;
}

.footer-link .fa-coffee {
    margin-right: 0.25rem;
}

/* Cookie Analysis */
.cookie-analysis-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1rem;
}

.cookie-card .card-header {
  background-color: #111827;
}

.cookie-card .card-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1.1rem;
  color: var(--accent);
  word-break: break-all;
}

.cookie-attributes {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
}

.cookie-attributes li {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.cookie-attributes .attr-name {
  color: var(--muted);
}

.cookie-attributes .attr-value {
  color: #e5e7eb;
  font-weight: 500;
}

.risk-list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}

.risk-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.risk-list .risk-icon {
  font-size: 1rem;
}

.risk-high .risk-icon { color: #fecaca; }
.risk-high .risk-text { color: #fecaca; }

.risk-medium .risk-icon { color: #fde68a; }
.risk-medium .risk-text { color: #fde68a; }

.risk-low .risk-icon { color: #bbf7d0; }
.risk-low .risk-text { color: #bbf7d0; }

.risk-info .risk-icon { color: #bfdbfe; }
.risk-info .risk-text { color: #bfdbfe; }


/* Mobile-friendly sidebar layout */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto; /* Header, content, footer */
  }
  .sidebar {
    grid-row: auto;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .app-footer {
    grid-column: 1 / 2; /* Span full width on mobile */
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}