:root {
  --primary-color: #ffffff;
  --bg-gradient-1: #6a11cb;
  --bg-gradient-2: #2575fc;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --text-light: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2));
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  color: var(--text-light);
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hidden {
  display: none !important;
}

/* Glassmorphism Classes */
.glass-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  background: rgba(0, 0, 0, 0.2);
}

.glass-card {
  background: var(--glass-bg);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 40px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 90%;
  max-width: 400px;
  animation: floatIn 0.8s ease-out;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.login-card p {
  font-size: 0.9rem;
  opacity: 0.8;
}

.login-card input {
  padding: 12px 15px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  outline: none;
  font-size: 1rem;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.login-card input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.login-card input:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.3);
}

.login-card button {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: white;
  color: var(--bg-gradient-1);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.login-card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

#error-msg {
  color: #ffb3b3;
  font-weight: 600;
  margin-top: -10px;
}

/* App Container */
#app-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.glass-header {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: 15px 25px;
  border-radius: 15px;
  backdrop-filter: blur(8px);
  z-index: 10;
  pointer-events: none;
}

.glass-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.glass-header p {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 5px;
}

#tree-container {
  flex: 1;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#tree-container:active {
  cursor: grabbing;
}

/* D3 Elements */
.link {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 2px;
  transition: stroke 0.3s, stroke-width 0.3s, filter 0.3s;
}

.link.highlighted {
  stroke: rgba(255, 255, 255, 1);
  stroke-width: 4px;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.8));
}

.node-card.highlighted-node {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(255,255,255,0.5);
  border-color: rgba(255, 255, 255, 0.8);
}

/* Let's style the node through inline D3, or CSS */
.node-card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease, background 0.3s ease;
  color: white;
  text-align: center;
}

.node-card:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.node-image {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  margin-bottom: 10px;
}

.node-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.node-year {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 3px;
}

.edit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
}

.edit-btn:hover {
  background: white;
  color: var(--bg-gradient-1);
  transform: scale(1.1);
}

.info-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 350px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.info-panel.hidden {
  display: block !important;
  transform: translateX(400px);
  opacity: 0;
  pointer-events: none;
}
