:root {
  --primary: #8B5CF6;
  --primary-dark: #7C3AED;
  --primary-glow: rgba(139, 92, 246, 0.4);
  --accent: #F43F5E;
  --bg-deep: #0D0D15;
  --bg-surface: #161622;
  --bg-soft: #1F1F2E;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top right, #1E1B4B 0%, #0D1117 100%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.admin-body {
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, h4, .brand {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a { text-decoration: none; transition: all 0.3s ease; color: inherit; }
img { display: block; max-width: 100%; height: auto; }

/* Reusable Components */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
}

.btn:hover { 
  background: var(--glass-hover); 
  border-color: var(--primary); 
  transform: translateY(-2px); 
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 50%;
  margin-right: 8px;
  animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover { box-shadow: 0 8px 24px var(--primary-glow); }

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--accent);
}

.btn-danger:hover { background: var(--accent); color: #fff; }

.btn.small { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: 8px; }

input, textarea {
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  background: var(--glass-hover);
  box-shadow: 0 0 15px var(--primary-glow);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

/* Header */
.site-header {
  padding: 1.25rem 2rem;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-size: 1.5rem;
  background: linear-gradient(135deg, #A78BFA 0%, #F472B6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

/* Layout */
.page { max-width: 1200px; margin: 0 auto; padding: 4rem 1.5rem; }

/* Hero */
.hero { text-align: center; margin-bottom: 5rem; }
.eyebrow {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.hero h1 { font-size: clamp(2.5rem, 8vw, 4.5rem); line-height: 1.1; margin-bottom: 1.5rem; }
.hero .muted { font-size: 1.2rem; color: var(--text-muted); max-width: 720px; margin: 0 auto; }

/* Blog Grid */
.blog-list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 2.5rem; }

/* Post Cards */
.post-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.4s ease;
  height: 100%;
}

.post-card:hover { transform: translateY(-8px); border-color: var(--primary-glow); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); }

.blog-card-media-link { display: block; height: 240px; overflow: hidden; position: relative; }
.blog-card-media { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.post-card:hover .blog-card-media { transform: scale(1.08); }

.blog-card-media-fallback { background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%); display: flex; align-items: center; justify-content: center; height: 100%; position: relative; }
.blog-card-media-mark { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.15); padding: 0.6rem 1.4rem; border-radius: 100px; font-weight: 800; font-size: 1.25rem; color: #fff; z-index: 2; }

.blog-card-body { padding: 2rem; flex: 1; display: flex; flex-direction: column; }
.blog-card-title { font-size: 1.5rem; line-height: 1.3; margin-bottom: 1rem; color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-excerpt { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.blog-card-link { color: var(--primary); font-weight: 600; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.blog-card-link::after { content: '→'; transition: transform 0.3s ease; }
.blog-card-link:hover::after { transform: translateX(4px); }

/* Single Article View */
.article-shell { display: grid; grid-template-columns: 1fr 340px; gap: 4rem; align-items: start; }
.article-main { min-width: 0; }
.article-top { margin-bottom: 3rem; }
.article-title { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.05; margin-bottom: 1.5rem; background: linear-gradient(180deg, #FFFFFF 0%, #CBD5E1 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.article-summary { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 2.5rem; max-width: 800px; }

.article-author-row { display: flex; align-items: center; gap: 1.25rem; padding: 1.25rem 1.75rem; background: var(--glass); border: 1px solid var(--glass-border); border-radius: 24px; backdrop-filter: blur(12px); width: fit-content; }
.article-author-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; box-shadow: 0 4px 12px var(--primary-glow); }
.article-author-copy strong { display: block; font-size: 1rem; font-weight: 700; color: var(--text-main); margin-bottom: 2px; }
.article-author-copy span { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }

.article-banner { display: block; width: 100%; height: auto; border-radius: 32px; margin: 3.5rem 0; border: 1px solid var(--border); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(139, 92, 246, 0.1); transition: transform 0.4s ease; }
.article-banner:hover { transform: scale(1.01); }

.post-body { font-size: 1.125rem; line-height: 1.8; color: #E2E8F0; }
.post-body h2 { font-size: 2rem; margin: 3rem 0 1.5rem; }
.post-body h3 { font-size: 1.5rem; margin: 2rem 0 1rem; }
.post-body p { margin-bottom: 1.5rem; }
.post-body ul, .post-body ol { margin-bottom: 2rem; padding-left: 1.75rem; }
.post-body li { margin-bottom: 0.75rem; }
.post-body li::marker { color: var(--primary); font-weight: 700; }

.admin-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.admin-viewport { 
  display: grid; 
  grid-template-columns: 1fr 420px; 
  flex: 1; 
  overflow: hidden; 
  gap: 0;
  border-top: 1px solid var(--border);
}

.admin-editor { 
  overflow-y: auto; 
  padding: 2.5rem; 
  display: flex; 
  flex-direction: column; 
  gap: 2.5rem;
  background: rgba(13, 17, 23, 0.4);
}

.admin-hero { 
  padding: 2rem 4rem; 
  background: rgba(30, 27, 75, 0.95); 
  backdrop-filter: blur(32px);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  z-index: 1000;
  width: 100%;
}

/* Background gradient blobs to fill space */
.admin-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: var(--primary);
  filter: blur(200px);
  opacity: 0.1;
  pointer-events: none;
}

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 3rem; }

.admin-tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }

.admin-section { padding: 3rem; width: 100%; }
.section-head { margin-bottom: 2.5rem; }
.section-heading { font-size: 2.25rem; margin-top: 0.5rem; letter-spacing: -0.03em; }

.editor-grid { 
  display: grid; 
  grid-template-columns: repeat(3, 1fr); 
  gap: 2rem; 
}

@media (min-width: 1800px) {
  .editor-grid { grid-template-columns: repeat(4, 1fr); }
  .span-2 { grid-column: span 2; }
  .span-all { grid-column: 1 / -1; }
}

/* Specific Field Adjustments */
.span-2 { grid-column: span 2; }

/* In a 3-column grid, we want some fields to span more effectively */
@media (max-width: 1799px) {
  .span-2, .span-all { grid-column: 1 / -1; }
}

.compact-grid { grid-template-columns: 1fr; gap: 1.5rem; }

.faq-section { margin-top: 3rem; padding-top: 3rem; border-top: 1px solid var(--border); }
.faq-editor-item { margin-bottom: 1.5rem; padding: 1.5rem; background: var(--glass); border: 1px solid var(--border); border-radius: 18px; }

.admin-sidebar { 
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex; 
  flex-direction: column; 
  height: 100%;
  overflow: hidden; 
  padding: 0; 
}
.library-head { padding: 2rem; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
.library-list { flex: 1; overflow-y: auto; padding: 1rem; display: grid; gap: 1rem; }

.library-item {
  padding: 1.25rem;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.library-item:hover { background: var(--glass-hover); border-color: var(--primary); }
.library-item.is-active { 
  background: rgba(139, 92, 246, 0.08); 
  border-color: var(--primary); 
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15), inset 0 0 10px rgba(139, 92, 246, 0.05); 
}

.library-title { font-weight: 700; font-size: 1rem; display: block; margin-bottom: 0.75rem; line-height: 1.3; }
.library-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1rem; }

.status-pill { padding: 0.2rem 0.6rem; border-radius: 100px; font-weight: 700; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; }
.status-pill.is-published { background: rgba(16, 185, 129, 0.1); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.2); box-shadow: 0 0 10px rgba(16, 185, 129, 0.1); }
.status-pill.is-draft { background: rgba(245, 158, 11, 0.1); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.2); }

.library-actions { display: flex; gap: 0.5rem; }
.library-actions form { flex: 1; }
.library-actions .btn { width: 100%; justify-content: center; }

.notice { padding: 1.5rem 2rem; background: rgba(139, 92, 246, 0.1); border: 1px solid var(--primary); border-radius: 18px; color: #fff; margin-bottom: 2rem; font-weight: 600; }

/* Sidebar */
.article-sidebar { display: grid; gap: 2.5rem; position: sticky; top: 6rem; }
.sidebar-panel { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 28px; padding: 2rem; transition: transform 0.3s ease; }
.sidebar-title { font-size: 1.25rem; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.75rem; color: var(--text-main); }
.sidebar-title-icon { width: 4px; height: 24px; background: var(--primary); border-radius: 999px; box-shadow: 0 0 10px var(--primary-glow); }

.sidebar-featured-list { display: grid; gap: 1.5rem; margin-bottom: 2rem; }
.sidebar-featured-item { display: grid; grid-template-columns: 80px 1fr; gap: 1.25rem; align-items: center; padding: 0.75rem; border-radius: 18px; transition: all 0.2s ease; }
.sidebar-featured-item:hover { background: var(--glass); transform: translateX(4px); }
.sidebar-featured-item.no-thumb { grid-template-columns: 1fr; padding-left: 1.25rem; border-left: 3px solid var(--border); }
.sidebar-featured-item.no-thumb:hover { border-left-color: var(--primary); }

.sidebar-featured-thumb { width: 80px; height: 80px; border-radius: 14px; object-fit: cover; background: var(--bg-soft); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); }
.sidebar-featured-link { font-weight: 600; font-size: 0.95rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 0.4rem; color: var(--text-main); }
.sidebar-featured-link:hover { color: var(--primary); }

.sidebar-featured-copy .muted { font-size: 0.8rem; font-weight: 500; display: block; }

.sidebar-cta { background: linear-gradient(135deg, #7C3AED 0%, #C026D3 100%), url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2v-4h4v-2H6zM36 4V0h-2v4h-4v2h4v4h2v-4h4v-2h-4z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); color: #fff; border: none; box-shadow: 0 10px 30px rgba(124, 58, 237, 0.3); }
.sidebar-cta p { color: rgba(255, 255, 255, 0.9); margin-bottom: 1.5rem; font-size: 0.95rem; }
.sidebar-cta-button { display: block; width: 100%; padding: 1rem; background: #fff; color: #7C3AED; text-align: center; border-radius: 16px; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; }
.sidebar-cta-button:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.tag { padding: 0.6rem 1.1rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 100px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); transition: all 0.2s ease; }
.tag:hover { border-color: var(--primary); color: var(--text-main); background: var(--glass); box-shadow: 0 0 15px var(--primary-glow); }

/* Public FAQ Styles */
.article-faq-section { margin-top: 5rem; padding-top: 4rem; border-top: 1px solid var(--border); }
.faq-list-grid { display: grid; gap: 1.25rem; }

.faq-accordion {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-accordion:hover { border-color: var(--primary-glow); background: var(--glass); }
.faq-accordion[open] { border-color: var(--primary); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4); background: var(--bg-soft); }

.faq-accordion summary {
  padding: 1.5rem 2rem;
  font-weight: 700;
  font-size: 1.15rem;
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  color: var(--text-main);
}

.faq-accordion summary::-webkit-details-marker { display: none; }

.faq-summary-text { flex: 1; margin-right: 1.5rem; line-height: 1.4; transition: transform 0.3s ease; }
.faq-accordion[open] .faq-summary-text { color: var(--primary); }

.faq-summary-icon {
  width: 24px;
  height: 24px;
  position: relative;
  flex: 0 0 auto;
}

.faq-summary-icon::before,
.faq-summary-icon::after {
  content: "";
  position: absolute;
  background: var(--text-muted);
  border-radius: 999px;
  transition: all 0.3s ease;
}

/* Vertical line */
.faq-summary-icon::before { width: 2px; height: 100%; left: 50%; top: 0; transform: translateX(-50%); }
/* Horizontal line */
.faq-summary-icon::after { width: 100%; height: 2px; top: 50%; left: 0; transform: translateY(-50%); }

.faq-accordion:hover .faq-summary-icon::before,
.faq-accordion:hover .faq-summary-icon::after { background: var(--primary); }

.faq-accordion[open] .faq-summary-icon::before { transform: translateX(-50%) rotate(90deg); opacity: 0; }
.faq-accordion[open] .faq-summary-icon::after { background: var(--primary); transform: translateY(-50%) rotate(180deg); }

.faq-accordion-body {
  padding: 0 2rem 2rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Strategy */
@media (max-width: 1200px) {
  .admin-body { height: auto; overflow: auto; }
  .admin-viewport { grid-template-columns: 1fr; }
  .admin-sidebar { border-left: none; border-top: 1px solid var(--border); height: auto; }
  .library-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .admin-hero .toolbar { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
  .admin-hero .section-copy { margin: 0 auto 2rem; }
  .actions { justify-content: center; }
  
  /* Public Article Adjustments */
  .article-shell { grid-template-columns: 1fr; gap: 3rem; }
  .page { padding: 2rem 1rem; }
  .hero h1 { font-size: 3rem; }
  .blog-list-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .editor-master-layout { grid-template-columns: 1fr; }
  .meta-zone-grid { grid-template-columns: 1fr; }
  .meta-field-stack, .meta-meta-stack { gap: 1.5rem; }
  .meta-desc-zone textarea { height: 200px !important; }
  
  .article-title { font-size: 2.75rem; }
  .article-banner { border-radius: 20px; margin: 2rem 0; }
  .article-author-row { width: fit-content; justify-content: flex-start; padding: 1.25rem 1.75rem; }
}

@media (max-width: 600px) {
  .admin-hero { padding: 3rem 2rem; }
  .admin-editor { padding: 1.5rem; }
  .editor-grid { grid-template-columns: 1fr; }
  .image-grid { grid-template-columns: 1fr; }
  .section-heading { font-size: 1.75rem; }
  .admin-tools-grid { grid-template-columns: 1fr; }
  .actions button { font-size: 1rem; padding: 1.25rem; }
}
