/* =============================================================
   CLAWDIOT — Stylesheet
   "AI explained by an idiot, for idiots"
   Aesthetic inspired by NovelKeys: teal/cyan palette, cream
   backgrounds, bold rounded headlines, tactile card interactions,
   and glowing active states.
   ============================================================= */

/* -------------------------
   Google Fonts
   ------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* -------------------------
   CSS Variables
   ------------------------- */
:root {
  /* Primary — teal/cyan inspired by NovelKeys */
  --primary:        #0099db;
  --primary-dark:   #007ab3;
  --primary-deeper: #005f8a;
  --primary-light:  #e0f4fc;
  --primary-glow:   rgba(0, 153, 219, 0.35);

  /* Accent — gold/tan inspired by NovelKeys */
  --accent:         #c8a84a;
  --accent-dark:    #a88a35;
  --accent-light:   #fdf4dc;

  /* Neutrals */
  --dark:           #1a2332;
  --dark-green:     #3a6e6e;
  --gray:           #5a6a7a;
  --light-gray:     #eef1f4;
  --border:         #dde3ea;
  --cream:          #f4f7ec;   /* NovelKeys background */
  --white:          #ffffff;

  /* Feedback */
  --success:        #10b981;
  --danger:         #ef4444;

  /* Typography */
  --font-head: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tokens */
  --radius:    12px;
  --radius-lg: 18px;
  --shadow:    0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 32px rgba(0,0,0,0.13);
  --shadow-teal: 0 8px 28px rgba(0,153,219,0.18);
  --max-width: 1120px;
}

/* -------------------------
   Reset & Base
   ------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--dark);
  background: var(--cream);  /* cream background site-wide */
}

img  { max-width: 100%; display: block; }
a    { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  line-height: 1.2;
  color: var(--dark);
  letter-spacing: -0.3px;
}

/* -------------------------
   Layout
   ------------------------- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 28px; }

/* -------------------------
   Buttons
   ------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s ease;
  text-decoration: none; letter-spacing: 0.2px;
}
.btn:hover  { transform: translateY(-2px); text-decoration: none; }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary { background: var(--primary); color: var(--white); box-shadow: 0 4px 14px var(--primary-glow); }
.btn-primary:hover   { background: var(--primary-dark); box-shadow: 0 6px 20px var(--primary-glow); }

.btn-secondary { background: var(--white); color: var(--dark); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--light-gray); border-color: var(--primary); }

.btn-accent { background: var(--accent); color: var(--dark); font-weight: 700; }
.btn-accent:hover { background: var(--accent-dark); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 15px 32px; font-size: 16px; font-weight: 700; letter-spacing: 0.3px; }

.btn-generate {
  background: linear-gradient(135deg, var(--primary), var(--primary-deeper));
  color: var(--white); font-weight: 700;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-generate:hover { box-shadow: 0 6px 22px rgba(0,153,219,0.5); transform: translateY(-2px); }


/* =============================================================
   PUBLIC SITE
   ============================================================= */

/* -------------------------
   Header / Nav
   ------------------------- */
.site-header {
  background: var(--dark);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; max-width: var(--max-width); margin: 0 auto; height: 64px;
}

.nav-logo { display: flex; flex-direction: column; text-decoration: none; }
.nav-logo:hover { text-decoration: none; }
.nav-logo .logo-name {
  font-family: var(--font-head); font-size: 22px; font-weight: 900;
  color: var(--white); letter-spacing: -0.5px; line-height: 1.1;
}
.nav-logo .logo-name span { color: var(--accent); }
.nav-logo .logo-tagline { font-size: 10px; color: rgba(255,255,255,0.45); font-style: italic; letter-spacing: 0.2px; }

.nav-links { display: flex; align-items: center; gap: 32px; list-style: none; }
.nav-links a {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.65);
  text-transform: uppercase; letter-spacing: 0.8px;
  transition: color 0.2s; padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; border-bottom-color: var(--accent); }

/* -------------------------
   Hero
   ------------------------- */
.hero {
  background: linear-gradient(135deg, #0d1f2d 0%, #1a3a4a 40%, var(--dark-green) 100%);
  color: var(--white);
  padding: 96px 28px 88px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle noise texture overlay */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-block;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--accent); text-transform: uppercase; letter-spacing: 2px;
  background: rgba(200,168,74,0.12); border: 1px solid rgba(200,168,74,0.3);
  padding: 5px 14px; border-radius: 999px; margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(42px, 7vw, 80px);
  font-weight: 900; letter-spacing: -2px; line-height: 1;
  margin-bottom: 16px;
}
.hero-title span { color: var(--accent); }

.hero-motto {
  display: inline-block;
  font-size: clamp(13px, 2vw, 16px); font-style: italic;
  color: rgba(255,255,255,0.6); margin-bottom: 20px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 20px; border-radius: 999px;
  transform: rotate(-1deg);
}

.hero-desc {
  font-size: clamp(14px, 2vw, 17px);
  color: rgba(255,255,255,0.55);
  max-width: 540px; margin: 0 auto 36px; line-height: 1.8;
}

/* -------------------------
   Blog Section
   ------------------------- */
.blog-section {
  padding: 64px 28px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}

.section-title {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
}

/* Category Filter */
.category-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }

.filter-btn {
  padding: 7px 18px; border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--white); color: var(--gray);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  letter-spacing: 0.2px;
}
.filter-btn:hover {
  border-color: var(--primary); color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.filter-btn.active {
  background: var(--primary); color: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
}

/* Posts Grid */
.posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }

/* Post Card */
.post-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
}
.post-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-teal);
  border-color: rgba(0,153,219,0.2);
}
.post-card:active { transform: translateY(-2px) scale(0.99); }

.post-card-cover { width: 100%; height: 190px; object-fit: cover; transition: transform 0.4s ease; }
.post-card:hover .post-card-cover { transform: scale(1.04); }

.post-card-cover-placeholder {
  width: 100%; height: 190px;
  background: linear-gradient(135deg, #0d2a38 0%, var(--dark-green) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  transition: transform 0.4s ease;
}
.post-card:hover .post-card-cover-placeholder { transform: scale(1.04); }

.post-card-body { padding: 22px; flex: 1; display: flex; flex-direction: column; }

.category-badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-deeper);
  font-size: 11px; font-weight: 700; margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: 0.8px;
  font-family: var(--font-mono);
}

.post-card-title {
  font-size: 17px; font-weight: 800; margin-bottom: 10px;
  line-height: 1.35; color: var(--dark); letter-spacing: -0.2px;
}

.post-card-excerpt { font-size: 14px; color: var(--gray); line-height: 1.65; flex: 1; margin-bottom: 18px; }

.post-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--gray);
  border-top: 1px solid var(--border); padding-top: 14px;
  font-family: var(--font-mono);
}

.post-card a.read-more {
  font-size: 13px; font-weight: 700; color: var(--primary);
  font-family: var(--font-body); letter-spacing: 0.2px;
  transition: color 0.2s;
}
.post-card a.read-more:hover { color: var(--primary-deeper); text-decoration: none; }

/* -------------------------
   Single Post Page
   ------------------------- */
.post-page { max-width: 760px; margin: 0 auto; padding: 52px 28px 88px; }

.post-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--gray);
  margin-bottom: 36px; transition: color 0.2s;
  text-transform: uppercase; letter-spacing: 0.6px; font-family: var(--font-mono);
}
.post-back:hover { color: var(--primary); text-decoration: none; }

.post-header { margin-bottom: 36px; }

.post-title {
  font-size: clamp(26px, 4vw, 44px); font-weight: 900;
  margin: 12px 0 18px; line-height: 1.15; letter-spacing: -1px;
}

.post-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--gray);
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px;
}

.post-cover-img {
  width: 100%; border-radius: var(--radius-lg); margin-bottom: 44px;
  max-height: 420px; object-fit: cover;
  box-shadow: var(--shadow-lg);
}

/* Post Content */
.post-content h2 { font-size: 23px; font-weight: 800; margin: 36px 0 14px; letter-spacing: -0.4px; }
.post-content h3 { font-size: 19px; font-weight: 700; margin: 26px 0 10px; }
.post-content p  { margin-bottom: 20px; }
.post-content ul, .post-content ol { margin: 0 0 20px 26px; }
.post-content li { margin-bottom: 8px; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }
.post-content strong { color: var(--dark); font-weight: 700; }
.post-content em { color: var(--gray); }
.post-content blockquote {
  border-left: 4px solid var(--accent); padding: 14px 22px;
  background: var(--accent-light); border-radius: 0 10px 10px 0;
  margin: 28px 0; font-style: italic; color: var(--gray);
}

/* -------------------------
   Loading / Empty States
   ------------------------- */
.state-loading, .state-empty { text-align: center; padding: 64px 20px; color: var(--gray); }
.state-loading .spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------
   Footer
   ------------------------- */
.site-footer {
  background: var(--dark); color: rgba(255,255,255,0.45);
  text-align: center; padding: 48px 24px; font-size: 14px;
  border-top: 3px solid var(--accent);
}
.site-footer .footer-logo {
  font-family: var(--font-head); font-size: 22px; font-weight: 900;
  color: var(--white); margin-bottom: 6px; letter-spacing: -0.5px;
}
.site-footer .footer-logo span { color: var(--accent); }
.site-footer .footer-motto { font-style: italic; margin-bottom: 18px; font-size: 13px; }
.site-footer a { color: rgba(255,255,255,0.4); transition: color 0.2s; }
.site-footer a:hover { color: var(--accent); }


/* =============================================================
   ADMIN AREA
   ============================================================= */
body.admin-body { background: var(--light-gray); }

/* Login */
.admin-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d1f2d 0%, #1a3a4a 60%, var(--dark-green) 100%);
  padding: 24px;
}
.admin-login-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 52px 44px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); text-align: center;
  border-top: 4px solid var(--primary);
}
.admin-login-logo {
  font-family: var(--font-head); font-size: 30px; font-weight: 900;
  color: var(--dark); margin-bottom: 4px; letter-spacing: -1px;
}
.admin-login-logo span { color: var(--accent); }
.admin-login-sub { font-size: 13px; color: var(--gray); margin-bottom: 32px; }

/* Admin Layout */
.admin-layout  { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--dark); color: var(--white);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-wrap { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { font-family: var(--font-head); font-size: 18px; font-weight: 900; color: var(--white); letter-spacing: -0.5px; }
.sidebar-logo span { color: var(--accent); }
.sidebar-sub { font-size: 11px; color: rgba(255,255,255,0.35); font-style: italic; margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 20px;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.55);
  transition: all 0.2s; text-decoration: none;
  text-transform: uppercase; letter-spacing: 0.6px;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: var(--white); text-decoration: none; }
.sidebar-nav a.active { background: rgba(0,153,219,0.1); color: var(--white); border-left-color: var(--primary); box-shadow: inset 0 0 20px rgba(0,153,219,0.08); }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.admin-content { margin-left: 240px; flex: 1; padding: 36px 44px; min-height: 100vh; }

/* Admin Page Header */
.admin-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.admin-page-title  { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }

/* Cards */
.admin-card {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 24px;
  margin-bottom: 24px; box-shadow: var(--shadow);
}

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card  {
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 22px 26px;
  box-shadow: var(--shadow); transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-teal); border-color: rgba(0,153,219,0.2); }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--gray); margin-bottom: 8px; font-family: var(--font-mono); }
.stat-value { font-family: var(--font-head); font-size: 32px; font-weight: 900; color: var(--dark); letter-spacing: -1px; }

/* Table */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--gray);
  border-bottom: 2px solid var(--border); background: var(--cream);
  font-family: var(--font-mono);
}
.admin-table td { padding: 15px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fbfe; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-family: var(--font-mono); }
.badge-published { background: #d1fae5; color: #065f46; }
.badge-draft     { background: #fef3c7; color: #92400e; }
.badge-auto      { background: var(--primary-light); color: var(--primary-deeper); }

/* Action Group */
.action-group { display: flex; gap: 8px; align-items: center; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--dark); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; font-family: var(--font-mono); }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-family: var(--font-body); font-size: 14px;
  color: var(--dark); background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s; outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint  { font-size: 12px; color: var(--gray); margin-top: 4px; font-family: var(--font-mono); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* Quill Editor */
.ql-container { font-family: var(--font-body) !important; font-size: 15px !important; min-height: 340px; }
.ql-toolbar   { border-radius: 8px 8px 0 0 !important; border-color: var(--border) !important; background: var(--cream) !important; }
.ql-container.ql-snow { border-radius: 0 0 8px 8px !important; border-color: var(--border) !important; }

/* Alerts */
.alert { padding: 13px 18px; border-radius: 10px; font-size: 14px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: var(--primary-light); color: var(--primary-deeper); border: 1px solid rgba(0,153,219,0.3); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; backdrop-filter: blur(4px); }
.modal-overlay.hidden { display: none; }
.modal { background: var(--white); border-radius: var(--radius-lg); padding: 36px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); border-top: 4px solid var(--primary); }
.modal-title   { font-size: 20px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.4px; }
.modal-body    { font-size: 14px; color: var(--gray); margin-bottom: 28px; line-height: 1.7; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }


/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row  { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 24px 28px; }
}
@media (max-width: 768px) {
  .posts-grid { grid-template-columns: 1fr; }
  .nav-links  { display: none; }
  .admin-sidebar { width: 200px; }
  .admin-content { margin-left: 200px; }
}
@media (max-width: 600px) {
  .admin-layout  { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .admin-content { margin-left: 0; padding: 20px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .hero { padding: 56px 20px 48px; }
  .blog-section { padding: 40px 20px; }
}
