/**
 * css/civil_networks.css
 * Dedicated Styling for VRD Networks: Trenches (Tranchées) & Drainage / Caniveaux
 * Advancement Monitoring Tool, Measurement Inspector & Visual Overlays
 */

/* Toolbar Buttons & Status Indicators */
.btn-civil-trench {
  border-color: rgba(245, 158, 11, 0.45) !important;
  color: #fbbf24 !important;
}

.btn-civil-trench.active {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.btn-civil-inverter {
  border-color: rgba(234, 179, 8, 0.45) !important;
  color: #fde047 !important;
}

.btn-civil-inverter.active {
  background: rgba(234, 179, 8, 0.25) !important;
  border-color: #eab308 !important;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.35);
}

.btn-civil-pv {
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #38bdf8 !important;
}

.btn-civil-pv.active {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.btn-civil-advancement {
  background: linear-gradient(135deg, #0284c7, #8b5cf6) !important;
  border-color: #a855f7 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-civil-advancement:hover {
  background: linear-gradient(135deg, #0369a1, #7c3aed) !important;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

/* Sidebar Section for VRD */
.sidebar-vrd-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
  margin-top: 10px;
}

.vrd-subgroup {
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  margin-bottom: 8px;
  font-size: 11px;
}

.vrd-sub-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  cursor: pointer;
}

.vrd-sub-item:hover {
  color: var(--text-main);
}

.vrd-color-bar {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  display: inline-block;
}

/* Modal Overlay for Advancement Tool */
.civil-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.civil-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.civil-modal-container {
  width: 94vw;
  max-width: 1300px;
  max-height: 90vh;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.25s ease-out;
}

@keyframes modalSlideUp {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.civil-modal-header {
  padding: 16px 20px;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.civil-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.civil-modal-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.civil-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.civil-modal-close:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.3);
}

/* KPI Banner in Modal */
.civil-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.civil-kpi-card {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.civil-kpi-card.kpi-trenches {
  border-left: 3px solid #f59e0b;
}

.civil-kpi-card.kpi-drainage {
  border-left: 3px solid #06b6d4;
}

.civil-kpi-card.kpi-volume {
  border-left: 3px solid #8b5cf6;
}

.civil-kpi-card.kpi-global {
  border-left: 3px solid #10b981;
}

.civil-kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.civil-kpi-val {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono);
}

.civil-kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
}

/* Progress bar inside KPI */
.civil-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.civil-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Filter Controls Bar */
.civil-filter-bar {
  padding: 10px 20px;
  background: rgba(20, 30, 48, 0.7);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.civil-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.civil-filter-label {
  color: var(--text-muted);
}

.civil-select {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.civil-search-input {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  min-width: 180px;
}

/* Modal Content: Table */
.civil-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.civil-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.civil-data-table th {
  background: #1e293b;
  color: #38bdf8;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.civil-data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

.civil-data-table tr:hover {
  background: rgba(56, 189, 248, 0.08);
}

/* Status Badges */
.badge-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}

.badge-remblaye {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-pose {
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.badge-fouille {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-noncommence {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.4);
}

/* Modal Footer Actions */
.civil-modal-footer {
  padding: 12px 20px;
  background: rgba(30, 41, 59, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* On-Map Floating Inspector Tooltip for Hovered Network Line */
#civil-network-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  border-radius: 6px;
  padding: 8px 12px;
  color: #f8fafc;
  font-size: 11px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  transform: translate(12px, -50%);
}

#civil-network-tooltip .tt-title {
  font-weight: 700;
  color: #38bdf8;
  font-size: 12px;
  margin-bottom: 4px;
}

#civil-network-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

#civil-network-tooltip .tt-lbl {
  color: var(--text-muted);
}

#civil-network-tooltip .tt-val {
  font-family: var(--font-mono);
  font-weight: 600;
}
