/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --purple:      #ada2cc;
  --purple-light:#f8f7fc;
  --teal:        #9fd7d5;
  --coral:       #e76e50;
  --coral-dark:  #e06e60;
  --text:        #2d2d2d;
  --text-muted:  #7a7a8c;
  --bg:          #ffffff;
  --border:      #e8e5f2;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(100, 90, 140, 0.09);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
  padding: 1rem 1.5rem;
}
.header-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}
.brand img { display: block; border-radius: 8px; height: 40px; width: auto; }
.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}
.brand-ai { color: var(--purple); }

/* ── Tagline (index only) ─────────────────────────────────────────────────── */
.tagline-bar {
  background: var(--purple-light);
  text-align: center;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
}

/* ── Main ─────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Section header (coral left border) ──────────────────────────────────── */
.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  padding-left: 0.85rem;
  border-left: 4px solid var(--coral);
  margin-bottom: 1.25rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }

.btn-coral   { background: var(--coral); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--purple); color: var(--text); opacity: 1; }
.btn-danger  { background: #fdecea; color: #c0392b; border: 1.5px solid #f5c6c0; }
.btn-danger:hover { background: #f5c6c0; opacity: 1; }
.btn-approve { background: #e6f9f8; color: #2a8a87; border: 1.5px solid #b8e8e6; }
.btn-approve:hover { background: #b8e8e6; opacity: 1; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-full { width: 100%; text-align: center; padding: 0.7rem; font-size: 1rem; }

/* ── Filter bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.filter-btn {
  background: var(--bg);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-btn:hover   { border-color: var(--purple); color: var(--text); }
.filter-btn.active  { background: var(--coral); color: #fff; border-color: var(--coral); }

/* ── Status messages ──────────────────────────────────────────────────────── */
.status {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}
.status.loading::before {
  content: '';
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}
.status.error  { color: var(--coral); }
.status.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Card grid ────────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--purple-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(100, 90, 140, 0.14);
}
.card-top   { position: absolute; top: 1.25rem; right: 1.25rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.35; padding-right: 5rem; }
.card-desc  {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Category badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.badge-tool    { background: #d8f2f1; color: #2a8a87; }
.badge-event   { background: #fde8e5; color: #c95d50; }
.badge-article { background: #edeaf7; color: #6b5fa8; }
.badge-video   { background: #fde8e5; color: #c95d50; }
.badge-other   { background: #f0f0f0; color: #666; }

/* ── Tag pills (cards + admin approved list) ──────────────────────────────── */
.card-tags, .resource-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tag-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--purple-light);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

/* ── Tag filter bar (index.html) ──────────────────────────────────────────── */
.tag-filter-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: -1.25rem;
  margin-bottom: 1.5rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}
.tag-filter-btn {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tag-filter-btn:hover { border-color: var(--coral); color: var(--text); }
.tag-filter-btn.active { background: var(--coral); color: #fff; border-color: var(--coral); }
.tag-clear-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  display: none;
}
.tag-clear-btn:hover { color: var(--coral); }

/* ── Tag input (admin pending items) ─────────────────────────────────────── */
.resource-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.tags-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.tags-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  outline: none;
  flex: 1;
  min-width: 160px;
}
.tags-input:focus { border-color: var(--purple); }
.tags-hint { font-size: 0.72rem; color: var(--text-muted); }

/* ── Category select (admin pending items) ───────────────────────────────── */
.category-select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  outline: none;
  cursor: pointer;
}
.category-select:focus { border-color: var(--purple); }

/* ── AI Suggest button ───────────────────────────────────────────────────── */
.btn-ai { background: #edeaf7; color: #6b5fa8; border: 1.5px solid #d0ccee; }
.btn-ai:hover { background: #d0ccee; opacity: 1; }

/* ── AI feedback line ────────────────────────────────────────────────────── */
.ai-feedback      { font-size: 0.75rem; margin-top: 0.3rem; min-height: 1.1em; }
.ai-feedback-ok   { color: #2a8a87; }
.ai-feedback-error { color: var(--coral); }

/* ── Visit button ─────────────────────────────────────────────────────────── */
.btn-visit {
  display: inline-block;
  background: #fff;
  color: var(--coral);
  border: 1.5px solid var(--coral);
  text-decoration: none;
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  align-self: flex-start;
  transition: background 0.15s, color 0.15s;
}
.btn-visit:hover { background: var(--coral); color: #fff; }

/* ── Form (submit.html) ───────────────────────────────────────────────────── */
.form-card {
  background: var(--purple-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.form-group label { font-size: 0.875rem; font-weight: 700; color: var(--text); }
.form-group input,
.form-group textarea,
.form-group select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--purple); }
.form-group textarea { resize: vertical; min-height: 90px; }
.char-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.form-hint  { font-size: 0.78rem; color: var(--text-muted); }
.form-success {
  background: #e8f9f8;
  border: 1.5px solid var(--teal);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: #2a8a87;
  font-weight: 500;
  display: none;
}
.form-error {
  background: #fdecea;
  border: 1.5px solid #f5c6c0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: #c0392b;
  font-size: 0.875rem;
  display: none;
  margin-bottom: 1rem;
}

/* ── Admin (admin.html) ───────────────────────────────────────────────────── */
.password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 247, 252, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.password-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.password-box h2 { font-size: 1.1rem; font-weight: 700; }
.password-box input {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  outline: none;
  width: 100%;
}
.password-box input:focus { border-color: var(--purple); }
.password-error { color: var(--coral); font-size: 0.85rem; display: none; }

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.6rem 1.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--coral); border-bottom-color: var(--coral); font-weight: 700; }
.tab-btn:hover:not(.active) { color: var(--text); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.resource-list { display: flex; flex-direction: column; gap: 0.85rem; }
.resource-item {
  background: var(--purple-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.resource-info { flex: 1; min-width: 0; }
.resource-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}
.resource-url {
  display: block;
  font-size: 0.78rem;
  color: var(--purple-dark, #7b6fa8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
  text-decoration: none;
}
.resource-url:hover { text-decoration: underline; }
.resource-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.3rem;
  word-break: break-word;
  overflow-wrap: break-word;
  max-height: 80px;
  overflow-y: auto;
}
.resource-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.resource-actions { display: flex; gap: 0.5rem; flex-shrink: 0; align-items: flex-start; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1.5px solid var(--border);
}

/* ── Inline edit form (admin) ─────────────────────────────────────────────── */
.edit-form { width: 100%; }
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.edit-field { display: flex; flex-direction: column; gap: 0.2rem; }
.edit-field-full { grid-column: 1 / -1; }
.edit-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.edit-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  outline: none;
  width: 100%;
}
.edit-input:focus { border-color: var(--purple); }
.edit-textarea { resize: vertical; min-height: 64px; }
.edit-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Card grid fade ───────────────────────────────────────────────────────── */
.card-grid { transition: opacity 0.18s ease; }
.card-grid.fading { opacity: 0; }

/* ── Card actions row ─────────────────────────────────────────────────────── */
.card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
  padding-top: 0.5rem;
  flex-wrap: wrap;
}

/* ── Copy link button ─────────────────────────────────────────────────────── */
.btn-copy {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-copy:hover { border-color: var(--purple); color: var(--text); }
.btn-copy.copied { border-color: #2a8a87; color: #2a8a87; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state-icon  { font-size: 3rem; display: block; margin-bottom: 1rem; }
.empty-state-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.empty-state-text  { font-size: 0.9rem; line-height: 1.6; }

/* ── Toast notifications ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: auto;
  max-width: 300px;
}
.toast.show           { opacity: 1; transform: translateY(0); }
.toast.toast-success  { background: #2a8a87; }
.toast.toast-error    { background: var(--coral); }

/* ── Page fade-in ─────────────────────────────────────────────────────────── */
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
main { animation: pageIn 0.25s ease; }

/* ── Card clickable hint ──────────────────────────────────────────────────── */
.card { cursor: pointer; }
.card-read-more {
  font-size: 0.75rem;
  color: var(--purple);
  font-weight: 500;
  margin-top: -0.2rem;
}

/* ── Detail modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 45, 45, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-overlay.visible { opacity: 1; }

.modal-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 40px rgba(100, 90, 140, 0.2);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}
.modal-overlay.visible .modal-box { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--purple-light); color: var(--text); }

.modal-category { margin-bottom: 0.75rem; }
.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  padding-right: 2rem;
  margin-bottom: 1rem;
}
.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.modal-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.modal-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .header-inner  { flex-direction: column; align-items: flex-start; }
  .btn           { width: 100%; text-align: center; }
  .card-grid     { grid-template-columns: 1fr; }
  .form-card     { padding: 1.25rem; }
  .resource-item { flex-direction: column; }
  .resource-actions { flex-wrap: wrap; }
  .edit-grid { grid-template-columns: 1fr; }
  .toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}
