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

:root {
  --blue-900: #1e40af;
  --blue-700: #1d4ed8;
  --blue-500: #3b82f6;
  --blue-300: #60a5fa;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-100: #e2e8f0;
  --bg: linear-gradient(135deg, #0b1223 0%, #102a5c 50%, #0b1223 100%);
  --card: #0f172a;
  --muted: #cbd5e1;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: #e5e7eb;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--blue-300);
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(15, 23, 42, 0.8);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 240px;
}

.sidebar h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-section {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  padding: 12px 14px;
  border-radius: 10px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}

.main {
  padding: 36px 46px;
}

.main-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
}

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

.header .title {
  font-size: 24px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
  font-weight: 600;
  font-size: 12px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #cbd5e1;
}

.card .value {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.small {
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.5;
}

.muted {
  color: #94a3b8;
  font-size: 13px;
}

.section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  width: 100%;
}

.section h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #e2e8f0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.label {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 6px;
  display: block;
}

.input,
.select,
.textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e5e7eb;
}

.select {
  background: #3b82f6;
  border-color: rgba(59, 130, 246, 0.5);
  color: #fff;
}

.select option {
  background: #1e3a8a;
  color: #fff;
  padding: 10px 12px;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid rgba(59, 130, 246, 0.6);
  border-color: rgba(59, 130, 246, 0.5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: linear-gradient(120deg, var(--blue-900), var(--blue-500));
  color: #fff;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: linear-gradient(120deg, #991b1b, #dc2626);
  color: #fff;
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(120deg, #7f1d1d, #b91c1c);
}

.btn:hover {
  transform: translateY(-1px);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  color: #e2e8f0;
}

thead {
  background: rgba(59, 130, 246, 0.12);
}

thead th {
  text-align: left;
  padding: 12px;
  font-size: 13px;
  letter-spacing: 0.2px;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.empty-row td {
  text-align: center;
  color: #94a3b8;
}

.status-chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-block;
}

.status-chip.success {
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.status-chip.danger {
  background: rgba(248, 113, 113, 0.15);
  color: #fecdd3;
}

.status-chip.neutral {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.source-chip {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  display: inline-block;
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
  font-weight: 600;
}

.progress {
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress .bar {
  height: 100%;
  background: #3b82f6;
  width: 0;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  position: relative;
  white-space: nowrap;
  padding: 0 12px;
  text-align: center;
}

.progress .bar.empty {
  background: transparent;
  color: #94a3b8;
  text-shadow: none;
}

.progress .bar.active {
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow);
  display: none;
  min-width: 260px;
}

.toast.show {
  display: block;
}

.toast.tone-success {
  border-color: rgba(34, 197, 94, 0.7);
}

.toast.tone-danger {
  border-color: rgba(239, 68, 68, 0.7);
}

.banner {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #e5e7eb;
  margin-bottom: 12px;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hamburger {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 15;
}

.overlay.show {
  display: block;
}

@media (max-width: 1024px) {
  .layout {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: 0 40% 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 20;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .hamburger {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
}

.modal-body pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 16px;
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body pre::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.modal-body pre::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
}

.modal-body pre::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
}

.modal-body pre::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Quick View Button */
.btn-quick-view {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.3);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-weight: 600;
}

.btn-quick-view:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #fff;
  border-color: rgba(59, 130, 246, 0.5);
}

.btn-quick-view:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Accordion Styles */
#results-accordion {
  min-height: 100px;
}

.accordion-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  display: block;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(59, 130, 246, 0.08);
  cursor: pointer;
  transition: background 0.2s ease;
  user-select: none;
}

.accordion-header:hover {
  background: rgba(59, 130, 246, 0.15);
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.accordion-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  font-size: 18px;
  color: #bfdbfe;
}

.accordion-icon.expanded {
  transform: rotate(180deg);
}

.accordion-title {
  font-weight: 700;
  font-size: 15px;
  color: #e2e8f0;
}

.accordion-count {
  font-size: 13px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
}

.btn-export-group {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
  border: 1px solid rgba(34, 197, 94, 0.3);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-weight: 600;
  white-space: nowrap;
}

.btn-export-group:hover {
  background: rgba(34, 197, 94, 0.25);
  color: #fff;
  border-color: rgba(34, 197, 94, 0.5);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: rgba(255, 255, 255, 0.01);
}

.accordion-content.expanded {
  max-height: 100000px;
  transition: max-height 0.5s ease-in;
}

.accordion-table-wrapper {
  overflow-x: auto;
  border-radius: 0;
}

.accordion-table {
  width: 100%;
  border-collapse: collapse;
  color: #e2e8f0;
}

.accordion-table thead {
  background: rgba(59, 130, 246, 0.12);
}

.accordion-table thead th {
  text-align: left;
  padding: 12px;
  font-size: 13px;
  letter-spacing: 0.2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.accordion-table tbody td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.accordion-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-size: 15px;
}
