/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-deep: #08080e;
  --bg-primary: #0c0c14;
  --bg-surface: #12121c;
  --bg-card: #161622;
  --bg-card-hover: #1c1c2e;
  --bg-input: #10101a;

  --border: #222236;
  --border-focus: #e0c097;

  --accent: #e0c097;
  --accent-glow: rgba(224, 192, 151, 0.25);
  --accent-soft: rgba(224, 192, 151, 0.1);
  --accent-muted: #b8976a;

  --danger: #e06070;
  --danger-soft: rgba(224, 96, 112, 0.12);

  --success: #60c090;
  --success-soft: rgba(96, 192, 144, 0.12);

  --blue: #6090d0;
  --blue-soft: rgba(96, 144, 208, 0.12);

  --orange: #d0a060;
  --orange-soft: rgba(208, 160, 96, 0.12);

  --purple: #b070d0;
  --purple-soft: rgba(176, 112, 208, 0.12);

  --text-primary: #e8e6f0;
  --text-secondary: #8888a8;
  --text-muted: #555570;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);

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

body {
  font-family: 'Zen Kaku Gothic New', 'Space Grotesk', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 32px 48px;
}

/* ===========================
   Header
   =========================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.memo-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===========================
   Filters
   =========================== */
.filter-group {
  display: flex;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.filter {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter:hover {
  color: var(--text-secondary);
}

.filter.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.97);
}

.btn-new {
  background: var(--accent-soft);
  border-color: rgba(224, 192, 151, 0.25);
  color: var(--accent);
}

.btn-new:hover {
  background: rgba(224, 192, 151, 0.18);
  border-color: var(--accent-muted);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-save {
  background: var(--accent-soft);
  border-color: rgba(224, 192, 151, 0.25);
  color: var(--accent);
}

.btn-save:hover {
  background: rgba(224, 192, 151, 0.18);
  border-color: var(--accent-muted);
}

.btn-delete {
  background: var(--danger-soft);
  border-color: rgba(224, 96, 112, 0.2);
  color: var(--danger);
}

.btn-delete:hover {
  background: rgba(224, 96, 112, 0.2);
  border-color: var(--danger);
}

.btn-cancel {
  color: var(--text-muted);
}

/* ===========================
   Memo List
   =========================== */
.memo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===========================
   Memo Card
   =========================== */
.memo-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  opacity: 0;
  transform: translateY(8px);
  animation: cardIn 0.35s ease forwards;
}

.memo-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.memo-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.memo-status-dot.idea {
  background: var(--purple);
  box-shadow: 0 0 8px var(--purple-soft);
}

.memo-status-dot.in-progress {
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue-soft);
}

.memo-status-dot.hold {
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange-soft);
}

.memo-status-dot.done {
  background: var(--success);
  box-shadow: 0 0 8px var(--success-soft);
}

.memo-content {
  flex: 1;
  min-width: 0;
}

.memo-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.memo-body-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.memo-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.memo-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.memo-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Deploy badge on card */
.memo-deploy {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 100px;
  background: var(--accent-soft);
  border: 1px solid rgba(224, 192, 151, 0.15);
  letter-spacing: 0.02em;
}

.memo-deploy::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-muted);
  flex-shrink: 0;
}

/* GitHub link on card */
.memo-github-link {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.memo-github-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ===========================
   Status column buttons
   =========================== */
.memo-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 12px;
}

.status-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.status-btn::after {
  content: attr(data-label);
  position: absolute;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.status-btn:hover::after {
  opacity: 1;
}

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

.status-btn:hover {
  border-color: var(--text-muted);
  background: var(--bg-card-hover);
  transform: scale(1.1);
}

.status-btn.active {
  border-color: transparent;
}

.status-btn.s-idea .dot { background: var(--purple); }
.status-btn.s-in-progress .dot { background: var(--blue); }
.status-btn.s-hold .dot { background: var(--orange); }
.status-btn.s-done .dot { background: var(--success); }

.status-btn.active.s-idea { background: var(--purple-soft); border-color: rgba(176, 112, 208, 0.3); }
.status-btn.active.s-in-progress { background: var(--blue-soft); border-color: rgba(96, 144, 208, 0.3); }
.status-btn.active.s-hold { background: var(--orange-soft); border-color: rgba(208, 160, 96, 0.3); }
.status-btn.active.s-done { background: var(--success-soft); border-color: rgba(96, 192, 144, 0.3); }

/* ===========================
   Modal
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 4, 8, 0.85);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 90%;
  max-width: 640px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer-right {
  display: flex;
  gap: 8px;
}

/* ===========================
   Form
   =========================== */
.form-group {
  margin-bottom: 16px;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23555570' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===========================
   Empty state
   =========================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===========================
   Toast
   =========================== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(96, 192, 144, 0.3); color: var(--success); }
.toast.error { border-color: rgba(224, 96, 112, 0.3); color: var(--danger); }

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 640px) {
  .app { padding: 16px; }
  .header { flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; }
  .filter-group { flex-wrap: wrap; }
  .form-row { flex-direction: column; gap: 0; }
  .memo-deploy { margin-left: 0; }
}
