@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --bg-color: #050505;
  --sidebar-bg: rgba(10, 10, 10, 0.7);
  --card-bg: rgba(20, 20, 20, 0.5);
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --primary: #ffffff;
  --primary-hover: #e4e4e7;
  --primary-text: #000000;
  --approved: #4ade80;
  --rejected: #f87171;
  --border: rgba(255, 255, 255, 0.08);
  --glass-blur: 16px;
}

body {
  margin: 0;
  display: flex;
  height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  position: relative;
  overflow: hidden;
  z-index: 0;
  transition: box-shadow 0.2s;
}

body.dragover {
  box-shadow: inset 0 0 0 4px var(--primary);
}

/* Background glowing orbs */
body::before {
  content: "";
  position: absolute;
  top: -10%;
  right: 10%;
  width: 400px;
  height: 400px;
  background: rgba(59, 130, 246, 0.2);
  filter: blur(100px);
  z-index: -1;
  border-radius: 50%;
}

body::after {
  content: "";
  position: absolute;
  bottom: -10%;
  left: 20%;
  width: 300px;
  height: 300px;
  background: rgba(74, 222, 128, 0.15);
  filter: blur(80px);
  z-index: -1;
  border-radius: 50%;
}

.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar h2 {
  color: var(--text-main);
  margin-top: 0;
  margin-bottom: 32px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.icon-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
  transform: none;
}

.filter-section {
  margin-bottom: 24px;
}

.filter-section h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  margin-top: 0;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.checklist::-webkit-scrollbar {
  width: 4px;
}
.checklist::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
}

.checklist-item input[type="checkbox"] {
  cursor: pointer;
}

button {
  background-color: var(--primary);
  color: var(--primary-text);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  transition: all 0.2s;
}

button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

h1 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 4px 12px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.kpi-card, .chart-container {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  min-width: 0;
}

.kpi-card h3 {
  margin: 0 0 8px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
}

.text-green { color: var(--approved) !important; }
.text-red { color: var(--rejected) !important; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.charts-grid.single-chart {
  grid-template-columns: minmax(300px, 400px);
  justify-content: center;
}

.chart-container h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted);
}

.cards-section {
  background: transparent;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h3 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.filters-container {
  display: flex;
  gap: 12px;
}

.filter-dropdown {
  background: rgba(0, 0, 0, 0.4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  background-size: 16px;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 36px 10px 16px;
  font-family: 'Outfit', sans-serif;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.filter-dropdown option {
  background: var(--bg-color);
  color: var(--text-main);
}

input[type="text"] {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 16px;
  font-family: 'Outfit', sans-serif;
  width: 250px;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

.payload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.payload-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  padding: 16px;
  min-height: 140px;
}

.payload-card:hover {
  background: rgba(40, 40, 40, 0.7);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.payload-id {
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--text-main);
  word-break: break-all;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: var(--bg-color);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 20, 20, 0.8);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-main);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text-main);
  background: transparent;
  transform: none;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  background: rgba(10, 10, 10, 0.6);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.payload-full {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.4);
  padding: 20px;
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--border);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 8px 24px;
  border-radius: 4px;
  font-size: 1rem;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  transform: none;
}

.tab-btn.active {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Analysis Grid */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
  min-width: 0;
  width: 100%;
}

.analysis-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.analysis-card h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  width: 100%;
  min-width: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.2);
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Insight Stats */
.insight-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  justify-content: center;
}

.insight-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.insight-stat .label {
  color: var(--text-muted);
  font-weight: 500;
}

.insight-stat .value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #34d399; /* Green tint */
}

/* Extreme Payloads */
.extreme-payloads {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.extreme-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.extreme-header {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

.extreme-content {
  padding: 12px;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  word-break: break-all;
  flex: 1;
  overflow-y: auto;
  max-height: 120px;
}

.chart-wrapper {
  position: relative;
  height: 300px;
  width: 100%;
  min-width: 0;
}

.watermark {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('assets/bg.png');
  background-repeat: no-repeat;
  background-position: calc(50% + 50px) center;
  transform: scale(1);
  opacity: 0.1;
  z-index: 1;
  pointer-events: none;
}

.mobile-only {
  display: none !important;
}

.mobile-overlay {
  display: none;
}

/* Responsive Design */
@media (max-width: 900px) {
  body {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
  }

  .mobile-only {
    display: flex !important;
  }

  .mobile-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    z-index: 2000;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transition: left 0.3s ease;
    padding: 24px;
    overflow-y: auto;
  }

  .sidebar.open {
    left: 0;
  }

  .checklist {
    max-height: none;
  }

  .main-content {
    overflow-y: visible;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px;
  }

  .header-actions {
    align-self: flex-end;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .filters-container {
    flex-direction: column;
    width: 100%;
  }

  input[type="text"] {
    width: 100%;
    box-sizing: border-box;
  }

  .kpi-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
  }

  .kpi-card {
    padding: 12px;
    text-align: center;
  }

  .kpi-card h3 {
    font-size: 0.65rem;
    margin-bottom: 4px;
    letter-spacing: 0;
  }

  .kpi-card p {
    font-size: 1.4rem;
  }

  .kpi-card:nth-child(1),
  .kpi-card:nth-child(2),
  .kpi-card:nth-child(3) {
    grid-column: span 2;
  }

  .kpi-card:nth-child(4),
  .kpi-card:nth-child(5) {
    grid-column: span 3;
  }

  .payload-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .payload-card {
    padding: 8px;
    min-height: 100px;
  }

  .payload-id {
    font-size: 0.85rem;
  }

  .payload-card > div:nth-child(2) {
    font-size: 0.7rem !important;
    word-break: break-word;
  }
}
