:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --card: #1a1a2e;
  --card-hover: #1f1f35;
  --accent: #e94560;
  --accent2: #0f3460;
  --accent-glow: rgba(233, 69, 96, 0.15);
  --text: #e8e8f0;
  --text-muted: #6b7280;
  --border: #1f2937;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

header {
  background: linear-gradient(135deg, var(--accent2) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-icon { font-size: 2rem; }

.header-logo h1 {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.btn {
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover { filter: brightness(1.15); transform: translateY(-1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #374151; color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn-outline:hover { background: var(--accent-glow); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.btn-close:hover { color: var(--text); }
.btn-danger { background: #dc2626; color: #fff; }

/* Admin Bar */
.admin-bar {
  background: linear-gradient(135deg, var(--accent2), #1a1a3e);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-admin { background: var(--accent); color: #fff; }

/* Posts */
.posts { display: flex; flex-direction: column; gap: 1.2rem; }

.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.post:hover { border-color: #2a2a4a; }

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.post-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
}

.post-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-tags { margin-bottom: 0.5rem; }

.tag {
  display: inline-block;
  background: rgba(15, 52, 96, 0.5);
  color: #93c5fd;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-right: 0.3rem;
}

.post-content {
  line-height: 1.7;
  font-size: 0.95rem;
  white-space: pre-wrap;
  color: #d1d5db;
}

.post-content p { margin-bottom: 0.5rem; }

.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.post-images img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-images img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.post.pinned {
  border-color: var(--accent);
  background: linear-gradient(135deg, #1a1a2e 0%, #1e1020 100%);
}

.post.pinned:hover { border-color: #e94560; }

.pinned-badge { font-size: 1rem; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #d1d5db;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.post-admin-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state .big-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--text); }

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-lg { max-width: 700px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.1rem; }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.field { margin-bottom: 1.2rem; }

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #d1d5db;
}

.field .hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.field input[type="text"],
.field input[type="password"],
.field textarea {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #111;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field textarea { resize: vertical; min-height: 100px; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.upload-zone:hover { border-color: var(--accent); }

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  cursor: pointer;
}

.upload-icon { font-size: 2rem; }

.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.image-grid .img-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
}

.image-grid .img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.image-grid .img-wrapper .img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--surface);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.95);
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius);
  object-fit: contain;
}

.lb-close {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  z-index: 201;
  font-size: 2rem;
  color: #fff;
}

/* Footer */
footer {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* Notifications */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.2rem;
  font-size: 0.85rem;
  z-index: 300;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast-success { border-left: 3px solid #22c55e; }
.toast-error { border-left: 3px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 640px) {
  .header-inner { flex-direction: column; gap: 0.5rem; text-align: center; }
  .admin-bar { flex-direction: column; align-items: stretch; }
  .admin-actions { justify-content: center; }
  .post-header { flex-direction: column; }
  .post-images { grid-template-columns: 1fr 1fr; }
  .post-images img { height: 150px; }
}
