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

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

:root {
  --bg: #ffffff;
  --bg-panel: #fafbfc;
  --border: #e8ecf0;
  --text: #1a1a2e;
  --text-2: #5a6072;
  --text-3: #8e95a5;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}

/* Layout */
#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}

/* Left Sidebar */
#nav {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#nav-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

#logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
}

#import-area {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

#import-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  margin-bottom: 8px;
}

#import-input:focus {
  outline: none;
  border-color: var(--accent);
}

#import-btn {
  width: 100%;
  padding: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#import-btn:disabled {
  opacity: 0.4;
}

#project-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.project-item {
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  position: relative;
}

.project-item:hover {
  background: var(--accent-soft);
}

.project-item.active {
  background: var(--accent-soft);
}

.project-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
  padding-right: 20px;
}

.project-meta {
  font-size: 10px;
  color: var(--text-3);
}

.project-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.project-item:hover .project-delete {
  opacity: 1;
}

.project-delete:hover {
  color: var(--red);
}

#nav-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-3);
}

.btn-ghost {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

/* Main Area */
#main {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* Research Panel */
#research-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 480px;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 900;
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
}

#research-panel.open {
  display: flex;
}

#rp-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#rp-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  max-width: 380px;
}

#rp-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

#rp-close:hover {
  color: var(--text);
}

#rp-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.rp-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.rp-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.rp-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}

.rp-badge {
  display: inline-block;
  padding: 4px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
  margin-bottom: 6px;
}

.rp-list {
  list-style: none;
}

.rp-list li {
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

.loading {
  padding: 40px 20px;
  text-align: center;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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