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

:root {
  --ink:          #1a1612;
  --ink-soft:     #4a4038;
  --paper:        #f5f0e8;
  --cream:        #ede6d6;
  --rule:         #d4c9b0;
  --accent:       #c0392b;
  --accent-light: #e8b4af;
  --white:        #fdfaf4;
  --radius:       4px;
  --ff-display:   'Playfair Display', Georgia, serif;
  --ff-body:      'DM Sans', sans-serif;
}

html, body { height: 100%; }

body {
  font-family: var(--ff-body);
  background-color: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(180,160,120,0.12) 28px
    );
}

/* ── TOPBAR ── */
.topbar {
  background: var(--ink);
  color: var(--paper);
  padding: 0 32px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(26,22,18,0.35);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--paper);
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: #fff;
  font-family: var(--ff-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: grid;
  place-items: center;
  border-radius: 3px;
  flex-shrink: 0;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-actions span {
  font-size: 13px;
  font-weight: 400;
  color: var(--rule);
  letter-spacing: 0.04em;
}

.divider { color: var(--ink-soft) !important; }

.logout-btn {
  background: none;
  border: 1px solid rgba(213,200,180,0.35);
  color: var(--rule);
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.logout-btn:hover {
  border-color: var(--accent-light);
  color: var(--accent-light);
}

/* ── NAVBAR ── */
/* Wireframe: no back button — title left, add button right */
.navbar {
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  padding: 0 32px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-title {
  font-family: var(--ff-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.add-btn {
  background: var(--ink);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
}

.add-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.add-btn:hover::after { transform: translateX(0); }
.add-btn:hover { transform: translateY(-1px); }

.add-btn a {
  display: block;
  position: relative;
  z-index: 1;
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  padding: 7px 16px;
}

/* ── MAIN ── */
.main {
  flex: 1;
  padding: 36px 32px 60px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* ── SEARCH BAR ── */
.search-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

.search-bar label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 14px;
  width: 260px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrap:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(26,22,18,0.07);
}

.search-input-wrap svg {
  color: var(--rule);
  flex-shrink: 0;
}

.search-input-wrap input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
  width: 100%;
}

.search-input-wrap input::placeholder { color: #b8a98c; }

.search-btn {
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: var(--radius);
  padding: 9px 22px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
}

.search-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-btn:hover::after { transform: translateX(0); }
.search-btn:hover { transform: translateY(-1px); }

/* ── TOPICS CONTAINER (outer bordered box) ── */
.topics-container {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--cream);
  padding: 20px;
  box-shadow:
    0 1px 3px rgba(26,22,18,0.04),
    0 4px 16px rgba(26,22,18,0.05);
}

/* ── TOPICS LIST ── */
.topics-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── TOPIC ROW ── */
.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.topic-row:hover {
  box-shadow: 0 2px 10px rgba(26,22,18,0.08);
  transform: translateY(-1px);
}

/* Left accent bar on hover */
.topic-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 0 2px 2px 0;
}

.topic-row:hover::before { transform: scaleY(1); }

/* Topic name — clickable, navigates to entries */
.topic-name {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
  flex: 1;
  transition: color 0.2s;
}

.topic-name:hover { color: var(--accent); }

/* ── ROW ACTIONS ── */
.topic-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-edit,
.btn-delete {
  font-family: var(--ff-body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: var(--radius);
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}

.btn-edit {
  background: var(--cream);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}

.btn-edit:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  transform: translateY(-1px);
}

.btn-delete {
  background: transparent;
  border: 1px solid var(--accent-light);
  color: var(--accent);
}

.btn-delete:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* ── FOOTER ── */
.footer {
  background: var(--cream);
  border-top: 1px solid var(--rule);
  text-align: center;
  padding: 16px 20px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: #8a7d68;
}

/* ── RESPONSIVE ── */
@media (max-width: 580px) {
  .main { padding: 24px 16px 48px; }
  .topbar, .navbar { padding: 0 16px; }
  .topic-row { flex-wrap: wrap; gap: 10px; }
  .topic-name { font-size: 15px; }
  .search-input-wrap { width: 100%; }
  .search-bar { flex-wrap: wrap; justify-content: center; }
}