@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --primary-blue: #0066FF;
  --primary-dark: #0047B3;
  --primary-light: #3385FF;
  --accent-cyan: #00D9FF;
  --accent-purple: #8B5CF6;
  --accent-green: #10B981;
  --accent-orange: #F59E0B;
  --bg-gradient-start: #0A1628;
  --bg-gradient-end: #1A2B45;
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(0, 102, 255, 0.3);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  color: var(--text-primary);
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.brand-header {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 100;
  animation: slideInLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  transition: all 0.3s ease;
}

.brand-logo:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  background: rgba(255, 255, 255, 0.12);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-cyan) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
}

.department-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 150;
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 28px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: var(--shadow-xl), 0 0 60px rgba(0, 102, 255, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.department-popup.active {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.popup-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-blue), var(--accent-cyan));
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 102, 255, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#dept-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

#dept-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 20px 0;
}

.visit-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.visit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 102, 255, 0.5);
  background: linear-gradient(135deg, var(--primary-light), var(--primary-blue));
}

.controls-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-end;
  animation: slideInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-xl);
  font-family: 'Inter', sans-serif;
}

.control-btn.primary {
  background: linear-gradient(135deg, var(--primary-blue), var(--accent-cyan));
  border: none;
  box-shadow: var(--shadow-xl), 0 0 30px rgba(0, 102, 255, 0.4);
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.control-btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--accent-cyan));
}

.control-btn svg {
  transition: transform 0.3s ease;
}

.control-btn:hover svg {
  transform: translateX(3px);
}

.department-list {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
}

.department-list.expanded {
  max-height: 400px;
  opacity: 1;
  margin-top: 8px;
}

.dept-list-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dept-list-item {
  padding: 12px 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dept-list-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-4px);
  border-color: var(--primary-blue);
}

.dept-list-item.active {
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.2), rgba(0, 217, 255, 0.2));
  border-color: var(--primary-blue);
}

.dept-color-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dept-item-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.hint-box {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 100;
  padding: 14px 18px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  box-shadow: var(--shadow-xl);
  animation: slideInLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.hint-box svg {
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.hint-box span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 24px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loader-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.loader-progress {
  width: 240px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--accent-cyan));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--primary-blue);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .brand-header {
    top: 16px;
    left: 16px;
  }

  .brand-logo {
    padding: 10px 14px;
    gap: 10px;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .controls-panel {
    bottom: 16px;
    right: 16px;
  }

  .hint-box {
    bottom: 16px;
    left: 16px;
    max-width: calc(100vw - 32px);
    font-size: 12px;
  }

  .department-popup {
    min-width: 300px;
    max-width: calc(100vw - 32px);
    padding: 20px;
  }

  .department-list {
    min-width: 240px;
  }
}
