@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --saffron: #FF6B00;
  --saffron-light: #FF8C33;
  --white: #FFFDF8;
  --ink: #1A1208;
  --ink-soft: #3D2F1A;
  --green: #138808;
  --green-light: #1aab0a;
  --gold: #C8960C;
  --gold-light: #F5C842;
  --cream: #FFF8EC;
  --cream-dark: #F5EDD8;
  --border: rgba(200, 150, 12, 0.2);
  --shadow: 0 4px 24px rgba(26,18,8,0.10);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}

a { color: inherit; }

/* HEADER */
header {
  background: var(--ink);
  color: var(--white);
  padding: 3.5rem 2rem 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--saffron) 33.3%, var(--white) 33.3% 66.6%, var(--green) 66.6%);
}

.header-badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-light);
  border: 1px solid var(--gold);
  padding: 0.3rem 1rem;
  border-radius: 2px;
  margin-bottom: 1.2rem;
}

header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

header h1 span { color: var(--saffron); }

header p.tagline {
  font-size: 1.05rem;
  color: rgba(255,253,248,0.7);
  max-width: 600px;
  margin: 0 auto;
  font-weight: 300;
  line-height: 1.6;
}

.admin-link {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,253,248,0.55);
  text-decoration: none;
  border: 1px solid rgba(255,253,248,0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
}
.admin-link:hover { color: var(--gold-light); border-color: var(--gold-light); }

/* STATS BAR */
.stats-bar {
  background: var(--saffron);
  color: white;
  display: flex;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.stat {
  padding: 1rem 2.5rem;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.3);
}
.stat:last-child { border-right: none; }
.stat strong { display: block; font-size: 1.6rem; font-weight: 700; font-family: 'Playfair Display', serif; }
.stat span { font-size: 0.75rem; letter-spacing: 0.1em; opacity: 0.85; text-transform: uppercase; }

/* SEARCH / FILTER BAR */
.filter-bar {
  max-width: 1100px;
  margin: 2rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input[type="text"],
.filter-bar select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
}

.filter-bar input[type="text"] { flex: 1; min-width: 200px; }

.filter-bar button, .btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  border: none;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.filter-bar button:hover, .btn:hover { background: var(--ink-soft); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--cream-dark); }
.btn-danger { background: #C0392B; }
.btn-danger:hover { background: #96281B; }
.btn-sm { font-size: 0.78rem; padding: 0.35rem 0.8rem; }

.result-count {
  max-width: 1100px;
  margin: 0.8rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* MAIN CONTENT */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.category { margin-bottom: 4rem; }

.category-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.cat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.category-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}

.category-header p {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.card {
  background: white;
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  border: 1px solid rgba(200,150,12,0.12);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(26,18,8,0.13);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
  background: var(--card-accent, var(--saffron));
}

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

.card-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.type-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
  font-weight: 500;
}

.badge-gov { background: #E8F5E9; color: #1B5E20; }
.badge-global { background: #E3F2FD; color: #0D47A1; }
.badge-private { background: #FFF3E0; color: #BF360C; }
.badge-nonprofit { background: #F3E5F5; color: #4A148C; }

.card-desc {
  font-size: 0.875rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.card-url {
  margin-top: 0.8rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--gold);
  opacity: 0.8;
  text-decoration: none;
  display: inline-block;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-soft);
}
.empty-state h3 { font-family: 'Playfair Display', serif; margin-bottom: 0.5rem; color: var(--ink); }

/* FOOTER */
footer {
  background: var(--ink);
  color: rgba(255,253,248,0.5);
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.8rem;
  line-height: 1.8;
}
footer strong { color: var(--gold-light); }
footer a { color: var(--gold-light); text-decoration: none; }

/* FLASH MESSAGES */
.flashes { max-width: 1100px; margin: 1rem auto 0; padding: 0 1.5rem; }
.flash {
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
}
.flash-success { background: #E8F5E9; color: #1B5E20; }
.flash-danger { background: #FFEBEE; color: #B71C1C; }
.flash-info { background: #E3F2FD; color: #0D47A1; }
.flash-warning { background: #FFF8E1; color: #8D6E00; }

/* ADMIN AREA */
.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

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

.admin-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
}

.admin-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  min-width: 160px;
}
.admin-stat-card strong { font-family: 'Playfair Display', serif; font-size: 1.5rem; display: block; }
.admin-stat-card span { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}
table.admin-table th {
  background: var(--cream-dark);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.admin-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.category-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.category-admin-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
}
.category-admin-card h3 { font-family: 'Playfair Display', serif; margin-bottom: 0.3rem; }
.category-admin-card p { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 0.8rem; }

/* FORMS */
.form-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  max-width: 640px;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--cream);
}
.form-group textarea { min-height: 110px; resize: vertical; }
.form-errors { color: #C0392B; font-size: 0.78rem; margin-top: 0.3rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: auto; }
.form-actions { display: flex; gap: 0.7rem; margin-top: 1.5rem; }

.login-wrap {
  max-width: 400px;
  margin: 4rem auto;
  padding: 0 1.5rem;
}

@media (max-width: 600px) {
  .cards-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-direction: column; }
  .stat { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.2); }
}
