:root {
  --primary: #2d5016;
  --primary-light: #4a7c28;
  --secondary: #8b6914;
  --bg: #faf8f0;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --border: #e0d8c8;
  --radius: 8px;
}

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

body {
  font-family: 'Georgia', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.header h1 { font-size: 1.5rem; }
.header h1 a { color: white; }
.header nav a {
  color: #ddd;
  margin-left: 1.5rem;
  font-size: 0.95rem;
}
.header nav a:hover { color: white; }

/* Header inner layout */
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
}
.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}
.logo:hover { color: white; }
.nav { display: flex; gap: 0.5rem; }
.nav-link {
  color: #ddd;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
}
.nav-link:hover, .nav-link.active {
  color: white;
  background: rgba(255,255,255,0.1);
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  text-align: center;
  padding: 4rem 2rem;
}
.hero h1, .hero h2, .hero-title { font-size: 2.2rem; margin-bottom: 0.5rem; }
.hero p, .hero-subtitle { font-size: 1.1rem; opacity: 0.9; max-width: 600px; margin: 0 auto 1.5rem; }

/* Sections */
.section { padding: 2rem 0; }
.section-alt { background: #f5f0e8; }
.section-title { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--primary); }

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

/* Category Cards */
.categories, .categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.cat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}
.cat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.cat-card .icon { font-size: 2rem; margin-bottom: 0.5rem; }
.cat-card h3 { font-size: 1rem; color: var(--primary); }

/* Ad Grid */
.ad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.ad-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.ad-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.ad-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #e8e0d0;
}
.ad-card .info { padding: 1rem; }
.ad-card .info h3 { margin-bottom: 0.3rem; }
.ad-card .info .price { color: var(--secondary); font-weight: bold; font-size: 1.1rem; }
.ad-card .info .meta { color: var(--text-light); font-size: 0.85rem; margin-top: 0.5rem; }

/* Ad Detail */
.ad-detail { max-width: 800px; margin: 0 auto; }
.ad-detail .photos { display: flex; gap: 0.5rem; overflow-x: auto; margin-bottom: 1.5rem; }
.ad-detail .photos img { height: 300px; border-radius: var(--radius); object-fit: cover; }
.ad-detail h2 { margin-bottom: 0.5rem; }
.ad-detail .price { color: var(--secondary); font-size: 1.3rem; font-weight: bold; margin-bottom: 1rem; }
.ad-detail .description { margin-bottom: 1.5rem; }
.ad-detail .seller-info {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Filters */
.filters, .filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.85rem; font-weight: bold; color: var(--text-light); }
.filters select, .filters input,
.filter-bar select, .filter-bar input,
.form-select, .form-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: white;
  min-width: 180px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-danger { background: #c0392b; color: white; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: white;
}

/* Utility */
.text-center { text-align: center; }

/* Footer */
.footer {
  background: var(--primary);
  color: #ccc;
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
  font-size: 0.9rem;
}

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 60px);
}
.admin-sidebar {
  background: #2a2a2a;
  color: white;
  padding: 1.5rem 0;
}
.admin-sidebar a {
  display: block;
  color: #ccc;
  padding: 0.7rem 1.5rem;
  border-left: 3px solid transparent;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left-color: var(--primary-light);
}
.admin-main { padding: 2rem; }
.admin-main h2 { margin-bottom: 1.5rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: bold; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); }
th { background: #f5f0e8; font-size: 0.85rem; text-transform: uppercase; color: var(--text-light); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-draft { background: #fff3cd; color: #856404; }
.badge-expired { background: #f8d7da; color: #721c24; }

/* Login */
.login-box {
  max-width: 400px;
  margin: 4rem auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.login-box h2 { text-align: center; margin-bottom: 1.5rem; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Messages */
.msg { padding: 0.8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.msg-success { background: #d4edda; color: #155724; }
.msg-error { background: #f8d7da; color: #721c24; }

/* Empty state */
.empty { text-align: center; padding: 3rem; color: var(--text-light); }

/* Loading */
.loading { text-align: center; padding: 2rem; color: var(--text-light); }

/* Responsive */
@media (max-width: 768px) {
  .header { flex-direction: column; text-align: center; }
  .header nav a { margin: 0 0.5rem; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: flex; overflow-x: auto; padding: 0; }
  .admin-sidebar a { padding: 0.7rem 1rem; border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .form-row { flex-direction: column; gap: 0; }
  .hero { padding: 2rem 1rem; }
  .hero h2 { font-size: 1.6rem; }
}
