/* Modern Circular Organigram Styles */

:root {
  /* Color palette - Going Nowhere theme */
  --color-bg: #f5f5f5;
  --color-circle-bg: linear-gradient(135deg, #d13d11 0%, #c49667 100%);
  --color-circle-border: rgba(255, 255, 255, 0.3);
  --color-dept-bg: #ffffff;
  --color-dept-hover: #f5f5f5;
  --color-dept-border: #e2e8f0;
  --color-text-primary: #112337;
  --color-text-secondary: #54595f;
  --color-accent: #d13d11;
  --color-popup-bg: #ffffff;
  --color-shadow: rgba(0, 0, 0, 0.1);
  --color-shadow-hover: rgba(209, 61, 17, 0.25);

  /* Sizing */
  --circle-size: 520px;
  --dept-width: 110px;
  --dept-height: 70px;
  --orbit-radius: 220px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--color-bg);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--color-text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

h1 {
  text-align: center;
  padding: 20px;
  color: #112337;
  font-weight: 500;
  font-size: 14px;
  background: linear-gradient(90deg, transparent, rgba(209, 61, 17, 0.15), transparent);
  margin-bottom: 20px;
}

/* Main container */
#main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 100px);
  padding: 40px 20px;
  position: relative;
}

/* Circle wrapper - the orbit ring */
#circle-wrapper {
  width: var(--circle-size);
  height: var(--circle-size);
  border-radius: 50%;
  background: var(--color-circle-bg);
  position: relative;
  box-shadow:
    0 25px 80px -12px rgba(209, 61, 17, 0.35),
    0 0 120px rgba(196, 150, 103, 0.2),
    inset 0 0 60px rgba(255, 255, 255, 0.1);

  /* Inner content area */
  display: flex;
  align-items: center;
  justify-content: center;
}

#circle-wrapper::before {
  content: 'Nowhere Organisation';
  position: absolute;
  font-size: 18px;
  font-weight: 600;
  color: white;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}

#circle-wrapper::after {
  content: '';
  position: absolute;
  width: calc(var(--circle-size) - 160px);
  height: calc(var(--circle-size) - 160px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

/* Department items positioned around the circle */
.circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--dept-width);
  height: var(--dept-height);
  margin-left: calc(var(--dept-width) / -2);
  margin-top: calc(var(--dept-height) / -2);
  background: var(--color-dept-bg);
  border-radius: 12px;
  border: 1px solid var(--color-dept-border);
  box-shadow:
    0 4px 6px -1px var(--color-shadow),
    0 2px 4px -2px var(--color-shadow);
  transition:
    transform var(--transition-medium),
    box-shadow var(--transition-medium),
    background var(--transition-fast);
  cursor: pointer;
  z-index: 10;
}

.circle:hover {
  background: var(--color-dept-hover);
  box-shadow:
    0 20px 25px -5px var(--color-shadow-hover),
    0 8px 10px -6px var(--color-shadow);
  transform: var(--base-transform) scale(1.08);
  z-index: 20;
}

.dept_div {
  padding: 8px 10px;
  text-align: center;
}

.dept_title {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  word-wrap: break-word;
  max-width: 100%;
}

/* Hidden utility class */
.hidden {
  display: none !important;
}

/* Department popup - modern card style */
.dept_popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  background: var(--color-popup-bg);
  border-radius: 16px;
  border: none;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-medium),
    transform var(--transition-medium),
    visibility var(--transition-medium);
}

.dept_popup:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Popup header area */
.dept_popup::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--color-circle-bg);
}

.dept_desc {
  padding: 30px 24px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-height: none;
  max-width: none;
  border-bottom: 1px solid #f1f5f9;
}

.dept_desc:empty::after {
  content: 'No description available';
  font-style: italic;
  color: #94a3b8;
}

.dept_meta {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  border-bottom: 1px solid #f8fafc;
  transition: background var(--transition-fast);
}

.dept_meta:hover {
  background: #f8fafc;
}

.dept_meta:last-child {
  border-bottom: none;
}

.dept_meta span {
  font-weight: 400;
  font-size: 12px;
  color: var(--color-accent);
  background: rgba(209, 61, 17, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: auto;
}

/* Teams section within popup */
.teams_div {
  padding: 16px 24px;
  background: #f8fafc;
  max-height: 300px;
  overflow-y: auto;
}

.team {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--color-dept-border);
  transition: box-shadow var(--transition-fast);
}

.team:last-child {
  margin-bottom: 0;
}

.team:hover {
  box-shadow: 0 4px 12px var(--color-shadow);
}

.team_title {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.team_description {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.team_email {
  font-size: 11px;
  color: var(--color-accent);
  font-family: monospace;
  background: rgba(209, 61, 17, 0.08);
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}

.team_leads,
.team_members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.member {
  font-size: 12px;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 16px;
  color: var(--color-text-secondary);
}

.member.lead {
  background: linear-gradient(135deg, #d13d11 0%, #c49667 100%);
  color: white;
}

.member.lead span {
  opacity: 0.8;
  font-size: 10px;
  margin-left: 4px;
}

/* Expandable marker */
.expandable {
  cursor: pointer;
}

/* Backdrop overlay when popup is shown */
.dept_popup:not(.hidden)::after {
  content: '';
  position: fixed;
  top: -100vh;
  left: -100vw;
  width: 300vw;
  height: 300vh;
  background: rgba(17, 35, 55, 0.4);
  z-index: -1;
  backdrop-filter: blur(2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  :root {
    --circle-size: 380px;
    --dept-width: 85px;
    --dept-height: 55px;
    --orbit-radius: 160px;
  }

  #circle-wrapper::before {
    font-size: 14px;
  }

  .dept_title {
    font-size: 10px;
  }

  .dept_popup {
    width: 95%;
    max-height: 85vh;
  }
}

@media (max-width: 480px) {
  :root {
    --circle-size: 300px;
    --dept-width: 70px;
    --dept-height: 45px;
    --orbit-radius: 125px;
  }

  h1 {
    font-size: 12px;
    padding: 15px 10px;
  }

  .dept_title {
    font-size: 9px;
  }
}

/* Animation for initial load */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: var(--base-transform) translateY(20px);
  }
  to {
    opacity: 1;
    transform: var(--base-transform) translateY(0);
  }
}

.circle {
  animation: fadeInUp 0.5s ease backwards;
}

/* Staggered animation delay will be added via JS */
