/* Entity Graph View Styles */
/* Copyright (c) Microsoft Corporation. Licensed under the MIT License. */

/* CSS Variables */
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #f8f9ff;
  --border-color: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --dark-color: #343a40;
  --light-color: #f8f9fa;
  --nav-height: 70px;
  --sidebar-width: 320px;
  --panel-width: 350px;
  --border-radius: 0.5rem;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Base Layout */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--light-color);
  overflow: hidden;
}

#entity-graph-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Navigation Bar */
.entity-nav {
  height: var(--nav-height);
  background: white;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 100;
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 20px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.breadcrumb-link {
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.breadcrumb-current {
  color: var(--dark-color);
  font-weight: 500;
}

.breadcrumb-entity {
  color: var(--text-secondary);
}

.back-to-global-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-left: 12px;
}

.back-to-global-btn:hover {
  background: var(--secondary-color);
}

/* Entity Search */
.entity-search {
  position: relative;
  max-width: 300px;
}

.search-input-group {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.entity-search-input {
  flex: 1;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.entity-search-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* View Controls */
.view-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.layout-controls .btn-group {
  display: flex;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.layout-btn {
  border-radius: 0 !important;
}

/* Main Content Area */
.entity-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Entity Sidebar */
.entity-sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.entity-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.entity-header .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.7;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 5px;
}

.entity-header .btn-close:hover {
  opacity: 1;
}

.entity-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
}

.entity-info h1 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
}

.entity-type-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}

.entity-confidence {
  font-size: 14px;
  opacity: 0.9;
}

/* Entity Overview */
.entity-overview {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.entity-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
  padding: 15px;
  background: var(--accent-color);
  border-radius: var(--border-radius);
}

.metric-item {
  text-align: center;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-color);
}

.entity-details,
.entity-timeline,
.related-entities {
  margin-bottom: 25px;
}

.entity-details h3,
.entity-timeline h3,
.related-entities h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 15px 0;
  color: var(--dark-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.detail-section {
  margin-bottom: 15px;
}

.detail-section strong {
  color: var(--dark-color);
  font-size: 14px;
}

.aliases-list,
.domains-list,
.topics-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alias-tag,
.domain-tag,
.topic-tag {
  background: var(--light-color);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

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

.timeline-value {
  font-weight: 500;
  color: var(--dark-color);
}

/* Related Entities */
.entity-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.related-entities-list {
  max-height: 300px;
  overflow-y: auto;
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 20px;
}

/* Graph Main Area */
.graph-main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  background: white;
}

.cytoscape-container {
  flex: 1;
  background: white;
  position: relative;
}

/* Graph Controls */
.graph-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: white;
  border-radius: 8px;
  padding: 8px;
  box-shadow: var(--shadow);
}

.control-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: white;
  color: var(--dark-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
}

.control-btn:hover {
  background: var(--primary-color);
  color: white;
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Graph Info Panel */
.graph-info-panel {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 20px;
  font-size: 14px;
  z-index: 100;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.info-value {
  font-weight: 600;
  color: var(--dark-color);
}

/* Loading and Empty States */
.graph-loading,
.graph-empty {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  z-index: 50;
}

.loading-content,
.empty-content {
  text-align: center;
  color: var(--text-muted);
}

.loading-text {
  margin-top: 10px;
  font-size: 14px;
}

.empty-content i {
  font-size: 48px;
  margin-bottom: 15px;
  color: var(--text-muted);
}

.empty-content h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: var(--dark-color);
}

.empty-content p {
  margin: 0 0 15px 0;
  color: var(--text-secondary);
}

/* Content Panel */
.content-panel {
  width: var(--panel-width);
  background: white;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
}

.content-panel.show {
  transform: translateX(0);
}

.panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--light-color);
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-color);
}

.entity-content-view {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.content-section {
  margin-bottom: 25px;
}

.content-section h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 15px 0;
  color: var(--dark-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 280px;
    --panel-width: 320px;
  }
}

@media (max-width: 992px) {
  .mock-mode-indicator {
    display: none !important;
  }

  #entity-graph-container {
    height: auto !important;
  }

  .entity-content {
    flex-direction: column !important;
  }

  .entity-sidebar,
  .content-panel {
    width: 100% !important;
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
  }

  .nav-content {
    flex-wrap: wrap;
    gap: 10px;
  }

  .entity-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 80px;
  }

  .nav-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 0;
  }

  .breadcrumbs {
    order: 1;
  }

  .view-controls {
    order: 2;
    justify-content: space-between;
  }

  .entity-search {
    order: 3;
    max-width: none;
  }

  .graph-controls {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 20px;
  }

  .graph-info-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 80px;
  }
}
