:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --card: #f9fafb;
  --link: #1d4ed8;
  --border: #e5e7eb;
  --accent: #3b82f6;
}

html[data-theme='dark'] {
  --bg: #0b0f14;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --card: #0f172a;
  --link: #60a5fa;
  --border: #1f2937;
  --accent: #60a5fa;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, sans-serif;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}


header, footer {
  border-bottom: 1px solid var(--border);
}
footer { border-top: 1px solid var(--border); border-bottom: none; margin-top: 3rem; padding-top: 1rem; }

.header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

h1, h2, h3 { margin: 0.25rem 0 0.5rem; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.grid { display: grid; gap: 1rem; }
.grid.suggested { 
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
  margin-bottom: 2rem;
}
.grid.suggested h3 {
  font-size: 1.1rem;
}

.search {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
.search input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
}
.search button {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}

.row { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; }
.spacer { flex: 1; }

.btn {
  display: inline-block;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}
.btn.danger { border-color: #ef4444; color: #ef4444; }
.btn.primary { border-color: var(--link); color: var(--link); }

form.stacked { display: grid; gap: 0.6rem; }
label { font-weight: 600; }
input[type='text'], textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
}
textarea { min-height: 200px; font-family: inherit; }

.admin-header { margin-bottom: 1rem; }

.table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.3rem;
  text-align: left;
}

input[type='checkbox'] {
  width: auto;
  cursor: pointer;
}

/* Carousel */
.carousel {
  position: relative;
  overflow: hidden;
  margin: 1.5rem 0;
  border-radius: 12px;
  height: 400px;
}

.carousel-slide {
  display: none;
  position: relative;
  height: 400px;
  cursor: pointer;
}

.carousel-slide.active {
  display: block;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: white;
  padding: 2rem 1.5rem 1rem;
}

.carousel-overlay h2 {
  margin: 0 0 0.25rem;
  color: white;
  font-size: 1.5rem;
}

.carousel-overlay .muted {
  color: rgba(255,255,255,0.8);
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  padding: 1rem 0.75rem;
  cursor: pointer;
  z-index: 10;
}

.carousel-nav.prev { left: 0; border-radius: 0 8px 8px 0; }
.carousel-nav.next { right: 0; border-radius: 8px 0 0 8px; }

.carousel-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: none;
  cursor: pointer;
}

.carousel-dot.active {
  background: white;
}

/* Topics */
.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.topic-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.topic-btn:hover, .topic-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Thumbnails */
.thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.post-card-with-image {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .container { padding: 0.75rem; }
  
  .carousel { height: 250px; }
  .carousel-slide { height: 250px; }
  .carousel-overlay { padding: 1rem 0.75rem 0.5rem; }
  .carousel-overlay h2 { font-size: 1.1rem; }
  .carousel-nav { padding: 0.5rem; }
  
  .post-card-with-image {
    grid-template-columns: 1fr;
  }
  
  .header-row {
    flex-wrap: wrap;
  }
  
  .btn {
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
  }
  
  .search {
    flex-direction: column;
  }
  
  .search input {
    width: 100%;
  }
  
  .grid.suggested {
    grid-template-columns: 1fr;
  }
}

.topic-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.featured-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: #fbbf24;
  color: #92400e;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

