:root {
  --bg-color: #1A1400; /* Dark amber background */
  --bg-surface: rgba(40, 30, 0, 0.7);
  --bg-surface-hover: rgba(50, 40, 0, 0.8);
  --border-color: rgba(245, 158, 11, 0.2);
  --border-highlight: rgba(245, 158, 11, 0.5);
  
  --primary: #F59E0B;       /* Amber */
  --primary-hover: #D97706;
  --secondary: #FBBF24;
  --accent: #EF4444;        /* Red accent */
  
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  
  --text-main: #FFFBEB;
  --text-muted: #D1D5DB;
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 15px rgba(245, 158, 11, 0.15);
  
  --transition: all 0.2s ease;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  display: flex;
  overflow: hidden;
  background-image: 
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.05) 0%, transparent 40%),
    radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.05) 0%, transparent 40%);
}

/* Glassmorphism */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* Utilities */
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.border-b { border-bottom: 1px solid var(--border-color); }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.relative { position: relative; }
.scrollable { overflow-y: auto; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mono-font { font-family: var(--font-mono) !important; font-size: 0.85rem !important; }

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

.sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  z-index: 10;
  box-shadow: 4px 0 15px rgba(0,0,0,0.2);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo { display: flex; align-items: center; gap: 0.75rem; }
.logo h1 { font-size: 1.35rem; font-weight: 700; background: linear-gradient(90deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}

.sidebar-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-color);
  overflow: hidden;
}

#3d-graph {
    width: 100%;
    height: 100%;
    cursor: grab;
}
#3d-graph:active { cursor: grabbing; }

/* Empty State */
.empty-state {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    z-index: 5;
}
.empty-state h2 { font-size: 1.5rem; font-weight: 600; margin-top: 1rem; }
.btn-group { pointer-events: auto; }

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 20, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(245, 158, 11, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms & UI Elements */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500;}
.form-control {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    resize: vertical;
}
.form-control:focus { outline: none; border-color: var(--primary); }

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
}
.search-wrap .form-control {
    padding-left: 2.25rem;
    width: 100%;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

/* Stats */
.stats-panel h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.stats-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.9rem; }
.stats-list li { display: flex; justify-content: space-between; align-items: center; }

/* Floating Detail Panel */
.floating-panel {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 300px;
    padding: 1.25rem;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid var(--border-highlight);
}
.detail-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; font-size: 0.9rem; }
.detail-list li { display: flex; justify-content: space-between; }
.detail-list .lbl { color: var(--text-muted); }

/* Modals */
.modal { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); 
    display: flex; align-items: center; justify-content: center; 
    z-index: 100; padding: 1rem; backdrop-filter: blur(4px);
}
.modal-content { width: 100%; max-width: 400px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; }

/* Buttons */
button { font-family: var(--font-sans); cursor: pointer; transition: var(--transition); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.icon-btn { background: none; border: none; color: var(--text-muted); padding: 0.5rem; border-radius: 50%; }
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-main); }
.btn-primary { background: var(--primary); color: var(--bg-color); border: none; padding: 0.75rem 1.2rem; border-radius: var(--radius-sm); font-weight: 600;}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border-highlight); color: var(--text-main); padding: 0.75rem 1.2rem; border-radius: var(--radius-sm); font-weight: 500;}
.btn-outline:hover { background: rgba(245, 158, 11, 0.1); border-color: var(--primary); color: var(--primary); }
.btn-text { background: none; border: none; color: var(--text-muted); padding: 0.5rem 1rem; font-size: 0.9rem;}
.btn-text:hover { color: var(--text-main); }

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: 50vh; border-right: none; border-bottom: 1px solid var(--border-color); }
    .main-content { height: 50vh; }
    .floating-panel { top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; }
}
