/* ═══════════════════════════════════════
   NeedBoard – Mobile-First Stylesheet
   Palette: Teal #0D6E6E, Sand #F5F0E8,
   Coral #E8533A, Charcoal #1A1A2E, Mint #E8F5F5
═══════════════════════════════════════ */

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

:root {
  --teal:    #0D6E6E;
  --teal-d:  #094F4F;
  --teal-l:  #15A3A3;
  --sand:    #F5F0E8;
  --coral:   #E8533A;
  --coral-d: #C73E28;
  --char:    #1A1A2E;
  --char-m:  #3D3D56;
  --mint:    #E8F5F5;
  --white:   #FFFFFF;
  --border:  #D8D3CB;
  --shadow:  0 2px 12px rgba(13,110,110,0.12);
  --radius:  14px;
  --font:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--sand);
  color: var(--char);
  min-height: 100vh;
  padding-bottom: 90px; /* space for FAB */
}

/* ── HEADER ── */
.site-header {
  background: var(--teal);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: 900px;
  margin: 0 auto;
  gap: 8px;
}
.logo { display: flex; align-items: center; gap: 8px; min-width: 0; flex-shrink: 1; }
.logo-icon { font-size: 22px; flex-shrink: 0; }
.logo-text {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-post-btn {
  background: var(--coral);
  color: white;
  border: none;
  font-size: 14px;
  font-weight: 800;
  padding: 8px 18px;
  border-radius: 24px;
  cursor: pointer;
  letter-spacing: -0.2px;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.header-post-btn:hover { background: var(--coral-d); }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; justify-content: flex-end; flex-shrink: 0; }
.header-manage-link {
  display: inline-flex;
  align-items: center;
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  opacity: 0.9;
  white-space: nowrap;
  border: 1.5px solid rgba(255,255,255,0.4);
  padding: 7px 12px;
  border-radius: 20px;
  transition: opacity 0.2s, background 0.2s;
  flex-shrink: 0;
}
.header-manage-link:hover { opacity: 1; background: rgba(255,255,255,0.1); }

@media (max-width: 400px) {
  .header-inner { padding: 12px 10px; gap: 6px; }
  .logo-text { font-size: 16px; }
  .logo-icon { font-size: 18px; }
  .header-actions { gap: 6px; }
  .header-manage-link { font-size: 11px; padding: 6px 9px; }
  .header-post-btn { font-size: 12px; padding: 7px 12px; }
}
@media (max-width: 340px) {
  .logo-text { display: none; }
}

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, var(--teal-d) 0%, var(--teal) 60%, var(--teal-l) 100%);
  padding: 36px 20px 40px;
  text-align: center;
  color: white;
}
.hero-title {
  font-size: clamp(26px, 7vw, 42px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.hero-title .accent { color: #FFD166; }
.hero-sub {
  font-size: 15px;
  opacity: 0.85;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.5;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-top: 8px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat strong {
  font-size: 22px;
  font-weight: 800;
  color: #FFD166;
}
.stat span {
  font-size: 11px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── FILTERS ── */
.filters-section {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  max-width: 900px;
  margin: 0 auto;
}
.filters-form { display: flex; flex-direction: column; gap: 8px; }
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.filter-row--child {
  animation: filterReveal 0.2s ease-out;
}
.filter-placeholder {
  /* holds the grid column so opposite side aligns correctly */
  visibility: hidden;
}
.filter-reveal {
  border-left: 3px solid var(--teal);
}
@keyframes filterReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.filters-section select {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--sand);
  color: var(--char);
  font-size: 13px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230D6E6E' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
#f_custom_date {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--teal);
  border-radius: 8px;
  background: var(--sand);
  color: var(--char);
  font-size: 13px;
}
#f_custom_date.filter-placeholder {
  visibility: hidden;
  border: none;
  padding: 0;
}
.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.btn-filter {
  background: var(--teal);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: background 0.2s;
}
.btn-filter:hover { background: var(--teal-d); }
.btn-clear {
  background: var(--sand);
  color: var(--char-m);
  border: 1.5px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-clear:hover { border-color: var(--teal); color: var(--teal); }

/* ── POSTS ── */
.posts-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}
.posts-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--char-m);
  margin-bottom: 14px;
}
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
@media (max-width: 400px) {
  .posts-grid { grid-template-columns: 1fr; }
}

.post-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  border: 1px solid rgba(13,110,110,0.08);
}
.post-card:active { transform: scale(0.98); }
@media (hover: hover) {
  .post-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(13,110,110,0.18); }
}

.card-image {
  width: 100%;
  height: 170px;
  overflow: hidden;
  background: var(--mint);
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.4;
}
.card-body { padding: 14px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.tag-cat { background: var(--mint); color: var(--teal-d); }
.tag-loc { background: #FFF3F1; color: #B03020; }

.card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  color: var(--char);
}
.card-desc {
  font-size: 13px;
  color: var(--char-m);
  line-height: 1.5;
  margin-bottom: 10px;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.card-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal);
}
.card-date {
  font-size: 11px;
  color: #999;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--char-m);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; margin-bottom: 6px; }

/* ── FAB BUTTON ── */
/* ── MODALS ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(26,26,46,0.55);
  backdrop-filter: blur(3px);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal.active { display: flex; }

@media (min-width: 600px) {
  .modal { align-items: center; padding: 20px; }
}

.modal-box {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  animation: slideUp 0.28s ease;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 600px) {
  .modal-box {
    border-radius: 20px;
    max-height: 88vh;
  }
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-small { max-width: 420px; }

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--sand);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  color: var(--char-m);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  padding-right: 40px;
  letter-spacing: -0.3px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--char-m);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.req { color: var(--coral); }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font);
  background: var(--sand);
  color: var(--char);
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--white);
}
.form-group small {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 5px;
}

/* Image upload */
.img-upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--mint);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.img-upload-area:hover { border-color: var(--teal); }
.img-upload-area input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  background: transparent;
}
.img-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}
.img-upload-placeholder span:first-child { font-size: 32px; }
.img-preview {
  display: none;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.btn-submit {
  width: 100%;
  background: var(--teal);
  color: white;
  border: none;
  padding: 15px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s;
  letter-spacing: -0.2px;
}
.btn-submit:hover:not(:disabled) { background: var(--teal-d); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-flag { background: var(--coral); }
.btn-flag:hover:not(:disabled) { background: var(--coral-d); }

.form-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  display: none;
}
.form-msg.error { display: block; background: #FFF0EE; color: #C0392B; }
.form-msg.success { display: block; background: #EFF9F3; color: #1E7E34; }

/* ── POST DETAIL ── */
.detail-img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
}
.detail-body { padding: 0 2px; }
.detail-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  margin: 10px 0 10px;
  letter-spacing: -0.5px;
}
.detail-desc {
  font-size: 15px;
  line-height: 1.65;
  color: var(--char-m);
  margin-bottom: 16px;
}
.detail-price {
  background: var(--mint);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--teal-d);
}
.detail-contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.btn-call, .btn-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-call { background: var(--teal); color: white; }
.btn-call:hover { background: var(--teal-d); }
.btn-wa { background: #25D366; color: white; }
.btn-wa:hover { background: #1EBA5A; }

.detail-date {
  font-size: 12px;
  color: #999;
  text-align: right;
  margin-bottom: 14px;
}
.btn-flag-post {
  width: 100%;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--char-m);
  padding: 11px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 6px;
  transition: all 0.2s;
}
.btn-flag-post:hover { border-color: var(--coral); color: var(--coral); }

.loading {
  text-align: center;
  padding: 40px;
  color: var(--char-m);
  font-size: 16px;
}

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: #999;
  margin-top: 20px;
}

/* ══════════════════════════
   ADMIN STYLES
══════════════════════════ */
.admin-body {
  background: #F0F2F5;
  padding-bottom: 40px;
}
.admin-header {
  background: var(--char);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 1100px;
  margin: 0 auto;
}
.admin-logo {
  color: white;
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.admin-nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}
.admin-nav a:hover, .admin-nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
}
.admin-nav a.logout { color: #FF7A6B; }

.admin-main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}
.admin-page-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--char);
}

.card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--char);
  border-bottom: 2px solid var(--mint);
  padding-bottom: 10px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--sand);
  color: var(--char-m);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-active { background: #D4EDDA; color: #155724; }
.badge-blocked { background: #F8D7DA; color: #721C24; }
.badge-flagged { background: #FFF3CD; color: #856404; }

.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s;
}
.btn-danger { background: #FDECEA; color: #C0392B; }
.btn-danger:hover { background: #C0392B; color: white; }
.btn-success { background: #EFF9F3; color: #1E7E34; }
.btn-success:hover { background: #1E7E34; color: white; }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-d); }
.btn-secondary { background: var(--sand); color: var(--char-m); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.admin-form .form-group label { text-transform: none; font-size: 14px; }
.admin-form input, .admin-form select, .admin-form textarea {
  padding: 10px 12px;
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.stat-card .stat-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--teal);
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--char-m);
  margin-top: 4px;
}

.tree-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--sand);
}
.tree-item .item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.tree-item .item-name { font-weight: 600; font-size: 14px; }
.subtree { margin-left: 20px; margin-top: 8px; border-left: 2px solid var(--border); padding-left: 12px; }

.flag-list { display: flex; flex-direction: column; gap: 8px; }
.flag-item {
  background: #FFF8F0;
  border: 1px solid #FFD8B0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.flag-item strong { color: var(--coral-d); }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--teal-d), var(--char));
  padding: 20px;
}
.login-box {
  background: white;
  border-radius: 20px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
}
.login-box h1 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 6px;
  text-align: center;
}
.login-box p {
  font-size: 14px;
  color: var(--char-m);
  text-align: center;
  margin-bottom: 24px;
}
.login-error {
  background: #FDECEA;
  color: #C0392B;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}

/* ── Hamburger button ─────────────────────────────── */
.admin-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.admin-hamburger span {
  display: block;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  transition: transform 0.22s, opacity 0.22s;
  transform-origin: center;
}
.admin-hamburger--open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.admin-hamburger--open span:nth-child(2) { opacity: 0; }
.admin-hamburger--open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile: tables become cards ─────────────────── */
@media (max-width: 640px) {
  /* Show hamburger, hide inline nav */
  .admin-hamburger { display: flex; }
  .admin-nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0; right: 0;
    background: var(--char);
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    z-index: 200;
  }
  .admin-nav--open { display: flex; }
  .admin-nav a {
    padding: 11px 14px;
    font-size: 15px;
    border-radius: 8px;
  }
  .admin-header { position: relative; }

  /* Stats grid: 2 columns on mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card { padding: 14px 12px; }
  .stat-card .stat-num { font-size: 24px; }

  /* Card layout for tables */
  .admin-table,
  .admin-table thead,
  .admin-table tbody,
  .admin-table tr,
  .admin-table th,
  .admin-table td { display: block; width: 100%; }

  .admin-table thead { display: none; } /* hide header row */

  .admin-table tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 8px 4px;
    background: white;
    overflow: hidden;
  }

  .admin-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
  }
  .admin-table td:last-child { border-bottom: none; }

  /* Inject column labels via data-label */
  .admin-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--char-m);
    min-width: 72px;
    padding-top: 2px;
    flex-shrink: 0;
  }

  .admin-main { padding: 0 12px; margin: 16px auto; }
  .card { padding: 14px 12px; }
  .admin-page-title { font-size: 18px; }
}

