:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-hover: #1a1a2e;
  --border: #2a2a3e;
  --text: #e4e4ef;
  --text-dim: #8888a0;
  --accent: #7c5cfc;
  --green: #22c55e;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --gray: #6b7280;
  --red: #ef4444;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  text-align: center;
  padding: 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-card h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.login-card p { color: var(--text-dim); margin-bottom: 2rem; }

.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #5865F2;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.2s;
}
.btn-discord:hover { opacity: 0.9; }

.error { color: var(--red); margin-top: 1rem; }

.dashboard { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

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

.header h1 { font-size: 1.5rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.user-info img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.logout {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
}
.logout:hover { color: var(--text); }

.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.sort-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.sort-bar select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.875rem;
}

.projects-grid {
  /* Container for folder sections */
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.project-card:hover { border-color: var(--accent); }

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

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-active { background: rgba(34,197,94,0.15); color: var(--green); }
.status-paused { background: rgba(245,158,11,0.15); color: var(--amber); }
.status-completed { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-archived { background: rgba(107,114,128,0.15); color: var(--gray); }

.card-desc {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.tech-tag {
  padding: 0.15rem 0.5rem;
  background: var(--bg-hover);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.repo-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.8rem;
  display: block;
  margin-bottom: 0.75rem;
}
.repo-link:hover { text-decoration: underline; }

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.blue { background: var(--blue); }

.progress-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  text-align: right;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 4rem 1rem;
  font-size: 1.1rem;
}

@media (max-width: 600px) {
  .dashboard { padding: 1rem; }
  .header h1 { font-size: 1.2rem; }
}

/* FAB - Add button */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,92,252,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 100;
}
.fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(124,92,252,0.5); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.modal-header h2 { font-size: 1.2rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

#modalForm label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-dim);
}

#modalForm input[type="text"],
#modalForm input[type="url"],
#modalForm textarea,
#modalForm select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
#modalForm textarea { resize: vertical; }
#modalForm input:focus, #modalForm textarea:focus, #modalForm select:focus {
  outline: none;
  border-color: var(--accent);
}

.progress-input {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.progress-input input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.progress-input span {
  min-width: 3rem;
  text-align: right;
  color: var(--text);
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.modal-actions-right {
  display: flex;
  gap: 0.5rem;
}

.btn-save {
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}
.btn-save:hover { opacity: 0.9; }

.btn-cancel {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
.btn-cancel:hover { color: var(--text); border-color: var(--text-dim); }

.btn-delete {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}
.btn-delete:hover { background: var(--red); color: white; }

@media (max-width: 600px) {
  .modal { width: 100%; max-width: none; border-radius: 0; max-height: 100vh; min-height: 100vh; }
  .fab { bottom: 1rem; right: 1rem; }
}

/* Folder sections */
.folder-section {
  margin-bottom: 1.5rem;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
  user-select: none;
}
.folder-header:hover { background: var(--bg-card); }

.folder-toggle {
  font-size: 0.7rem;
  color: var(--text-dim);
  width: 1rem;
}

.folder-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.folder-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.folder-count {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
  padding: 0.5rem 0;
}

.folder-empty {
  color: var(--text-dim);
  font-size: 0.875rem;
  padding: 1rem;
  font-style: italic;
}

@media (max-width: 600px) {
  .folder-grid { grid-template-columns: 1fr; }
}

/* Drag & Drop */
.project-card[draggable="true"] {
  cursor: grab;
}
.project-card[draggable="true"]:active {
  cursor: grabbing;
}
.project-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.folder-header.drag-over {
  background: var(--bg-hover);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.filter-btn.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--bg-hover);
  color: var(--text);
}

/* Folder action buttons (↑↓✎) */
.folder-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.folder-header:hover .folder-actions,
.folder-header:focus-within .folder-actions {
  opacity: 1;
}

@media (pointer: coarse) {
  .folder-actions { opacity: 1; }
}

.folder-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.folder-action-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

/* New Folder button in sort-bar */
.btn-new-folder {
  margin-left: auto;
  background: rgba(124,92,252,0.15);
  color: var(--accent);
  border: 1px solid rgba(124,92,252,0.3);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 13px;
}

.btn-new-folder:hover {
  background: rgba(124,92,252,0.25);
}

/* Folder modal — compact */
.modal-sm {
  max-width: 360px;
}

.modal-sm label input[type="color"] {
  width: 48px;
  height: 32px;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
}

/* Priority badge on card */
.card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.priority-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

.priority-low    { background: rgba(107,114,128,0.2); color: var(--gray); }
.priority-medium { background: rgba(245,158,11,0.15); color: var(--amber); }
.priority-high   { background: rgba(239,68,68,0.15);  color: var(--red); }

/* Links section in modal */
.modal-links-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.modal-links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.btn-add-link {
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 12px;
}
.btn-add-link:hover { background: rgba(124,92,252,0.1); }

.link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.link-row input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 0.875rem;
}

.link-label { width: 30%; }
.link-url   { flex: 1; }

.link-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}
.link-remove:hover { color: var(--red); }

/* date input styling */
#modalForm input[type="date"] {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  color-scheme: dark;
}
