/* =====================================================
   SUPERADMIN AUDIT V2 – FULL CLEAN CSS
   Byggd för nuvarande audit.js
   Inga portal-globala regler
   ===================================================== */

.audit-v2{
  background: linear-gradient(180deg, #eef6ff 0%, #dbeafe 100%);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #111827;
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

/* =====================================================
   SUMMARY
   ===================================================== */

.audit-summary-grid{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.audit-summary-subgrid{
  margin-top: -4px;
}

.audit-card{
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 140px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  box-sizing: border-box;
}

.audit-card:nth-child(1){ border-color: #93c5fd; }
.audit-card:nth-child(2){ border-color: #86efac; }
.audit-card:nth-child(3){ border-color: #fde68a; }
.audit-card:nth-child(4){ border-color: #fca5a5; }

.audit-card-label{
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.audit-card-value{
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.audit-card-list{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #111827;
}

/* =====================================================
   TOP BAR
   ===================================================== */

.audit-top{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: #eaf3ff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
}

.audit-top button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.audit-top button:hover{
  transform: translateY(-1px);
}

.audit-top button:active{
  transform: scale(0.97);
}

.audit-top button:disabled{
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#audit-back-users{
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #dc2626;
}

#audit-back-users:hover{
  background: #dc2626;
}

#audit-refresh{
  background: #3b82f6;
  color: #ffffff;
}

#audit-refresh:hover{
  background: #2563eb;
}

#audit-reset{
  background: #f59e0b;
  color: #ffffff;
}

#audit-reset:hover{
  background: #d97706;
}

#audit-only-errors{
  background: #ef4444;
  color: #ffffff;
}

#audit-only-errors:hover{
  background: #dc2626;
}

#audit-copy-list,
#audit-copy-detail{
  background: #10b981;
  color: #ffffff;
}

#audit-copy-list:hover,
#audit-copy-detail:hover{
  background: #059669;
}

#audit-export-json,
#audit-export-csv,
#audit-export-detail{
  background: #e5e7eb;
  color: #111827;
}

#audit-export-json:hover,
#audit-export-csv:hover,
#audit-export-detail:hover{
  background: #d1d5db;
}

#audit-prev-page,
#audit-next-page{
  background: #dbeafe;
  color: #1e3a8a;
}

#audit-prev-page:hover,
#audit-next-page:hover{
  background: #bfdbfe;
}

/* =====================================================
   QUICK FILTERS
   ===================================================== */

.audit-severity-filter,
.audit-date-quick-filter{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.audit-severity-filter button,
.audit-date-quick-filter button{
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audit-severity-filter button:hover,
.audit-date-quick-filter button:hover{
  transform: translateY(-1px);
}

.audit-severity-filter button.active,
.audit-date-quick-filter button.active{
  outline: 3px solid rgba(0,0,0,0.18);
}

.audit-severity-filter button[data-sev=""]{
  background: #e5e7eb;
  color: #111827;
}

.audit-severity-filter .sev-green{
  background: #22c55e;
  color: #ffffff;
}

.audit-severity-filter .sev-yellow{
  background: #f59e0b;
  color: #ffffff;
}

.audit-severity-filter .sev-red{
  background: #ef4444;
  color: #ffffff;
}

.audit-date-quick-filter button{
  background: #dbeafe;
  color: #1d4ed8;
}

.audit-date-quick-filter button:hover{
  background: #bfdbfe;
}
.audit-severity-filter button.active,
.audit-date-quick-filter button.active{
  outline:3px solid #111827;
}
/* =====================================================
   FILTERS
   ===================================================== */

.audit-filters{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  padding: 14px;
  border-radius: 12px;
  box-sizing: border-box;
}

.audit-filter{
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
}

.audit-filter label{
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

.audit-filter input,
.audit-filter select{
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #111827;
  box-sizing: border-box;
}

#audit-q{
  min-width: 220px;
}
.audit-detail-title{
  letter-spacing:0.5px;
}

.audit-detail-sub{
  opacity:0.85;
}
/* =====================================================
   MAIN LAYOUT
   ===================================================== */

.audit-main-layout{
  display: flex;
  gap: 18px;
  align-items: stretch;
}

.audit-left{
  flex: 0 0 44%;
  max-height: 70vh;
  overflow: auto;
  padding-right: 4px;
}

.audit-right{
  flex: 1;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #93c5fd;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  box-sizing: border-box;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.audit-row{
  transition: all 0.12s ease;
}

.audit-row:hover{
  transform: translateY(-2px) scale(1.01);
}
/* =====================================================
   DETAIL PANEL BACKGROUNDS
   ===================================================== */

.audit-right.sev-info{
  background: linear-gradient(180deg, #d9fbe6 0%, #b9f6cf 100%);
  border-left-color: #16a34a;
}

.audit-right.sev-warn{
  background: linear-gradient(180deg, #fff1bf 0%, #fde68a 100%);
  border-left-color: #d97706;
}

.audit-right.sev-error{
  background: linear-gradient(180deg, #ffd5d5 0%, #fca5a5 100%);
  border-left-color: #dc2626;
}

.audit-right.sev-default{
  background: linear-gradient(180deg, #f8fbff 0%, #dbeafe 100%);
  border-left-color: #60a5fa;
}

/* =====================================================
   LIST
   ===================================================== */

.audit-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-row{
  padding: 14px 14px 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 6px solid #9ca3af;
  box-sizing: border-box;
}

.audit-row:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.10);
}

.audit-row.selected{
  outline: 3px solid #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
  transform: scale(1.01);
}

/* severity in list */

.audit-ok{
  background: linear-gradient(180deg, #bbf7d0 0%, #86efac 100%);
  border-left-color: #16a34a;
}

.audit-row.selected.audit-ok{
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
}

.audit-warn{
  background: linear-gradient(180deg, #fef9c3 0%, #fde047 100%);
  border-left-color: #d97706;
}

.audit-bad{
  background: linear-gradient(180deg, #fee2e2 0%, #f87171 100%);
  border-left-color: #dc2626;
}

.audit-info{
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-left-color: #60a5fa;
}

.audit-row-head{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.audit-row-title{
  font-weight: 800;
  font-size: 16px;
  color: #111827;
}

.audit-row-severity{
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0.85;
}

.audit-row-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: #1f2937;
  opacity: 0.9;
}

/* =====================================================
   DETAIL
   ===================================================== */

.audit-detail{
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audit-detail-top{
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.audit-detail-title{
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  color: #111827;
}

.audit-detail-sub{
  margin-top: 4px;
  font-size: 18px;
  color: #1f2937;
}

.audit-detail-nav{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.audit-detail-nav button{
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

#audit-detail-prev,
#audit-detail-next{
  background: #f3f4f6;
  color: #111827;
}

#audit-detail-prev:hover,
#audit-detail-next:hover{
  background: #e5e7eb;
}

#audit-open-target-user{
  background: #3b82f6;
  color: #ffffff;
}

#audit-open-target-user:hover{
  background: #2563eb;
}

#audit-filter-this-user{
  background: #8b5cf6;
  color: #ffffff;
}

#audit-filter-this-user:hover{
  background: #7c3aed;
}

.audit-detail-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.audit-detail-grid > div{
  background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 100%);
  border: 1px solid #93c5fd;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  box-sizing: border-box;
  min-height: 74px;
}

.audit-detail strong{
  display: inline-block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.audit-detail-block{
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
}

.audit-detail-block-title{
  font-size: 13px;
  font-weight: 800;
  color: #374151;
  margin-bottom: 8px;
}

.audit-detail pre{
  background: #111827;
  color: #f9fafb;
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

/* =====================================================
   EMPTY / ERROR / FOOTER
   ===================================================== */

.audit-empty,
.audit-detail-empty{
  padding: 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
  border: 1px solid #cbd5e1;
  color: #374151;
}

.audit-error{
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.audit-footer{
  text-align: right;
  font-size: 13px;
  color: #6b7280;
}

/* =====================================================
   NEW ROW FLASH
   ===================================================== */

.audit-new{
  animation: flashNew 1s ease;
}

@keyframes flashNew{
  0% { box-shadow: 0 0 0 4px rgba(253, 224, 71, 0.65); }
  100% { box-shadow: none; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1100px){
  .audit-main-layout{
    flex-direction: column;
  }

  .audit-left{
    flex: 1 1 auto;
    max-height: none;
  }

  .audit-detail-grid{
    grid-template-columns: 1fr;
  }
}