/* ============================================================
   Classifieds — style.css
   Clean, no-framework, mobile-friendly
   ============================================================ */

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

:root {
  --bg:       #f5f5f5;
  --surface:  #ffffff;
  --border:   #e0e0e0;
  --primary:  #1565c0;
  --primary-h:#0d47a1;
  --danger:   #c62828;
  --success:  #2e7d32;
  --text:     #212121;
  --muted:    #616161;
  --accent:   #e3f2fd;
  --radius:   8px;
  --shadow:   0 1px 4px rgba(0,0,0,.10);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Navbar ---- */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.nav-brand {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.nav-brand:hover { text-decoration: none; opacity: .9; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  transition: background .15s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-h); text-decoration: none; color: #fff; }
.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.5);
}
.btn-ghost:hover { background: rgba(255,255,255,.15); }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-approve { background: #388e3c; color: #fff; }
.btn-approve:hover { background: #2e7d32; }
.btn-delete { background: var(--danger); color: #fff; }
.btn-delete:hover { background: #b71c1c; }

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.container-narrow {
  max-width: 740px;
}

/* ---- Layout (sidebar + listings) ---- */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  margin-top: 1.25rem;
}
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---- Search ---- */
.search-form {
  display: flex;
  gap: .5rem;
}
.search-input {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}
.search-input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  height: fit-content;
  box-shadow: var(--shadow);
}
.sidebar-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 0 0 .75rem;
}
.cat-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cat-list li { margin: .25rem 0; }
.cat-list a {
  display: block;
  padding: .3rem .5rem;
  border-radius: 5px;
  color: var(--text);
  font-size: .92rem;
}
.cat-list a:hover { background: var(--accent); text-decoration: none; }
.cat-list a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---- Ad cards ---- */
.listings {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.ad-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: block;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
  color: var(--text);
}
.ad-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
  border-color: var(--primary);
  text-decoration: none;
}

.ad-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}
.ad-category {
  background: var(--accent);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.ad-date { font-size: .78rem; color: var(--muted); }

.ad-title {
  margin: .25rem 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.ad-desc {
  margin: .25rem 0 .5rem;
  font-size: .9rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ad-price {
  font-weight: 700;
  color: var(--primary);
  font-size: .95rem;
}

/* ---- Single ad detail ---- */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: .9rem;
  color: var(--muted);
}
.ad-detail {
  padding: 1.5rem;
}
.ad-detail-title {
  font-size: 1.5rem;
  margin: .5rem 0;
}
.ad-price-large {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: .75rem 0;
}
.ad-detail-desc { margin: 1.25rem 0; }
.ad-detail-desc h3 { margin-bottom: .4rem; font-size: 1rem; color: var(--muted); }
.ad-detail-desc p { white-space: pre-wrap; }
.ad-contact-box {
  background: var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
}
.ad-contact-box h3 { margin: 0 0 .4rem; font-size: .95rem; }
.ad-contact-box p { margin: 0; font-weight: 600; font-size: 1.05rem; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---- Form ---- */
.form-card { padding: 1.75rem; }
.page-title { margin-bottom: 1.25rem; }

.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .92rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}
.form-group textarea { resize: vertical; }

.required { color: var(--danger); margin-left: .2rem; }
.optional { color: var(--muted); font-weight: 400; font-size: .82rem; }
.form-note { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }

/* ---- Alerts ---- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 500;
}
.alert-success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; }
.alert-error   { background: #ffebee; color: var(--danger);  border: 1px solid #ef9a9a; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-icon { font-size: 3rem; margin-bottom: .75rem; }

/* ---- Admin table ---- */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.admin-table th {
  background: var(--primary);
  color: #fff;
  padding: .6rem .85rem;
  text-align: left;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.admin-table td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-table tr:last-child td { border-bottom: none; }
.row-pending { background: #fffde7; }
.admin-desc {
  font-size: .8rem;
  color: var(--muted);
  margin: .2rem 0 0;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.actions { white-space: nowrap; display: flex; gap: .4rem; align-items: flex-start; }

/* ---- Badges ---- */
.badge {
  padding: .15rem .5rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-approved { background: #e8f5e9; color: var(--success); }
.badge-pending  { background: #fff3e0; color: #e65100; }

/* ---- Price + currency row ---- */
.price-row {
  display: flex;
  gap: .5rem;
}
.currency-select {
  width: 80px;
  flex-shrink: 0;
  padding: .55rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  background: var(--accent);
  color: var(--primary);
  cursor: pointer;
}
.currency-select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.price-row input { flex: 1; }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: .85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
