/* ========================================
   GSD Guide Dashboard — Premium Light Theme
   ======================================== */

:root {
  /* Colors — Light Mode */
  --bg-primary: #f5f6f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbfc;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-border: rgba(0, 0, 0, 0.06);
  --bg-input: #f0f1f4;

  --text-primary: #1a1a2e;
  --text-secondary: #5a5f72;
  --text-tertiary: #9ca3b0;
  --text-accent: #4361ee;

  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.08);
  --green-light: #ecfdf5;
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.08);
  --yellow-light: #fffbeb;
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.08);
  --red-light: #fef2f2;
  --gray: #9ca3af;
  --gray-bg: rgba(156, 163, 175, 0.08);
  --gray-light: #f9fafb;

  --accent: #4361ee;
  --accent-hover: #3651d4;
  --accent-bg: rgba(67, 97, 238, 0.08);
  --accent-light: #eef0ff;
  --danger: #ef4444;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.07), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.03);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(67, 97, 238, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== Screens ========== */
.screen { display: none; }
.screen.active { display: block; }

/* ========== Login Screen ========== */
#login-screen {
  display: none;
  place-items: center;
  min-height: 100vh;
  padding: 2rem;
  background: linear-gradient(135deg, #eef0ff 0%, #f5f6f8 50%, #ecfdf5 100%);
}
#login-screen.active { display: grid; }

.login-card {
  text-align: center;
  padding: 3rem 2.5rem;
  border-radius: var(--radius-xl);
  max-width: 380px;
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-glass-border);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.6s ease-out;
}

.login-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.login-card h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  margin-bottom: 2rem;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

#login-form input {
  background: var(--bg-input);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  text-align: center;
  letter-spacing: 0.15em;
}

#login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.875rem;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.25);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-loader {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.error-text { color: var(--danger); font-size: 0.8rem; margin-top: 0.5rem; }

/* ========== Top Bar ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  border-bottom: 1px solid var(--bg-glass-border);
  box-shadow: var(--shadow-xs);
}

.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.logo { font-size: 1.5rem; }
.topbar-title { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); }

.topbar-center { flex: 1; max-width: 420px; margin: 0 2rem; }

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 0.5rem 1rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-box:focus-within {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.search-icon { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }

.search-box input {
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 0.875rem; font-family: inherit; width: 100%;
}
.search-box input::placeholder { color: var(--text-tertiary); }

.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.btn-icon {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  display: grid;
  place-items: center;
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { color: var(--accent); background: var(--accent-bg); }
.btn-icon.syncing svg { animation: spin 1s linear infinite; }

/* ========== Stats Bar ========== */
.stats-bar {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  overflow-x: auto;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-glass-border);
  border-radius: 999px;
  padding: 0.4rem 0.875rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}

.stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.stat-dot.green { background: var(--green); }
.stat-dot.yellow { background: var(--yellow); }
.stat-dot.red { background: var(--red); }
.stat-dot.gray { background: var(--gray); }

.last-sync { margin-left: auto; color: var(--text-tertiary); font-size: 0.75rem; }

/* ========== Filter Tabs ========== */
.filter-tabs {
  display: flex;
  gap: 0.375rem;
  padding: 0 1.5rem 0.75rem;
  overflow-x: auto;
}

.filter-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-tab:hover { background: var(--bg-input); color: var(--text-primary); }

.filter-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ========== Project List ========== */
.project-list { padding: 0 1.5rem 2rem; }

.status-group { margin-bottom: 1.5rem; }

.status-group-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-group-header .dot { width: 10px; height: 10px; border-radius: 50%; }

.status-group-header .count {
  background: var(--bg-input);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 0.875rem;
}

/* ========== Project Card ========== */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  animation: fadeInUp 0.4s ease-out both;
  border-left: 3px solid transparent;
}

.project-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.project-card[data-status="active"] { border-left-color: var(--green); }
.project-card[data-status="progress"] { border-left-color: var(--yellow); }
.project-card[data-status="stale"] { border-left-color: var(--red); }
.project-card[data-status="uninitialized"] { border-left-color: var(--gray); }

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.project-name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); word-break: break-word; }

.project-date {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  margin-left: 0.75rem;
  padding: 0.15rem 0.5rem;
  background: var(--bg-input);
  border-radius: 999px;
  flex-shrink: 0;
}

.project-latest {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

/* ========== History Button ========== */
.history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--bg-glass-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  margin-bottom: 0.75rem;
}

.history-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.history-toggle.open { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }

.history-panel {
  display: none;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  margin-bottom: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  animation: fadeInUp 0.25s ease-out;
}

.history-panel.open { display: block; }

.history-entry {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.history-entry:last-child { border-bottom: none; }

.history-entry-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.history-entry-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.history-entry-details {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.history-entry-details li {
  margin-left: 1rem;
  margin-bottom: 0.1rem;
}

.history-empty {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-align: center;
  padding: 0.5rem;
}

/* ========== Todo Section ========== */
.todo-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.todo-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }

.todo-label {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary);
}

.todo-list { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }

.todo-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.5rem; border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.todo-item:hover { background: var(--bg-input); }

.todo-checkbox {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 5px;
  cursor: pointer; position: relative; flex-shrink: 0;
  transition: all var(--transition);
}

.todo-checkbox:checked { background: var(--accent); border-color: var(--accent); }

.todo-checkbox:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-checkbox:hover { border-color: var(--accent); }

.todo-text { font-size: 0.85rem; color: var(--text-primary); flex: 1; word-break: break-word; transition: all var(--transition); }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--text-tertiary); }

.todo-delete {
  opacity: 0; background: none; border: none;
  color: var(--text-tertiary); cursor: pointer;
  padding: 0.2rem; font-size: 0.85rem;
  transition: all var(--transition); border-radius: 4px;
}
.todo-item:hover .todo-delete { opacity: 1; }
.todo-delete:hover { color: var(--danger); background: var(--red-bg); }

.add-todo-form { display: flex; gap: 0.375rem; margin-top: 0.5rem; }

.add-todo-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.625rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.add-todo-input:focus { border-color: var(--accent); background: #fff; }
.add-todo-input::placeholder { color: var(--text-tertiary); }

/* ========== Notes Section ========== */
.notes-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.notes-label {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0.375rem;
  display: flex; align-items: center; gap: 0.375rem;
}

.notes-saved { color: var(--green); font-size: 0.65rem; opacity: 0; transition: opacity var(--transition); }
.notes-saved.show { opacity: 1; }

.notes-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.625rem;
  font-size: 0.825rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 60px;
  line-height: 1.6;
  transition: border-color var(--transition), background var(--transition);
}
.notes-textarea:focus { border-color: var(--accent); background: #fff; }
.notes-textarea::placeholder { color: var(--text-tertiary); }

/* ========== Loading & Empty States ========== */
.loading-state, .empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-tertiary); }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--bg-glass-border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ========== Animations ========== */
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .topbar { padding: 0.625rem 1rem; }
  .topbar-center { margin: 0 0.75rem; }
  .topbar-title { display: none; }
  .stats-bar { padding: 0.75rem 1rem; }
  .filter-tabs { padding: 0 1rem 0.75rem; }
  .project-list { padding: 0 1rem 2rem; }
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar-center { display: none; }
  .stats-bar { flex-wrap: wrap; }
  .last-sync { margin-left: 0; flex-basis: 100%; text-align: center; }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }
/* v2 - light theme */
