/*
    EVE Target Intel - Tree Layout Styles

    Copyright (C) 2025 moregh (https://github.com/moregh/)
    Licensed under AGPL License.
*/

.unified-header {
  background: var(--background-card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1rem 1.7rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.header-left h1 {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin: 0;
}

.header-center {
  display: flex;
  justify-content: center;
  flex: 1 1 auto;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.stats-inline {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  .unified-header {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .header-left,
  .header-center,
  .header-right {
    justify-content: center;
  }

  .header-center {
    order: 2;
  }

  .header-right {
    order: 3;
  }

  .stats-inline {
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .stats-inline {
    gap: 0.75rem;
  }

  .stat-item {
    font-size: 0.85rem;
  }
}

.main-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
  min-height: 600px;
}

.tree-panel {
  background: var(--background-card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  max-height: calc(100vh - 250px);
}

.tree-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.tree-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.tree-controls {
  display: flex;
  gap: 0.5rem;
}

.tree-btn {
  background: var(--white-05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.tree-btn:hover {
  background: var(--white-08);
  border-color: var(--primary-color);
}

.tree-node {
  margin-bottom: 0.25rem;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-medium);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tree-item:hover {
  background: var(--white-05);
}

.tree-item.selected {
  background: rgba(0, 212, 255, 0.15);
  border-left: 3px solid var(--primary-color);
}

.tree-item.war-eligible {
  border-right: 3px solid var(--war-color);
}

.tree-toggle {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.tree-toggle.expanded {
  transform: rotate(90deg);
}

.tree-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--white-05);
}

.tree-label {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-count {
  background: var(--white-2);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-medium);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.tree-children {
  margin-left: 1.5rem;
  border-left: 1px solid var(--white-1);
  padding-left: 0.5rem;
  display: none;
}

.tree-children.expanded {
  display: block;
}

.tree-item.alliance {
  font-weight: 600;
  border-left: 2px solid #3b82f6;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.05), transparent);
}

.tree-item.alliance .tree-label {
  color: #60a5fa;
}

.tree-item.alliance .tree-icon {
  border: 1px solid #3b82f6;
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.3);
}

.tree-item.corporation {
  border-left: 2px solid var(--primary-color);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.05), transparent);
}

.tree-item.corporation .tree-label {
  color: var(--primary-color);
}

.tree-item.corporation .tree-icon {
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 4px rgba(0, 212, 255, 0.3);
}

.tree-item.character {
  font-size: 0.8rem;
}

.detail-panel {
  background: var(--background-card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  max-height: calc(100vh - 250px);
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}

.detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-large);
  border: 2px solid var(--primary-color);
  object-fit: cover;
}

.detail-info {
  flex: 1;
}

.detail-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.detail-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  background: var(--white-05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-medium);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.detail-badge.war {
  background: rgba(255, 71, 87, 0.2);
  border-color: var(--war-color);
  color: var(--war-color);
  font-weight: 600;
}

.playstyle-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.tag {
  display: inline-flex;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-small);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tag-solo { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; }
.tag-fleet { background: linear-gradient(135deg, #3498db, #2980b9); color: white; }
.tag-capital { background: linear-gradient(135deg, #f1c40f, #f39c12); color: #1a1a1a; }
.tag-small-gang { background: linear-gradient(135deg, #f39c12, #e67e22); color: white; }
.tag-adaptable { background: linear-gradient(135deg, #9b59b6, #8e44ad); color: white; }
.tag-blops { background: linear-gradient(135deg, #2c003e, #1a1a1a); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.tag-cyno { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; border: 1px solid rgba(255, 255, 255, 0.2); }
.tag-active-now { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.tag-active { background: linear-gradient(135deg, #34d399, #10b981); color: white; }
.tag-hvt-hunter { background: linear-gradient(135deg, #dc2626, #991b1b); color: white; }
.tag-solo-hunter { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.tag-fleet-fighter { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; }
.tag-blob { background: linear-gradient(135deg, #6366f1, #4f46e5); color: white; }
.tag-gate-camper { background: linear-gradient(135deg, #ec4899, #db2777); color: white; }

.detail-section {
  margin-bottom: 1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  background: var(--white-03);
  border-radius: var(--radius-medium);
  border-left: 3px solid var(--primary-color);
}

.section-header:hover {
  background: var(--white-05);
}

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-toggle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

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

.section-content {
  padding: 0.75rem;
}

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

.tactical-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tactical-stat {
  background: var(--white-03);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-large);
  padding: 0.75rem 1rem;
  text-align: center;
  transition: all 0.3s ease;
  flex: 0 0 auto;
  min-width: 120px;
}

.tactical-stat:hover {
  transform: translateY(-2px);
  background: var(--white-05);
}

.tactical-stat.dangerous {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.1);
}

.tactical-stat.moderate {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(251, 191, 36, 0.1);
}

.tactical-stat.safe, .tactical-stat.high {
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(74, 222, 128, 0.1);
}

.tactical-icon {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.tactical-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.2rem;
}

.tactical-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stats-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--white-03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-large);
  padding: 0.75rem 1rem;
  text-align: center;
  transition: all 0.3s ease;
  border-top: 3px solid var(--primary-color);
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  min-width: 130px;
}

.stat-card:hover {
  transform: translateY(-2px);
  background: var(--white-05);
}

.stat-card.kills {
  border-top-color: var(--secondary-color);
}

.stat-card.losses {
  border-top-color: var(--danger-color);
}

.stat-card.efficiency {
  border-top-color: var(--warning-color);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.3rem;
}

.stat-value.kills-val {
  color: var(--secondary-color);
}

.stat-value.losses-val {
  color: var(--danger-color);
}

.stat-value.efficiency-val {
  color: var(--warning-color);
}

.stat-card-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--white-03);
  border-radius: var(--radius-medium);
  border-left: 2px solid var(--secondary-color);
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.info-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
}

.top10-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.top10-column {
  background: var(--white-03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-medium);
  padding: 0.75rem;
}

.top10-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.top10-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.top10-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: var(--white-02);
  border-radius: var(--radius-small);
  transition: all 0.2s ease;
  cursor: pointer;
}

.top10-item:hover {
  background: var(--white-05);
  transform: translateX(2px);
}

.top10-icon, .top10-portrait {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-small);
  object-fit: cover;
  background: var(--white-05);
  flex-shrink: 0;
}

.top10-portrait {
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.top10-info {
  flex: 1;
  min-width: 0;
}

.top10-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-value {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.sec-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sec-high { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.sec-low { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.sec-null { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.sec-wspace { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.chart-container {
  background: var(--white-03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-large);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.chart-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0.6;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.chart {
  width: 100%;
  height: 200px;
  background: var(--white-02);
  border-radius: var(--radius-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.threat-grid {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.risk-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  border-radius: var(--radius-large);
  background: var(--white-05);
  border: 2px solid var(--border-color);
  min-width: 100px;
}

.risk-indicator.high {
  border-color: rgba(248, 113, 113, 0.8);
  background: rgba(248, 113, 113, 0.15);
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

.risk-indicator.moderate {
  border-color: rgba(251, 191, 36, 0.8);
  background: rgba(251, 191, 36, 0.15);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.risk-icon {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.risk-level {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.threat-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.threat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: var(--white-03);
  border-radius: var(--radius-medium);
}

.threat-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.threat-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
}

.size-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.size-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.size-bar {
  flex: 1;
  height: 16px;
  background: var(--white-05);
  border-radius: var(--radius-small);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.size-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.size-fill.small { background: linear-gradient(90deg, #3498db, #2980b9); }
.size-fill.medium { background: linear-gradient(90deg, #9b59b6, #8e44ad); }
.size-fill.large { background: linear-gradient(90deg, #e67e22, #d35400); }
.size-fill.capital { background: linear-gradient(90deg, #e74c3c, #c0392b); }

.size-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 90px;
}

.size-category {
  font-size: 0.75rem;
  color: var(--text-primary);
  font-weight: 500;
}

.size-percent {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.kill-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kill-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--white-03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-medium);
  transition: all 0.2s ease;
  cursor: pointer;
}

.kill-item:hover {
  background: var(--white-05);
  border-color: rgba(0, 212, 255, 0.3);
  transform: translateX(4px);
}

.kill-ship {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.kill-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-small);
  background: var(--white-05);
}

.kill-ship-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.kill-value {
  font-size: 0.85rem;
  color: var(--primary-color);
  font-weight: 500;
}

.kill-meta {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.kill-link {
  padding: 0.5rem 1rem;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  color: white;
  text-decoration: none;
  border-radius: var(--radius-small);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.kill-link:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1rem;
}

.activity-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.activity-period {
  background: var(--white-03);
  border-radius: var(--radius-medium);
  padding: 0.75rem;
  text-align: center;
  border-left: 3px solid var(--primary-color);
  transition: all 0.2s ease;
}

.activity-period:hover {
  background: var(--white-06);
  transform: translateY(-1px);
}

.activity-period-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.activity-values {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.activity-kills {
  color: var(--secondary-color);
  font-weight: 600;
}

.activity-losses {
  color: var(--danger-color);
  font-weight: 600;
}

.security-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.security-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.security-space {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-small);
  min-width: 65px;
  text-align: center;
}

.security-space.highsec {
  background: rgba(74, 222, 128, 0.2);
  color: var(--secondary-color);
}

.security-space.lowsec {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning-color);
}

.security-space.nullsec {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger-color);
}

.security-bar {
  background: var(--white-1);
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
  flex: 1;
}

.security-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.security-fill.highsec { background: linear-gradient(90deg, #4ade80, #22c55e); }
.security-fill.lowsec { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.security-fill.nullsec { background: linear-gradient(90deg, #f87171, #ef4444); }

.security-percentage {
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
  min-width: 30px;
  text-align: right;
}
