/* ─────────────────────────────────────────
   Base & scrollbar
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f0f4f8; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #002233; border-radius: 3px; }

/* ─────────────────────────────────────────
   Header gradient
───────────────────────────────────────── */
.header-bg {
  background: linear-gradient(135deg, #002233 0%, #003a55 60%, #00162a 100%);
}

/* ─────────────────────────────────────────
   Glow effects
───────────────────────────────────────── */
.glow-blue  { box-shadow: 0 0 20px rgba(0,219,255,0.25); }
.glow-purple{ box-shadow: 0 0 20px rgba(164,77,255,0.25); }
.glow-orange{ box-shadow: 0 0 20px rgba(255,137,0,0.25); }

/* ─────────────────────────────────────────
   Upload zone
───────────────────────────────────────── */
#upload-zone {
  border: 2px dashed #00dbff;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}
#upload-zone:hover, #upload-zone.drag-over {
  background: rgba(0,219,255,0.06);
  border-color: #a44dff;
  box-shadow: 0 0 30px rgba(0,219,255,0.2);
}

/* ─────────────────────────────────────────
   Progress bar shimmer
───────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.progress-bar-inner {
  background: linear-gradient(90deg, #00dbff 25%, #a44dff 50%, #00dbff 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  transition: width 0.3s ease;
}

/* ─────────────────────────────────────────
   Tab active
───────────────────────────────────────── */
.tab-btn { transition: all 0.2s; }
.tab-btn.active {
  background: #002233;
  color: #00dbff;
  border-bottom: 3px solid #00dbff;
}
.tab-btn:not(.active):hover { background: rgba(0,34,51,0.08); }

/* ─────────────────────────────────────────
   Cards
───────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2eaf2;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,34,51,0.12); }

.card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

/* ─────────────────────────────────────────
   Badge
───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }

/* ─────────────────────────────────────────
   Vendedor timeline
───────────────────────────────────────── */
.timeline-item::before {
  content: '';
  position: absolute;
  left: 14px; top: 28px;
  width: 2px; height: calc(100% - 28px);
  background: #e2e8f0;
}
.timeline-item:last-child::before { display: none; }

/* ─────────────────────────────────────────
   Table
───────────────────────────────────────── */
.data-table th {
  background: #002233;
  color: #00dbff;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.data-table tr:hover td { background: #f8fafc; }

/* ─────────────────────────────────────────
   Sync row
───────────────────────────────────────── */
.sync-row { border-left: 4px solid transparent; transition: background 0.15s; }
.sync-row.success { border-color: #10b981; }
.sync-row.partial { border-color: #f59e0b; }
.sync-row.failure { border-color: #ef4444; }
.sync-row:hover { background: #f8fafc; }

/* ─────────────────────────────────────────
   Spin animation
───────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }

/* ─────────────────────────────────────────
   Fade in
───────────────────────────────────────── */
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn 0.35s ease both; }

/* ─────────────────────────────────────────
   Empty state
───────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; color: #94a3b8; }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.4; }

/* ─────────────────────────────────────────
   Log Viewer Card
───────────────────────────────────────── */
.log-viewer-card {
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* Viewport — overflow:auto allows both x and y scroll */
.log-viewport {
  overflow: auto;
  overflow-anchor: none;
  height: 480px;
  background: #fff;
  border-radius: 0 0 12px 12px;
  transition: height 0.3s cubic-bezier(.4,0,.2,1);
}
.log-viewport.minimized { height: 0 !important; overflow: hidden; }

/* Lines container — width: 100% enables wrapping to viewport width */
.log-lines-container { width: 100%; }

/* Individual log line.
   Adjusted from fixed height to support word wrapping. */
.log-line {
  display: flex;
  align-items: stretch;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 11.5px;
  min-height: 18px;
  line-height: 18px;
  white-space: pre-wrap;
  word-break: break-all;
  border-left: 3px solid transparent;
  color: #1e293b;
  transition: background 0.08s;
}
.log-line:hover { background: rgba(0,34,51,0.035) !important; }

/* Find highlighting */
.log-line.find-match   { background: rgba(245,158,11,0.13) !important; border-left-color: #f59e0b !important; }
.log-line.find-current { background: rgba(245,158,11,0.30) !important; border-left-color: #d97706 !important; outline: 1px solid rgba(245,158,11,0.5); }

/* Line number column — clickable */
.log-line-num {
  user-select: none;
  color: #94a3b8;
  font-size: 10.5px;
  min-width: 56px;
  text-align: right;
  padding: 0 10px 0 8px;
  flex-shrink: 0;
  border-right: 1px solid #e5e7eb;
  margin-right: 10px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  line-height: 18px;
  transition: color 0.12s, background 0.12s;
}
.log-line-num:hover { color: #00b4d8; background: rgba(0,180,216,0.07); }

/* Line text */
.log-line-text {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 18px;
  padding-right: 24px;
}

/* ── Toolbar ── */
.log-viewer-toolbar { flex-shrink: 0; }

.log-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid #e2eaf2;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.log-toolbar-btn:hover {
  border-color: #00dbff;
  color: #002233;
  box-shadow: 0 2px 8px rgba(0,219,255,0.15);
}
.log-toolbar-btn.active {
  background: linear-gradient(135deg, #002233, #003a55);
  color: #00dbff;
  border-color: rgba(0,219,255,0.4);
  box-shadow: 0 0 12px rgba(0,219,255,0.2);
}
.log-toolbar-btn--primary {
  background: linear-gradient(135deg, rgba(0,219,255,0.08), rgba(164,77,255,0.08));
  border-color: rgba(0,219,255,0.35);
  color: #002233;
}
.log-toolbar-btn--primary:hover {
  background: linear-gradient(135deg, rgba(0,219,255,0.18), rgba(164,77,255,0.18));
  border-color: #a44dff;
  box-shadow: 0 2px 12px rgba(164,77,255,0.2);
}

/* ── Find bar nav buttons ── */
.log-find-nav-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid #fde68a;
  background: #fff;
  color: #92400e;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.log-find-nav-btn:hover { background: #fef3c7; border-color: #f59e0b; }

/* ── Filter dropdown items ── */
.filter-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background 0.1s;
  color: #374151;
}
.filter-dropdown-item:hover { background: #f8fafc; }
.filter-dropdown-item.active { background: #eff6ff; color: #1d4ed8; font-weight: 600; }

/* ─────────────────────────────────────────
   Highlight Rules Modal
───────────────────────────────────────── */
.highlight-rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2eaf2;
  background: #f8fafc;
  transition: border-color 0.15s;
}
.highlight-rule-row:hover { border-color: rgba(0,219,255,0.38); }
.highlight-rule-row input[type="text"] {
  flex: 1;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid #e2eaf2;
  background: #fff;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.highlight-rule-row input[type="text"]:focus {
  border-color: #00dbff;
  box-shadow: 0 0 0 3px rgba(0,219,255,0.12);
}
.highlight-rule-row input[type="color"] {
  width: 36px;
  height: 32px;
  padding: 2px;
  border-radius: 7px;
  border: 1px solid #e2eaf2;
  cursor: pointer;
  background: #fff;
}
.highlight-rule-preview {
  font-size: 11px;
  font-family: monospace;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rule-delete-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.rule-delete-btn:hover { background: #fee2e2; border-color: #ef4444; }

.rule-case-btn {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid #e2eaf2;
  background: #fff;
  color: #94a3b8;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.rule-case-btn.active {
  background: #002233;
  color: #00dbff;
  border-color: rgba(0,219,255,0.4);
}
