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

:root {
  --bg-primary: #0a0b0d;
  --bg-secondary: #111215;
  --bg-tertiary: #18191d;
  --bg-hover: #22242a;
  
  --border-color: #24262b;
  --border-focus: #3d424d;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  /* Accent Colors */
  --accent-purple: #a855f7;
  --accent-purple-glow: rgba(168, 85, 247, 0.15);
  --accent-blue: #0ea5e9;
  --accent-blue-glow: rgba(14, 165, 233, 0.25);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.15);
  --accent-orange: #f97316;
  --accent-orange-glow: rgba(249, 115, 22, 0.25);
  
  --font-family: 'Outfit', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 12px;
  --border-radius-md: 8px;
  --border-radius-sm: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding: 24px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- LOGIN OVERLAY STYLES --- */
#login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 35px;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  width: 360px;
  text-align: center;
  box-sizing: border-box;
}

.login-logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
}

.login-card h2 {
  margin: 0 0 20px 0;
  color: var(--text-main);
  font-size: 1.4rem;
  font-weight: 600;
}

.input-group {
  margin-bottom: 15px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: var(--font-family);
  outline: none;
  box-sizing: border-box;
  transition: var(--transition-smooth);
}

.input-group input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 8px var(--accent-purple-glow);
}

.btn-login {
  display: block !important;
  visibility: visible !important;
  width: 100% !important;
  padding: 14px !important;
  background: linear-gradient(135deg, #d82e87 0%, #682c92 100%) !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 1rem !important;
  font-weight: bold !important;
  cursor: pointer !important;
  margin-top: 15px !important;
  box-shadow: 0 4px 10px rgba(104, 44, 146, 0.2);
  font-family: var(--font-family);
  transition: opacity 0.2s;
}

.btn-login:hover {
  opacity: 0.9;
}

#login-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
  font-weight: 500;
}

/* --- MAIN PROTECTED CONTENT CONTAINER --- */
#main-content {
  display: none; /* Hidden until validation */
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

/* --- FLOATING DOWNLOAD SYSTEMS BUTTON --- */

.top-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 10px;
  z-index: 1000;
}

.btn-download-top {
  position: relative;
  display: inline-block;
  padding: 12px 20px;
  background: linear-gradient(135deg, #d82e87 0%, #682c92 100%);
  color: white !important;
  text-decoration: none !important;
  font-weight: bold;
  font-size: 0.9rem;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(104, 44, 146, 0.25);
  transition: transform 0.2s, opacity 0.2s;
  font-family: var(--font-family);
}

.btn-download-top:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Scrollable List utility inside cards */
.scrollable-list {
  max-height: 172px;
  overflow-y: auto;
  padding-right: 6px;
}

.scrollable-list::-webkit-scrollbar {
  width: 4px;
}

.scrollable-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 2px;
}

.scrollable-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.scrollable-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-dark);
}

/* Header & Navigation */
header {
  max-width: 1400px;
  margin: 0 auto 30px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-right: 200px; /* Leave space for floating download button */
}

/* Toggle Switch Styled like Microsoft 365 Admin */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: white;
}

.toggle-label {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.brand-logo.large {
  justify-content: center;
  margin-bottom: 8px;
}

.brand-logo .brand-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-main);
}

.main-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

/* Collapsible Title section */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
  width: fit-content;
  transition: var(--transition-smooth);
}

.section-header:hover {
  color: var(--accent-blue);
}

.section-header svg {
  transition: transform 0.3s;
}

.section-header.collapsed svg {
  transform: rotate(-90deg);
}

/* Dashboard Grid */
.dashboard-grid {
  max-width: 1400px;
  margin: 0 auto 32px auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  transition: var(--transition-smooth);
}

.dashboard-grid.collapsed {
  display: none;
}

/* Card Styling */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: 0 10px 25px -10px rgba(0,0,0,0.5);
}

/* Accent top border highlight depending on status/role */
.card.sql { border-top: 3px solid var(--accent-purple); }
.card.conn { border-top: 3px solid var(--accent-blue); }
.card.servers { border-top: 3px solid var(--accent-green); }
.card.systems { border-top: 3px solid var(--accent-orange); }

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.metric-highlight {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.metric-unit {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Card internal content structures */
.card-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 16px;
}

/* Progress bar lists */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.progress-label {
  color: var(--text-main);
}

.progress-value {
  color: var(--text-muted);
}

.progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.purple { background-color: var(--accent-purple); }
.progress-fill.blue { background-color: var(--accent-blue); }
.progress-fill.green { background-color: var(--accent-green); }
.progress-fill.orange { background-color: var(--accent-orange); }

/* Quick Status List (Microservices) */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  font-size: 13px;
  transition: var(--transition-smooth);
}

.status-item:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-hover);
}

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

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-indicator.green {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-indicator.orange {
  background-color: var(--accent-orange);
  box-shadow: 0 0 8px var(--accent-orange);
}

.status-indicator.red {
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.status-name {
  font-weight: 500;
  color: var(--text-main);
}

.status-right {
  font-size: 12px;
  color: var(--text-muted);
}

/* Card buttons */
.card-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
}

.btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: center;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn.primary {
  background-color: var(--bg-tertiary);
  border-color: var(--border-focus);
}

.btn.primary:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
}

/* Chart block container */
.chart-container {
  flex-grow: 1;
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================= */
/* MAP TOPOLOGY SECTION (OFILAB CONNECTIONS) */
/* ========================================= */
.mapping-section {
  max-width: 1400px;
  margin: 0 auto 32px auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.mapping-section.collapsed {
  display: none;
}

.mapping-title-block {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  z-index: 3;
}

.mapping-main-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 1px;
}

.mapping-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Connection SVG lines absolute placement */
.svg-container-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.connection-svg {
  width: 100%;
  height: 100%;
}

/* Connection line path design */
.connection-line {
  fill: none;
  stroke: var(--accent-purple);
  stroke-width: 2;
  stroke-dasharray: 8 5;
  animation: flowing-dash 25s linear infinite;
  opacity: 0.12;
  transition: opacity 0.4s, stroke 0.4s, stroke-width 0.4s;
}

.connection-line.active {
  opacity: 0.85;
  stroke: var(--accent-blue);
  stroke-width: 3.5;
  filter: drop-shadow(0 0 5px var(--accent-blue-glow));
}

@keyframes flowing-dash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Rows containers */
.map-row {
  position: relative;
  margin-bottom: 24px;
  z-index: 2;
}

.map-row:last-child {
  margin-bottom: 0;
}

.map-row-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.map-nodes-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
}

.map-nodes-container.centered {
  margin-bottom: 0;
}

/* Node layout (clickable box) */
.map-node {
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 12px 20px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  justify-content: flex-start;
  transition: all 0.25s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.map-node:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

/* Color left side borders matching user specifications */
.map-node.system {
  border-left: 5px solid #3498db;
}

.map-node.database {
  border-left: 5px solid #e67e22;
}

.map-node.isolated {
  border-left: 5px solid #95a5a6;
}

.map-node .node-icon {
  font-size: 14px;
}

.map-node .node-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

/* Node active illumination override as per user source code */
.map-node.active-selected {
  background-color: #2ecc71 !important;
  color: white !important;
  border-color: #27ae60 !important;
  border-left-color: #27ae60 !important;
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(46, 204, 113, 0.3) !important;
}

.map-node.active-selected .node-text {
  color: white !important;
}

.map-node.active-relation {
  background-color: #d1f2eb !important;
  border-color: #1abc9c !important;
  border-left-color: #1abc9c !important;
  transform: scale(1.02);
}

.map-node.active-relation .node-text {
  color: #16a085 !important;
}

.map-node.active-relation .node-icon {
  color: #16a085 !important;
}

/* Fade out other elements when focused (dimmed class as per user stylesheet) */
.map-node.dimmed {
  opacity: 0.15;
  transform: scale(0.98);
  pointer-events: none;
}

.mapping-section.focused-state .connection-line:not(.active) {
  opacity: 0.02;
}


/* ========================================= */
/* MAIN ACTIONS & FILTER PILLS */
/* ========================================= */
.main-actions-section {
  max-width: 1400px;
  margin: 0 auto 24px auto;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
}

.pills-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.pill-btn:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-tertiary);
}

.pill-btn.active {
  background-color: var(--bg-hover);
  border-color: var(--accent-blue);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.15);
}

/* Details Table & Logs Section */
.details-section {
  max-width: 1400px;
  margin: 0 auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
}

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

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

.filter-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
  font-size: 12px;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
}

.filter-select:focus {
  border-color: var(--border-focus);
}

.table-container {
  width: 100%;
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.logs-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logs-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.logs-table tr {
  transition: var(--transition-smooth);
}

.logs-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

/* Badge components inside logs */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge.success {
  background-color: var(--accent-green-glow);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.warning {
  background-color: var(--accent-orange-glow);
  color: var(--accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge.danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.info {
  background-color: var(--accent-blue-glow);
  color: var(--accent-blue);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.timestamp {
  color: var(--text-dark);
  font-family: monospace;
}

/* Live blinking dot in header */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.blinker {
  width: 6px;
  height: 6px;
  background-color: var(--accent-green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 8px var(--accent-green);
  }
  100% {
    transform: scale(0.9);
    opacity: 0.5;
  }
}

/* Details Panel Grid filters mapping classes */
.card-hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    padding: 16px;
  }
  
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    padding-right: 0;
  }
  
.top-actions {
  position: relative;
  top: 0;
  right: 0;
  flex-direction: column;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 10px;
}

.btn-download-top {
  position: relative;
  text-align: center;
  width: 100%;
}


  .details-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
