/* San Andreas State Marshals - Records Viewer Dark Theme (Ultra-Compact) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-header: rgba(15, 23, 42, 0.95);
  --bg-input: #111827;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(239, 68, 68, 0.4);
  
  --primary-red: #ef4444;
  --primary-red-hover: #dc2626;
  --primary-red-glow: rgba(239, 68, 68, 0.25);
  
  --accent-gold: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-main: 0 4px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 15px rgba(239, 68, 68, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.4;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(239, 68, 68, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(245, 158, 11, 0.05) 0%, transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(239, 68, 68, 0.4);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(239, 68, 68, 0.7);
}

/* Layout Containers */
.app-container {
  width: 100%;
  max-width: 100% !important;
  margin: 0 auto;
  padding: 6px 12px;
}

/* Header Navbar (Ultra Compact) */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  box-shadow: var(--shadow-main);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.4));
  transition: transform 0.2s ease;
}
.brand-logo:hover {
  transform: scale(1.05);
}

.brand-text h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #ffffff 30%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  line-height: 1.1;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Metrics Text Blip */
.records-blip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.auth-badge .dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-red) 0%, #b91c1c 100%);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--primary-red-glow);
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #f87171 0%, var(--primary-red) 100%);
  transform: translateY(-1px);
}

/* Locked Access Screen */
.lock-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

.lock-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-main), var(--shadow-glow);
}

.lock-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  color: var(--primary-red);
  filter: drop-shadow(0 0 10px var(--primary-red-glow));
}

.lock-card h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-main);
  text-transform: uppercase;
}

.lock-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.command-notice {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: #fca5a5;
  font-weight: 500;
}

.code-input-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.input-field:focus {
  border-color: var(--primary-red);
}

/* Project Selection View */
.projects-header {
  margin-bottom: 16px;
}
.projects-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.projects-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.project-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-red);
  opacity: 0.6;
}
.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-main);
}

.project-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.project-stats-mini {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Dashboard Controls (Ultra Condensed) */
.dashboard-controls {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  margin-bottom: 6px;
  box-shadow: var(--shadow-main);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.select-field {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

/* Active Filter Badges */
.active-filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  margin-top: 6px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.filter-tag .remove-btn {
  cursor: pointer;
  font-weight: bold;
}
.filter-tag .remove-btn:hover {
  color: white;
}

/* Compact Data Table styling (Single-line constrained) */
.table-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-main);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
  table-layout: fixed;
}

.data-table th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  border-bottom: 2px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table th:hover {
  color: var(--text-main);
  background: rgba(30, 41, 59, 0.95);
}

.data-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.data-table tbody tr {
  transition: background 0.12s ease;
  height: 30px;
}
.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}
.data-table tbody tr:hover {
  background: rgba(239, 68, 68, 0.12);
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
}

.comment-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(6, 182, 212, 0.2);
  color: #22d3ee;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.72rem;
  margin-right: 4px;
  font-weight: 600;
}

/* Action Cell Color Classes */
.action-bank {
  color: var(--accent-gold) !important;
  font-weight: 700;
}
.action-answered {
  color: var(--accent-green) !important;
  font-weight: 700;
}
.action-missed {
  color: var(--primary-red) !important;
  font-weight: 700;
}
.action-sms {
  color: var(--accent-cyan) !important;
  font-weight: 700;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid var(--border-color);
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-main), var(--shadow-glow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  font-size: 0.85rem;
  line-height: 1.5;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.detail-label {
  color: var(--text-muted);
  font-weight: 600;
}
.detail-value {
  color: var(--text-main);
  text-align: right;
  font-family: var(--font-mono);
}

/* Floating Image Hover Preview Tooltip */
.img-preview-tooltip {
  position: fixed;
  z-index: 99999;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  display: none;
  max-width: 340px;
  max-height: 260px;
  backdrop-filter: blur(12px);
}
.img-preview-tooltip img {
  max-width: 328px;
  max-height: 248px;
  border-radius: 4px;
  display: block;
  object-fit: contain;
}

/* Custom Context Menu */
.custom-context-menu {
  position: fixed;
  z-index: 999999;
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 4px 0;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
  display: none;
  min-width: 180px;
  backdrop-filter: blur(16px);
}
.custom-context-menu-item {
  padding: 8px 14px;
  font-size: 0.8rem;
  color: #f9fafb;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}
.custom-context-menu-item:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}
.custom-context-menu-divider {
  height: 1px;
  background: #374151;
  margin: 4px 0;
}

/* Tactical GTAV Map Modal & Hover Preview Styles */
.map-modal {
  display: none;
  position: fixed;
  z-index: 999999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
}
.map-modal-content {
  position: relative;
  background-color: #111827;
  border: 1px solid #ef4444;
  border-radius: 12px;
  margin: 2% auto;
  padding: 16px;
  width: 92%;
  max-width: 1100px;
  height: 88vh;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 25px rgba(239, 68, 68, 0.2);
  display: flex;
  flex-direction: column;
}
.map-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #374151;
}
.map-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f9fafb;
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.map-modal-close:hover {
  color: #ef4444;
}

.map-hover-tooltip {
  position: fixed;
  z-index: 999999;
  background: #111827;
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  pointer-events: none;
  display: none;
  width: 280px;
  height: 200px;
}

.location-tag-badge {
  background: rgba(34, 211, 238, 0.15) !important;
  color: #22d3ee !important;
  border: 1px solid rgba(34, 211, 238, 0.4) !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  transition: all 0.15s ease !important;
}
.location-tag-badge:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #ef4444 !important;
  border-color: #ef4444 !important;
}

/* Guaranteed dimensions for Leaflet GTAV containers */
#leafletMapContainer {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 520px;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #0b0f19 !important;
}
#hoverMapContainer {
  width: 100%;
  height: 100%;
  min-height: 190px;
  border-radius: 6px;
  background: #0b0f19 !important;
}



/* Green Payment Delivery Badge */
.payment-tag-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.4);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-family: monospace;
  display: inline-block;
  margin-right: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.payment-tag-badge:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

/* Bold Teal Image Links (Ultra-High Specificity & Visited Override) */
a.comment-img-link,
a.comment-img-link:link,
a.comment-img-link:visited,
td a.comment-img-link,
td a.comment-img-link:visited {
  color: #22d3ee !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  display: inline-block;
  padding: 1px 4px;
  background: rgba(34, 211, 238, 0.12) !important;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 238, 0.35) !important;
  transition: all 0.2s ease;
}

a.comment-img-link:hover,
td a.comment-img-link:hover {
  color: #67e8f9 !important;
  background: rgba(34, 211, 238, 0.25) !important;
  border-color: #67e8f9 !important;
  text-decoration: underline !important;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.4) !important;
}
