/**
 * Marvel Universe Map - Styling
 * Full-screen interactive network visualization with sidebar controls
 */

/* Root Variables */
:root {
  --primary-bg: #ffffff;
  --secondary-bg: #f5f5f5;
  --text-primary: #333333;
  --text-secondary: #666666;
  --border-color: #ddd;
  --accent-color: #b71c1c;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #444;
    --accent-color: #ff6b6b;
  }
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--primary-bg);
  color: var(--text-primary);
  overflow: hidden;
}

/* Main Container */
.map-container {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--primary-bg);
}

/* Left Panel: Network */
.map-panel-left {
  flex: 1;
  position: relative;
  background: var(--secondary-bg);
  border-right: 1px solid var(--border-color);
  min-width: 0;
}

#network-container {
  width: 100%;
  height: 100%;
  background: var(--secondary-bg);
}

/* Map Controls */
.map-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  flex-direction: column;
  z-index: 100;
}

.map-controls button {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--primary-bg);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.map-controls button:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: scale(1.05);
}

.map-controls button:active {
  transform: scale(0.95);
}

/* Right Panel: Sidebar */
.map-panel-right {
  width: 300px;
  background: var(--primary-bg);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Sidebar Sections */
.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section h2 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.sidebar-section h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.sidebar-section p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.sidebar-section ul {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.sidebar-section li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Sections Visibility */
.controls-section {
  flex-shrink: 0;
}

.welcome-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.details-section {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

/* Search Box */
.map-search-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.search-box {
  position: relative;
  margin-bottom: 15px;
}

.search-box input {
  width: 100%;
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--secondary-bg);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(183, 28, 28, 0.1);
}

.search-box input::placeholder {
  color: var(--text-secondary);
}

#search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  transition: color 0.2s ease;
}

#search-clear:hover {
  color: var(--accent-color);
}

/* Filter Groups */
.filter-group {
  margin-bottom: 15px;
}

.filter-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.checkbox-group,
.phase-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.checkbox-label:hover {
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-color);
}

.color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Statistics */
.statistics {
  margin-top: 15px;
  padding: 12px;
  background: var(--secondary-bg);
  border-radius: 4px;
  font-size: 0.9rem;
}

.statistics h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

#stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#stats-container p {
  margin: 0;
  padding: 6px;
  background: var(--primary-bg);
  border-radius: 3px;
  text-align: center;
  font-weight: 500;
  color: var(--text-primary);
}

/* Node Details */
#node-details {
  margin-bottom: 20px;
}

.node-header {
  margin-bottom: 15px;
}

.node-title {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.node-type {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--secondary-bg);
  color: var(--text-secondary);
  margin-right: 8px;
  margin-top: 8px;
}

.node-description {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 10px;
  font-size: 0.95rem;
}

.node-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.85rem;
}

.meta-item {
  padding: 6px;
  background: var(--secondary-bg);
  border-radius: 3px;
}

.meta-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* Connections List */
#connections-list {
  margin-top: 15px;
}

.connections-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.connection-item {
  padding: 10px;
  margin-bottom: 8px;
  background: var(--secondary-bg);
  border-left: 3px solid var(--accent-color);
  border-radius: 3px;
  font-size: 0.9rem;
}

.connection-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.connection-node {
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.connection-node:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Close Button */
.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.close-button:hover {
  color: var(--accent-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .map-panel-right {
    width: 280px;
  }

  #stats-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .map-container {
    flex-direction: column;
  }

  .map-panel-left {
    height: 50%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .map-panel-right {
    width: 100%;
    height: 50%;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }

  .map-controls {
    bottom: 10px;
    right: 10px;
    flex-direction: row;
  }

  .sidebar-section {
    padding: 15px;
  }

  .sidebar-section h2 {
    font-size: 1.2rem;
  }
}

@media (max-width: 600px) {
  .map-panel-right {
    height: 40%;
  }

  .map-panel-left {
    height: 60%;
  }

  .map-controls button {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .sidebar-section {
    padding: 12px;
  }

  #stats-container {
    grid-template-columns: 1fr;
  }

  .checkbox-group,
  .phase-slider {
    gap: 4px;
  }

  .checkbox-label {
    font-size: 0.85rem;
    gap: 6px;
  }

  .node-meta {
    grid-template-columns: 1fr;
  }
}

/* Vis.js Overrides */
.vis-network {
  border: none;
}

.vis-network-tooltip {
  background: rgba(0, 0, 0, 0.8);
  border: none;
  border-radius: 4px;
  color: white;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.vis-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

@media (prefers-color-scheme: dark) {
  .vis-label {
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
  }
}

/* Scrollbar Styling */
.map-panel-right::-webkit-scrollbar {
  width: 8px;
}

.map-panel-right::-webkit-scrollbar-track {
  background: transparent;
}

.map-panel-right::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.map-panel-right::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Loading and Error States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
}

.error-message {
  padding: 15px;
  background: #ffebee;
  color: #c62828;
  border-radius: 4px;
  margin: 10px 0;
  border-left: 4px solid #c62828;
}

@media (prefers-color-scheme: dark) {
  .error-message {
    background: #3e2723;
    color: #ff6b6b;
    border-left-color: #ff6b6b;
  }
}
