/* ============================================
   Kyndryl Cloud Uplift — Globe Explorer
   Dark theme inspired by datacenters.microsoft.com
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary:    #010409;
  --bg-sidebar:    rgba(6, 10, 22, 0.94);
  --bg-card:       rgba(18, 26, 46, 0.55);
  --bg-card-hover: rgba(0, 120, 212, 0.18);
  --accent:        #0078d4;
  --accent-light:  #00a4ef;
  --accent-glow:   rgba(0, 164, 239, 0.35);
  --text-primary:  #ffffff;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --border:        rgba(255, 255, 255, 0.08);
  --sidebar-width: 380px;
  --header-height: 56px;
  --font-family:   'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(1, 4, 9, 0.97) 0%, rgba(1, 4, 9, 0.7) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 28px;
  height: 28px;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.header-title span {
  color: var(--accent-light);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: var(--transition);
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 90;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 24px 16px;
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* Search */
.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  transition: var(--transition);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  border-color: var(--accent);
  background: rgba(0, 120, 212, 0.08);
  box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 4px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stat {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  border-radius: 8px;
  background: var(--bg-card);
}

.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-light);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Region list */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.sidebar-content::-webkit-scrollbar {
  width: 5px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
}

#region-list {
  padding: 8px 16px 24px;
}

.geography-group {
  margin-bottom: 8px;
}

.geography-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 8px 6px;
  user-select: none;
}

.region-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.region-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 120, 212, 0.25);
}

.region-card.active {
  background: rgba(0, 120, 212, 0.22);
  border-color: var(--accent);
}

.region-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 8px var(--accent-glow);
}

.region-card.active .region-dot,
.region-card:hover .region-dot {
  box-shadow: 0 0 14px var(--accent-glow), 0 0 4px var(--accent);
}

.region-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 164, 239, 0.3);
}

.region-info {
  min-width: 0;
}

.region-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-location {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.region-badge {
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(0, 120, 212, 0.15);
  color: var(--accent-light);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

/* ---------- Globe Container ---------- */
#globe-container {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  overflow: hidden;
}

#globe-container canvas {
  display: block;
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed;
  display: none;
  pointer-events: none;
  background: rgba(10, 14, 30, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 164, 239, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  z-index: 200;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 120, 212, 0.15);
  transform: translate(16px, -50%);
}

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

.tooltip-location {
  font-size: 12px;
  color: var(--text-secondary);
}

.tooltip-azure {
  font-size: 11px;
  color: var(--accent-light);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* ---------- Detail Panel ---------- */
.detail-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: 400px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  z-index: 95;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.detail-panel.hidden {
  transform: translateX(110%);
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  z-index: 1;
}

.detail-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.detail-header {
  padding: 32px 28px 24px;
  border-bottom: 1px solid var(--border);
}

.detail-region-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 120, 212, 0.15);
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-region-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.detail-location {
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-body {
  padding: 24px 28px;
}

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

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-info-item {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
}

.detail-info-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Deployment list */
.deployment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deployment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.deployment-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.deployment-api {
  font-size: 12px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  color: var(--accent-light);
  background: rgba(0, 120, 212, 0.1);
  padding: 3px 10px;
  border-radius: 6px;
}

/* ---------- Footer ---------- */
#footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(0deg, rgba(4, 7, 20, 0.95) 0%, rgba(4, 7, 20, 0) 100%);
  z-index: 80;
  pointer-events: none;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- Loading ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(0, 120, 212, 0.15);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* ---------- Sidebar Toggle (mobile) ---------- */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--header-height) + 12px);
  left: 12px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  z-index: 95;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(0, 120, 212, 0.2);
}

/* ---------- Animations ---------- */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  50%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 0; }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.region-card {
  animation: fade-in-up 0.4s ease both;
}

/* stagger */
.region-card:nth-child(1)  { animation-delay: 0.02s; }
.region-card:nth-child(2)  { animation-delay: 0.04s; }
.region-card:nth-child(3)  { animation-delay: 0.06s; }
.region-card:nth-child(4)  { animation-delay: 0.08s; }
.region-card:nth-child(5)  { animation-delay: 0.10s; }
.region-card:nth-child(6)  { animation-delay: 0.12s; }
.region-card:nth-child(7)  { animation-delay: 0.14s; }
.region-card:nth-child(8)  { animation-delay: 0.16s; }
.region-card:nth-child(9)  { animation-delay: 0.18s; }
.region-card:nth-child(10) { animation-delay: 0.20s; }
.region-card:nth-child(11) { animation-delay: 0.22s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 320px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
  }

  .sidebar-toggle {
    display: flex;
  }

  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #globe-container {
    left: 0;
  }

  #footer {
    left: 0;
  }

  .detail-panel {
    width: 100%;
  }
}
