/* ================================
   SIDEBAR STYLES
   ================================
   Styles for the left sidebar and its components
   ================================ */

@import url("color_palette.css");

/* ================================
   SIDEBAR ICONS AND TEXT
   ================================ */
.sidebar-icon {
  font-size: var(--font-size-md);
}

.sidebar-text {
  margin-top: 4px;
}

.sidebar-divider {
  width: 80%;
  margin: 10px auto;
  border-top: 1px solid var(--color-gray-600);
}

/* ================================
   ANIMATIONS
   ================================ */

/* Flash glow animation for changes */
@keyframes flashGlow {
  0% {
    box-shadow: 0 0 0px transparent;
  }
  50% {
    box-shadow: 0 0 10px 2px var(--gold-glow);
  }
  100% {
    box-shadow: 0 0 0px transparent;
  }
}

.flash-highlight {
  animation: flashGlow 1.5s ease-out infinite;
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================
   DRAG AND DROP STYLES
   ================================ */

/* Drag and drop styles for polygon panels */
.selected-item-display {
  transition: all 0.3s ease;
}

.selected-item-display.drag-over {
  border: 2px dashed var(--color-accent-orange) !important;
  background-color: rgba(204, 102, 0, 0.05) !important;
  transform: scale(1.02);
}

/* Drag over effects */
.drag-over {
  background-color: rgba(204, 102, 0, 0.05) !important;
  border: 2px dashed var(--color-accent-orange) !important;
}

/* Draggable polygon items */
.polygon-item[draggable="true"] {
  cursor: move;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.polygon-item[draggable="true"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--overlay-dark-10);
}

.polygon-item.dragging {
  opacity: 0.5;
}

/* Selected polygon display drag effects */
.selected-item-display {
  transition:
    background-color 0.3s,
    border-color 0.3s;
}

/* Common base class for selectable list items (polygons, data types, etc.) */
.selectable-list-item {
  padding: 8px;
  margin: 4px 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    background 0.2s,
    border 0.2s;
}

.selectable-list-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #fafbfc, #ffffff);
}

.selectable-list-item.selected {
  background: rgba(204, 102, 0, 0.1);
  border: 2px solid var(--color-accent-orange);
  box-shadow: 0 2px 4px rgba(204, 102, 0, 0.2);
}

.selectable-list-item.selected:hover {
  background: rgba(204, 102, 0, 0.15);
  box-shadow: 0 4px 8px rgba(204, 102, 0, 0.3);
}

/* Data type multiselect items - extends selectable-list-item, no overrides needed */
.data-type-item {
  /* Uses all base styling from .selectable-list-item */
}

/* Polygon items - extends selectable-list-item */
.polygon-list-item {
  position: relative;
}

/* Item info structure - used in both polygons and data types */
.item-info {
  flex: 1;
  min-width: 0;
}

.item-info-primary {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.item-info-secondary {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.3;
}

/* Metadata line styling for multi-line info display */
.metadata-line {
  margin-bottom: 1px;
}

/* A source row's second line: its type, upload or file count, in muted grey */
.metadata-line.source-label-detail {
  font-style: italic;
}
/* The id form outranks the querying panel's own "#querying-panel ... span" colour. */
.metadata-line.source-label-detail .metadata-value,
#querying-panel .metadata-line.source-label-detail .metadata-value {
  color: var(--color-gray-400) !important;
}

.metadata-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.metadata-value {
  font-weight: 400;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

/* ================================
   DISABLED STATE
   ================================ */

/* Disabled selectable items - greyed out with tooltip on click */
.selectable-list-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f8f8f8 !important;
  border-color: #d5d5d5 !important;
  pointer-events: auto; /* Allow clicks to show tooltip */
}

.selectable-list-item.disabled:hover {
  transform: none !important; /* Disable hover animation */
  box-shadow: none !important;
  background: #f8f8f8 !important;
}

.selectable-list-item.disabled .item-info-primary {
  color: #999 !important;
}

.selectable-list-item.disabled .metadata-value,
.selectable-list-item.disabled .metadata-label {
  color: #aaa !important;
}

/* Disabled item tooltip */
.disabled-item-tooltip {
  position: fixed;
  background: rgba(30, 30, 30, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: var(--font-size-sm);
  z-index: 10001;
  max-width: 250px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  animation: fadeIn 0.2s ease;
}

/* ================================
   ITEM CONTENT CONTAINER
   ================================ */

/* Container for thumbnail + info in selectable items */
.item-content-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Thumbnail styling for items */
.item-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 1px solid #ddd;
  border-radius: 4px;
  flex-shrink: 0;
}

.selectable-list-item.disabled .item-thumbnail {
  opacity: 0.4;
  filter: grayscale(100%);
}

/* ================================
   PATTERN OF LIFE BADGES
   ================================ */

/* Drawer list rows (Pattern of Life, Watch) — override .selectable-list-item base */
.pol-location-item.selectable-list-item,
.watch-item.selectable-list-item {
  display: block !important;
  padding: 4px 8px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  border-bottom: 1px solid var(--border-light) !important;
  font-family: var(--gd-font-mono) !important;
  font-size: var(--font-size-xs) !important;
  line-height: 1.4 !important;
}

.pol-location-item.selectable-list-item:hover,
.watch-item.selectable-list-item:hover {
  transform: none !important;
  box-shadow: none !important;
  background: var(--bg-secondary) !important;
}

.pol-location-item .pol-row-header,
.watch-item .pol-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pol-location-item .pol-row-coord {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-xs) !important;
}
.pol-location-item .pol-row-meta,
.watch-item .pol-row-meta {
  color: var(--text-secondary);
  margin-top: 1px;
  font-size: var(--font-size-xs) !important;
}
.pol-location-item .pol-row-desc,
.watch-item .pol-row-desc {
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.3;
  font-size: var(--font-size-xs) !important;
  cursor: pointer;
}
.pol-location-item .pol-row-desc.pol-row-desc-collapsed,
.watch-item .pol-row-desc.pol-row-desc-collapsed {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Per-location activity charts, revealed on demand. Same four charts as the
   entity-level Activity tab, scoped to one hex cluster. */
.pol-location-item .pol-charts-toggle {
  display: block;
  margin-top: 4px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--font-size-xs) !important;
  text-decoration: underline;
  cursor: pointer;
}
.pol-location-item .pol-charts-toggle:hover {
  color: var(--color-accent-orange, #ffc966);
}
.pol-location-item .pol-row-charts {
  margin-top: 8px;
  padding: 8px 4px;
  border-top: 1px solid var(--border-medium);
}
.pol-location-item .pol-chart-block {
  margin-bottom: 36px;
}
.pol-location-item .pol-chart-block:last-child {
  margin-bottom: 8px;
}
/* Observations the analysis clock could not place, under the time legend. */
.pol-untimed-note {
  padding: 4px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
/* A location may be both a day and a night loiter, so the header can carry more
   than one badge. Grouping them keeps the header a two-child flex row. */
.pol-location-item .pol-row-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pol-location-item .pol-badge {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 2px;
  font-family: var(--gd-font-mono);
  font-size: var(--font-size-xs) !important;
  font-weight: 600;
  white-space: nowrap;
}

/* Colour encodes the classification itself: night is always purple, day always
   gold, independent of how many badges a location carries. */
.pol-badge-night {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
  border: 1px solid #9b59b6;
}
.pol-badge-day {
  background: rgba(255, 201, 102, 0.15);
  color: #ffc966;
  border: 1px solid #ffc966;
}
.pol-badge-default {
  background: rgba(149, 165, 166, 0.15);
  color: #7f8c8d;
}

/* Pattern of life hex item specific styles */
.pol-hex-item {
  transition:
    background var(--transition-fast),
    border-left 0.2s;
}

.pol-hex-item:hover {
  background: var(--bg-secondary) !important;
  border-left: 3px solid var(--color-accent-orange) !important;
}

/* ================================
   NETWORK ENTITY CONTAINER
   ================================ */

/* Container for network entity selectable items */
.network-entity-container {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  background: var(--bg-primary);
  padding: 4px;
}

/* Network entity items - compact variant */
.network-entity-item {
  /* Inherits from .selectable-list-item */
  padding: 6px 8px !important;
  margin: 2px 0 !important;
  font-size: var(--font-size-xs) !important;
}

.network-entity-item .item-info-primary {
  font-size: var(--font-size-xs) !important;
  font-weight: 500 !important;
}

.network-entity-item .item-info-secondary {
  font-size: var(--font-size-2xs) !important;
}
