/* ========================================
   Process Discovery Configuration Checker
   ======================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  min-height: 100vh;
}

/* ---- Header ---- */
.app-header {
  background: linear-gradient(135deg, #1e40af 0%, #0f172a 100%);
  color: #fff;
  padding: 0 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
}
.logo-area { display: flex; align-items: center; gap: 1rem; }
.logo-icon {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.app-header h1 { font-size: 1.2rem; font-weight: 700; }
.app-header p  { font-size: .78rem; opacity: .75; margin-top: 2px; }
.header-powered {
  font-size: .72rem;
  opacity: .55;
  margin-top: 2px;
  font-weight: 400;
  letter-spacing: .02em;
}
.header-actions { display: flex; gap: .6rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font-size: .85rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .18s;
}
.btn-primary  { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-outline  { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.4); }
.btn-outline:hover { background: rgba(255,255,255,.1); }
.btn-lg { padding: .7rem 1.6rem; font-size: .95rem; }

/* ---- Upload Section ---- */
.upload-section {
  max-width: 900px; margin: 3rem auto; padding: 0 1.5rem;
}
.upload-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
  padding: 2rem 2.5rem;
}
.upload-header { text-align: center; margin-bottom: 2rem; }
.upload-header h2 { font-size: 1.4rem; color: #1e40af; margin-bottom: .5rem; }
.upload-header p  { color: #64748b; font-size: .9rem; }

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}
@media (max-width: 600px) { .upload-grid { grid-template-columns: 1fr; } }

.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #f8fafc;
  user-select: none;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}
.upload-zone.loaded {
  border-color: #16a34a;
  background: #f0fdf4;
}
.upload-zone.error { border-color: #dc2626; background: #fef2f2; }

.upload-zone input[type=file] {
  display: none;
}
.upload-icon { font-size: 1.8rem; margin-bottom: .5rem; color: #94a3b8; }
.upload-zone.loaded .upload-icon { color: #16a34a; }
.upload-zone.error .upload-icon { color: #dc2626; }
.upload-label { font-weight: 600; font-size: .9rem; color: #334155; }
.upload-hint  { font-size: .75rem; color: #94a3b8; margin-top: .25rem; }
.upload-status {
  font-size: .78rem; margin-top: .5rem; font-weight: 500;
  min-height: 1.1em;
  color: #16a34a;
}

.upload-zone.optional {
  border-style: dashed;
  background: #fafafa;
}
.optional-tag {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
  padding: .05rem .35rem;
  margin-left: .35rem;
  vertical-align: middle;
  position: relative;
  top: -1px;
}
.upload-zone.optional .upload-icon i { color: #94a3b8; }
.upload-zone.optional .upload-label  { color: #64748b; }

.upload-footer {
  margin-top: 1.8rem;
  display: flex; justify-content: space-between; align-items: center;
}
.upload-progress-info { font-size: .88rem; color: #64748b; }

/* ---- Results Section ---- */
.results-section { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem 3rem; }
.results-container {}

/* Summary Bar */
.summary-bar {
  display: flex; gap: 1rem; margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.summary-item {
  flex: 1; min-width: 130px;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex; flex-direction: column; gap: .2rem;
  border-left: 4px solid #94a3b8;
}
.summary-item .sum-num  { font-size: 1.8rem; font-weight: 700; color: #1e293b; }
.summary-item .sum-label{ font-size: .8rem; color: #64748b; font-weight: 500; }
.sum-warn { border-color: #f59e0b; }
.sum-info { border-color: #3b82f6; }
.sum-resolved { border-color: #22c55e; }

/* Filter Bar */
.filter-bar {
  background: #fff;
  border-radius: 12px;
  padding: .75rem 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.filter-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-tab {
  padding: .4rem .9rem;
  border-radius: 7px;
  border: none; background: #f1f5f9;
  font-size: .82rem; font-weight: 600; color: #475569;
  cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: .35rem;
}
.filter-tab:hover { background: #e2e8f0; }
.filter-tab.active { background: #2563eb; color: #fff; }

.filter-search {
  display: flex; align-items: center; gap: .5rem;
  background: #f8fafc; border: 1.5px solid #e2e8f0;
  border-radius: 8px; padding: .4rem .8rem;
}
.filter-search i { color: #94a3b8; font-size: .85rem; }
.filter-search input {
  border: none; background: none; outline: none;
  font-size: .85rem; width: 200px; color: #334155;
}

/* ---- Report Group ---- */
.report-group {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  margin-bottom: 1.2rem;
  overflow: hidden;
}
.report-group-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.3rem;
  cursor: pointer;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  user-select: none;
  transition: background .15s;
}
.report-group-header:hover { background: #f1f5f9; }
.rg-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; color: #fff; flex-shrink: 0;
}
.rg-icon-apps   { background: #2563eb; }
.rg-icon-pm     { background: #7c3aed; }
.rg-icon-psnr   { background: #0891b2; }
.rg-title { font-weight: 700; font-size: 1rem; flex: 1; }
.rg-badge { font-size: .75rem; font-weight: 700; padding: .2rem .65rem; border-radius: 20px; color: #fff; background: #94a3b8; }
.rg-badge-warn { background: #f59e0b; }
.rg-badge-info { background: #3b82f6; }
.rg-badge-ok   { background: #22c55e; }
.rg-toggle { color: #94a3b8; transition: transform .2s; }
.rg-toggle.open { transform: rotate(180deg); }
.report-group-body { padding: .75rem 1rem; display: none; }
.report-group-body.open { display: block; }

/* ---- Finding Card ---- */
.finding-card {
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: .75rem;
  overflow: hidden;
  transition: opacity .2s;
}
.finding-card.resolved { opacity: .55; }
.finding-card.hidden { display: none; }

.finding-header {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  cursor: pointer;
}
.finding-badge {
  flex-shrink: 0; margin-top: 1px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: #fff;
}
.badge-warning { background: #f59e0b; }
.badge-info    { background: #3b82f6; }
.badge-ok      { background: #22c55e; }
.badge-resolved{ background: #22c55e; }

/* OK (all-clear) finding cards */
.finding-card.ok-card {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.finding-card.ok-card .finding-header { cursor: default; }
.finding-card.ok-card.expandable .finding-header { cursor: pointer; }
.finding-card.ok-card .finding-title  { color: #15803d; }
.ok-expand-hint {
  font-size: .75rem; color: #16a34a; margin-left: auto;
  transition: transform .2s;
}
.finding-card.ok-card .finding-body.open ~ .finding-header .ok-expand-hint,
.ok-expand-hint.open { transform: rotate(180deg); }

.finding-title { flex: 1; font-weight: 600; font-size: .88rem; color: #1e293b; line-height: 1.4; }
.finding-app-tag {
  font-size: .72rem; background: #eff6ff; color: #1d4ed8;
  border-radius: 4px; padding: .1rem .45rem; font-weight: 600;
  flex-shrink: 0;
}

.finding-resolve-btn {
  flex-shrink: 0;
  border: none; cursor: pointer; background: none;
  font-size: .78rem; color: #64748b; font-weight: 600;
  padding: .2rem .5rem; border-radius: 6px;
  display: flex; align-items: center; gap: .3rem;
  transition: all .15s;
}
.finding-resolve-btn:hover { background: #f0fdf4; color: #16a34a; }
.finding-card.resolved .finding-resolve-btn { color: #16a34a; }

.finding-body {
  padding: 0 1rem 1rem 2.7rem;
  font-size: .84rem; color: #475569;
  line-height: 1.6;
  border-top: 1px solid #f1f5f9;
  display: none;
}
.finding-body.open { display: block; }
.finding-body ul { padding-left: 1.2rem; margin-top: .4rem; }
.finding-body li { margin-bottom: .3rem; }
.finding-body .data-list {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: .5rem .75rem;
  margin-top: .5rem;
  font-size: .8rem;
  font-family: 'Courier New', monospace;
  max-height: 260px;
  overflow-y: auto;
}
.finding-body .data-list li { margin-bottom: .2rem; }
.finding-body .highlight { font-weight: 700; color: #1e293b; }
.finding-body .suggestion {
  background: #eff6ff; border-left: 3px solid #2563eb;
  padding: .5rem .75rem; border-radius: 0 6px 6px 0;
  margin-top: .5rem;
}
.finding-body .question-list li { list-style: none; padding-left: 0; }
.finding-body .question-list li::before { content: "❓ "; }

/* ---- Loading ---- */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.loading-box {
  background: #fff; border-radius: 16px;
  padding: 2.5rem 3rem; text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.spinner {
  width: 50px; height: 50px;
  border: 4px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-weight: 700; font-size: 1.1rem; color: #1e293b; }
.loading-sub  { font-size: .85rem; color: #64748b; margin-top: .3rem; }

/* ---- Skipped Optional Notice ---- */
.skipped-notice {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 4px solid #0ea5e9;
  border-radius: 10px;
  padding: .75rem 1.1rem;
  font-size: .84rem;
  color: #0369a1;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.skipped-notice i { flex-shrink: 0; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center; padding: 2.5rem 1rem;
  color: #94a3b8;
}
.empty-state i { font-size: 2.5rem; margin-bottom: .8rem; }
.empty-state p { font-size: .9rem; }

/* ---- Export ---- */
@media print {
  .app-header .header-actions, .filter-bar, .btn { display: none !important; }
  .report-group-body { display: block !important; }
  .finding-body { display: block !important; }
}
