/* ========================================================
   Profit Intelligence Platform – Revenue Leakage Engine
   Custom Styles
   ======================================================== */

/* ---------- Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #151e3f;
}
::-webkit-scrollbar-thumb {
  background: #3a559f;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #5470b5;
}

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #2d3a6b;
  border-top-color: #e53e3e;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Drop Zone ---------- */
#drop-zone {
  transition: border-color 0.25s ease, background-color 0.25s ease;
  user-select: none;
}

#drop-zone.drag-over {
  border-color: #e53e3e !important;
  background-color: #1e2a57 !important;
}

#drop-zone.drag-over #drop-icon {
  transform: scale(1.2);
  transition: transform 0.2s ease;
}

/* ---------- Summary Cards ---------- */
#summary-cards > div {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#summary-cards > div:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(229, 62, 62, 0.15);
}

/* ---------- Top Issues Cards ---------- */
.issue-card {
  background: #1e2a57;
  border: 1px solid #2d3a6b;
  border-left: 4px solid;
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.2s ease;
}
.issue-card:hover {
  background: #243260;
  transform: translateX(3px);
}

.issue-card.severity-High {
  border-left-color: #e53e3e;
}
.issue-card.severity-Medium {
  border-left-color: #f6e05e;
}
.issue-card.severity-Low {
  border-left-color: #9ae6b4;
}

/* ---------- Table ---------- */
#findings-table thead tr {
  position: sticky;
  top: 0;
  z-index: 1;
}

#findings-tbody tr {
  transition: background-color 0.15s ease;
}

#findings-tbody tr:hover {
  background-color: #1e2a57 !important;
}

#findings-tbody tr:nth-child(even) {
  background-color: rgba(45, 58, 107, 0.3);
}

/* ---------- Severity Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-High {
  background-color: #e53e3e;
  color: #fff;
}

.badge-Medium {
  background-color: #f6e05e;
  color: #744210;
}

.badge-Low {
  background-color: #9ae6b4;
  color: #1c4532;
}

/* ---------- Rule Tags ---------- */
.rule-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background-color: #1e2a57;
  border: 1px solid #3a559f;
  color: #adbade;
  white-space: nowrap;
}

/* ---------- Leakage Amount ---------- */
.leakage-amount {
  color: #fc8181;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Animate fade-in for results ---------- */
.fade-in {
  animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Button pulse effect ---------- */
#analyze-btn:not(:disabled):hover {
  box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.25);
}

/* ---------- Download button ---------- */
#download-btn:hover {
  box-shadow: 0 0 0 4px rgba(72, 187, 120, 0.25);
  transform: translateY(-1px);
}

/* ---------- Responsive table wrapper ---------- */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* ---------- Search highlight ---------- */
.highlight {
  background-color: rgba(229, 62, 62, 0.25);
  border-radius: 2px;
}
