/* ================================================
   MAIN CSS — Premium Serif & Minimalist Theme (Medium Style)
   ================================================ */

/* ── FONTS & RESET ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a28;
  --border: rgba(255,255,255,0.08);
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --accent: #7c3aed;
  --accent2: #06b6d4;
  --accent-glow: rgba(124,58,237,0.3);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition: 0.2s ease;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-article { max-width: 740px; margin: 0 auto; padding: 0 24px; }

/* ── PREMIUM MEDIUM LIGHT-THEME STYLING ──────── */
body.medium-theme {
  background: #ffffff;
  color: #292929;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.medium-theme .navbar, .medium-theme .navbar.scrolled {
  background: rgba(255, 255, 255, 0.97) !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  padding: 16px 0 !important;
  backdrop-filter: blur(12px) !important;
}
.medium-theme .navbar .logo, .medium-theme .navbar.scrolled .logo {
  color: #191919 !important;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
}
.medium-theme .navbar .nav-links a, .medium-theme .navbar.scrolled .nav-links a {
  color: #555555 !important;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.2s;
}
.medium-theme .navbar .nav-links a:hover, .medium-theme .navbar.scrolled .nav-links a:hover {
  color: #000000 !important;
}

/* Minimal Hero */
.hero-minimal {
  background: #f7f4ed; /* Warm cream Medium background */
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 140px 0 100px;
}
.hero-minimal-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hero-left {
  max-width: 600px;
}
.hero-minimal h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1.05;
  font-weight: 700;
  color: #191919;
  margin-bottom: 24px;
}
.hero-minimal-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.35rem;
  line-height: 1.45;
  color: #292929;
  margin-bottom: 36px;
}

/* Medium Post Grid */
.medium-theme .section-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: #191919;
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-bottom: 16px;
}

.medium-theme .post-card {
  background: #ffffff;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-bottom: 28px;
  cursor: pointer;
}
.medium-theme .post-card:hover {
  transform: none;
  box-shadow: none;
}
.medium-theme .post-card:hover h3 {
  color: #7c3aed;
}
.medium-theme .post-card-img {
  height: 220px;
  border-radius: 4px;
  margin-bottom: 16px;
}
.medium-theme .post-card-body {
  padding: 0;
}
.medium-theme .post-card-body h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #191919;
  line-height: 1.3;
  margin-bottom: 10px;
  transition: color 0.2s;
}
.post-card-desc {
  font-size: 0.95rem;
  color: #757575;
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.medium-theme .post-meta {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: #757575;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Editorial Article Layout */
.article-header-minimal {
  padding: 140px 0 40px;
}
.article-tag-category {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7c3aed;
  margin-bottom: 16px;
}
.article-title-minimal {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15;
  font-weight: 700;
  color: #191919;
  margin-bottom: 24px;
}
.article-author-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 16px 0;
  margin-top: 24px;
}
.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.author-name {
  font-weight: 600;
  color: #191919;
  font-size: 0.95rem;
}
.author-meta {
  color: #757575;
  font-size: 0.85rem;
  margin-top: 2px;
}
.article-img-minimal {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: 4px;
}

/* Premium Serif Content */
.article-story-content {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.9;
  color: #292929;
}
.article-story-content p {
  margin-bottom: 28px;
}
.article-story-content h2, .article-story-content h3 {
  font-family: 'Playfair Display', serif;
  color: #191919;
  font-weight: 700;
  margin: 48px 0 20px;
  line-height: 1.3;
}
.article-story-content h2 { font-size: 1.8rem; }
.article-story-content h3 { font-size: 1.4rem; }
.article-story-content strong {
  color: #191919;
}
.article-story-content a {
  color: #191919;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s;
}
.article-story-content a:hover {
  color: #7c3aed;
}
.article-story-content blockquote {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
  border-left: 3px solid #191919;
  padding-left: 24px;
  margin: 36px 0;
  color: #191919;
}

/* Minimal Table of Contents */
.toc-minimal {
  background: #fcfcf9;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 40px;
}
.toc-minimal h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #191919;
  margin-bottom: 16px;
}
.toc-minimal ol {
  list-style-type: decimal;
  margin-left: 20px;
}
.toc-minimal li {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.toc-minimal a {
  color: #555555;
  text-decoration: none;
}
.toc-minimal a:hover {
  color: #7c3aed;
  text-decoration: underline;
}

/* Minimalist Search & Filters */
.page-header-minimal {
  padding: 140px 0 40px;
  background: #fafafa;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 48px;
}
.page-header-minimal h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: #191919;
}
.page-header-minimal .sub {
  font-size: 1.15rem;
  color: #757575;
  margin-top: 12px;
}
.filters-minimal {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
  align-items: center;
}
.search-bar-minimal {
  flex: 1;
  min-width: 280px;
  padding: 10px 16px;
  border: 1px solid rgba(0,0,0,0.12) !important;
  border-radius: 6px;
  background: #ffffff !important;
  color: #191919 !important;
  font-size: 0.95rem;
}
.search-bar-minimal:focus {
  outline: none;
  border-color: #7c3aed;
}
.filter-btn-minimal {
  padding: 8px 16px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #757575;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn-minimal.active, .filter-btn-minimal:hover {
  background: #191919;
  color: #ffffff;
  border-color: #191919;
}
.page-btn-minimal {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #ffffff;
  color: #757575;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.page-btn-minimal.active, .page-btn-minimal:hover {
  background: #191919;
  color: #ffffff;
  border-color: #191919;
}
.tags-row-minimal {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-top: 24px;
}
.tag-minimal {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  color: #757575;
  background: #fafafa;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 500;
}

/* Buttons and utilities */
.btn-dark {
  background: #191919;
  color: #ffffff;
}
.btn-dark:hover {
  background: #333333;
}


/* ── BUTTONS ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 600; text-decoration: none; border: none; cursor: pointer;
  transition: all var(--transition); font-family: var(--font);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d28d9; box-shadow: 0 0 20px var(--accent-glow); }
.btn-outline { background: transparent; color: #fff; border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 10px; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── NAVBAR (Dark style default for non-medium) ─ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 16px 0;
  transition: background var(--transition), backdrop-filter var(--transition);
}
.navbar.scrolled {
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: #fff; text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; transition: color var(--transition); }
.nav-links a:hover { color: #fff; }

/* ── SECTIONS ───────────────────────────────── */
.section { padding: 80px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.section-head h2 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; }
.text-center { text-align: center; margin-bottom: 48px; }

/* ── POST CARDS (Dark style default) ────────── */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.post-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 8px 32px rgba(124,58,237,0.2); }
.post-card-img {
  height: 200px; background-size: cover; background-position: center;
  background-color: var(--bg3); position: relative;
  background-image: url('/img/placeholder.svg');
}
.post-category {
  position: absolute; bottom: 12px; left: 12px;
  background: rgba(124,58,237,0.9); color: #fff;
  padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.post-card-body { padding: 20px; }
.post-card-body h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; line-height: 1.4; color: #fff; }
.post-meta { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); }

/* ── FOOTER ─────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer p { color: var(--text-muted); font-size: 0.875rem; }

/* ── SKELETON LOADERS ───────────────────────── */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 24px; }
.skeleton-card {
  height: 320px; background: var(--bg2); border-radius: var(--radius-lg);
  animation: shimmer 1.5s infinite;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── ADMIN LAYOUT ───────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; background: var(--bg); color: var(--text); }
.sidebar {
  width: 240px; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 0; position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto; z-index: 50; transition: transform var(--transition);
}
.sidebar-logo { padding: 0 20px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-logo .logo { font-size: 1.1rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  color: var(--text-muted); text-decoration: none; font-size: 0.9rem;
  transition: all var(--transition); border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  color: #fff; background: rgba(124,58,237,0.1); border-left-color: var(--accent);
}
.sidebar-nav .nav-icon { font-size: 1.1rem; width: 20px; }
.admin-main { flex: 1; margin-left: 240px; padding: 32px; min-height: 100vh; background: var(--bg); }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.admin-header h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: #fff; }

/* ── STAT CARDS ─────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--accent); }
.stat-card-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-card-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: #fff; }
.stat-card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.accent { border-color: rgba(124,58,237,0.3); background: rgba(124,58,237,0.05); }

/* ── TABLES ─────────────────────────────────── */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { padding: 14px 16px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); background: var(--bg3); }
td { padding: 14px 16px; font-size: 0.875rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: #e8e8f0; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── BADGES / TAGS ──────────────────────────── */
.badge-status {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-published { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-pending { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-processing { background: rgba(6,182,212,0.15); color: var(--accent2); }
.badge-failed { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-completed { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-started { background: rgba(245,158,11,0.15); color: var(--yellow); }

/* ── FORMS ───────────────────────────────────── */
.form-group { margin-bottom: 20px; }
label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem; font-family: var(--font);
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
select option { background: var(--bg3); }

/* ── CARD ────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; color: #fff; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 20px; }

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; max-width: 480px; width: 100%; margin: 20px;
}
.modal h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ── TOAST ───────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  padding: 14px 20px; border-radius: 10px; font-size: 0.9rem; font-weight: 500;
  background: var(--bg2); border: 1px solid var(--border); color: #fff;
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s ease; max-width: 340px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); }
#toast.error { border-color: var(--red); }

/* ── TERMINAL / LOG ─────────────────────────── */
.log-box {
  background: #0a0a0a; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; font-family: 'Courier New', monospace; font-size: 0.8rem;
  color: #a3e635; max-height: 300px; overflow-y: auto; line-height: 1.6;
}
.log-error { color: #f87171; }
.log-warn { color: #fbbf24; }
.log-info { color: #a3e635; }

/* ── EMPTY STATES ───────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 0.9rem; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; display: block; }

/* ── SPINNER ─────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; padding: 20px; }
  .posts-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  table { font-size: 0.8rem; }
  th, td { padding: 10px 12px; }
  .hero-minimal-inner { flex-direction: column; text-align: center; }
  .hero-left { margin: 0 auto; }
}
