/* Outpost Compound — Build Menu & Placement UI */

.outpost-build-menu {
  position: fixed;
  top: 80px;
  right: 16px;
  width: 240px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: rgba(30, 32, 38, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px;
  z-index: 1100;
  color: #e0e0e0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.outpost-build-menu.hidden {
  display: none;
}

.outpost-build-menu h4 {
  margin: 0 0 10px 0;
  font-size: 0.95em;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.outpost-build-menu .structure-count {
  font-size: 0.85em;
  color: #8ba4b8;
  font-weight: normal;
}

.structure-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.structure-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  color: #e0e0e0;
  cursor: pointer;
  text-align: left;
  font-size: 0.85em;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
}

.structure-option-btn:hover:not(.disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(74, 222, 128, 0.4);
}

.structure-option-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.structure-option-btn .structure-icon {
  font-size: 1.3em;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.structure-option-btn .structure-name {
  text-transform: capitalize;
  font-weight: 500;
  flex: 1;
}

.structure-option-btn .structure-cost {
  font-size: 0.75em;
  color: #8ba4b8;
  text-align: right;
}

.structure-category-header {
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8ba4b8;
  padding: 6px 2px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-top: 4px;
}

.structure-category-header:first-child {
  margin-top: 0;
}

.structure-level-req {
  color: #e67e22;
  font-weight: 600;
  font-size: 0.8em;
}

.outpost-build-menu .btn-small {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #ccc;
  cursor: pointer;
  font-size: 0.85em;
  min-height: 44px;
  transition: background 0.15s;
}

.outpost-build-menu .btn-small:hover {
  background: rgba(255,255,255,0.15);
}

/* Foreman section in build menu */
.foreman-section {
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 8px;
}

.foreman-section h5 {
  margin: 0 0 8px 0;
  font-size: 0.85em;
  color: #4ade80;
  font-weight: 600;
}

.foreman-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.foreman-name {
  font-weight: 500;
  color: #e0e0e0;
  font-size: 0.9em;
}

.foreman-skill {
  font-size: 0.8em;
  color: #8ba4b8;
}

.foreman-bonus {
  font-size: 0.85em;
  color: #4ade80;
  font-weight: 600;
}

.foreman-section .btn-small {
  margin-top: 4px;
}

/* Foreman picker modal */
.foreman-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.foreman-picker-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
}

.foreman-picker-entry .expert-pick-info {
  flex: 1;
  min-width: 0;
}

.foreman-picker-entry .expert-pick-name {
  font-weight: 500;
  color: #e0e0e0;
  font-size: 0.9em;
}

.foreman-picker-entry .expert-pick-skill {
  font-size: 0.78em;
  color: #8ba4b8;
}

.foreman-picker-entry .btn-small {
  flex-shrink: 0;
  min-height: 36px;
}

/* SVG structure styles */
.compound-structure {
  transition: opacity 0.2s;
}

.compound-structure:hover rect {
  stroke-width: 0.4;
}

.compound-structure.under-construction {
  animation: constructionPulse 2s ease-in-out infinite;
}

@keyframes constructionPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Placement ghost */
.compound-placement-ghost {
  pointer-events: none;
}

/* Chevron indicator (visible on mobile only) */
.build-menu-chevron {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .outpost-build-menu {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 45vh;
    border-radius: 14px 14px 0 0;
    padding: 16px 16px 24px;
    transition: max-height 0.25s ease;
  }

  .outpost-build-menu h4 {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .build-menu-chevron {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.7em;
  }

  .build-menu-chevron::after {
    content: '▼';
  }

  .outpost-build-menu.collapsed .build-menu-chevron::after {
    content: '▲';
  }

  /* Collapsed state: only show the header as a thin bar */
  .outpost-build-menu.collapsed {
    max-height: none;
    overflow: visible;
    padding: 10px 16px;
  }

  .outpost-build-menu.collapsed .build-menu-body,
  .outpost-build-menu.collapsed .btn-small {
    display: none;
  }

  /* Push structure info modal to top of screen, above collapsed build menu */
  .modal.struct-info-modal {
    align-items: flex-start !important;
    padding-top: 60px;
  }

  .modal.struct-info-modal .modal-content {
    max-height: 70vh;
  }

  .structure-options {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .structure-option-btn {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    flex-direction: column;
    text-align: center;
    gap: 4px;
    padding: 8px 6px;
  }

  .structure-option-btn .structure-cost {
    text-align: center;
  }
}
