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

:root {
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --c-bg: #fafaf8;
  --c-surface: #ffffff;
  --c-text: #1a1a1a;
  --c-text-secondary: #5a5a5a;
  --c-text-muted: #8a8a8a;
  --c-border: #e5e5e0;
  --c-border-light: #f0f0eb;
  --c-primary: #0f4c3a;
  --c-primary-light: #e8f5f0;
  --c-accent: #c5705d;
  --c-accent-light: #fdf0ed;
  --c-success: #22863a;
  --c-warning: #b08800;
  --c-error: #cb2431;
  --c-draft: #e3a008;
  --c-draft-bg: #fef9e7;
  --c-published: #22863a;
  --c-published-bg: #e6f9ed;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-lg: 12px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
.app-content { flex: 1; }

/* ── HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border-light);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { align-items: center; gap: 1px; }
.logo-icon {
  width: 536px; height: 36px;
  background: var(--c-primary); color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.5px; color: var(--c-text);
}
.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav a {
  padding: 8px 16px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  color: var(--c-text-secondary); transition: all 0.2s;
}
.main-nav a:hover { color: var(--c-text); background: var(--c-border-light); }
.main-nav a.active { color: var(--c-primary); background: var(--c-primary-light); }
.nav-admin { margin-left: 8px; border: 1px solid var(--c-border); }

/* ── HERO ── */
.hero-section {
  background: linear-gradient(135deg, var(--c-primary) 0%, #0a3529 100%);
  color: #fff; padding: 80px 24px; text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px); font-weight: 700;
  letter-spacing: -1px; margin-bottom: 16px;
}
.hero-subtitle { font-size: 18px; font-weight: 300; opacity: 0.85; line-height: 1.7; }

/* ── PAGE HEADER ── */
.page-header {
  padding: 56px 24px 40px; text-align: center;
  border-bottom: 1px solid var(--c-border-light);
}
.page-header h1 { font-family: var(--font-display); font-size: 36px; font-weight: 700; margin-bottom: 8px; }
.page-header p { font-size: 16px; color: var(--c-text-secondary); }

/* ── CONTENT SECTION ── */
.content-section { max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; }

/* ── CATEGORY FILTER ── */
.category-filter {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 40px; padding-bottom: 24px;
  border-bottom: 1px solid var(--c-border-light);
}
.category-filter .filter-btn {
  padding: 8px 18px; border: 1px solid var(--c-border);
  border-radius: 24px; background: var(--c-surface);
  font-size: 13px; font-weight: 500;
  color: var(--c-text-secondary); cursor: pointer; transition: all 0.2s;
  display: inline-block;
}
.category-filter .filter-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.category-filter .filter-btn.active {
  background: var(--c-primary); border-color: var(--c-primary); color: #fff;
}

/* ── POST CARDS ── */
.posts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 32px;
}
.post-card {
  display: flex; flex-direction: column;
  background: var(--c-surface); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.post-card-image { position: relative; height: 220px; overflow: hidden; }
.post-card-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.post-card:hover .post-card-image img { transform: scale(1.05); }
.post-card-badge {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,0.7); color: #fff;
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.post-card-body { padding: 20px 24px 24px; flex: 1; display: flex; flex-direction: column; }
.post-card-category {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--c-accent); margin-bottom: 8px;
}
.post-card-title {
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
  line-height: 1.3; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-excerpt {
  font-size: 14px; color: var(--c-text-secondary); line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; flex: 1;
}
.post-card-meta {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--c-text-muted);
  border-top: 1px solid var(--c-border-light); padding-top: 12px;
}

/* ── FEATURED CARD ── */
.featured-section { margin-bottom: 48px; }
.post-card.featured { flex-direction: row; min-height: 360px; }
.post-card.featured .post-card-image { width: 55%; height: auto; min-height: 360px; }
.post-card.featured .post-card-body { width: 45%; padding: 32px; justify-content: center; }
.post-card.featured .post-card-title { font-size: 28px; }
.post-card.featured .post-card-excerpt { -webkit-line-clamp: 4; }

/* ── POST DETAIL ── */
.post-detail-header { position: relative; height: 480px; overflow: hidden; }
.post-detail-cover { width: 100%; height: 100%; object-fit: cover; }
.post-detail-header-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
  display: flex; align-items: flex-end;
}
.post-detail-header-content {
  max-width: 800px; margin: 0 auto; padding: 48px 24px; width: 100%; color: #fff;
}
.post-detail-category {
  display: inline-block; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  background: var(--c-accent); color: #fff;
  padding: 4px 14px; border-radius: 20px; margin-bottom: 16px;
}
.post-detail-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px); font-weight: 700;
  line-height: 1.2; margin-bottom: 16px;
}
.post-detail-meta { display: flex; align-items: center; gap: 8px; font-size: 14px; opacity: 0.85; }
.meta-dot { opacity: 0.5; }
.vlog-badge {
  background: rgba(255,255,255,0.2); padding: 2px 10px;
  border-radius: 12px; font-size: 12px; font-weight: 600;
}

.post-detail-body { max-width: 760px; margin: 0 auto; padding: 48px 24px 80px; }
.post-detail-excerpt {
  font-size: 20px; font-weight: 300; line-height: 1.7;
  color: var(--c-text-secondary); margin-bottom: 32px;
  padding-bottom: 32px; border-bottom: 1px solid var(--c-border);
}
.post-detail-content { font-size: 17px; line-height: 1.8; color: var(--c-text); }
.post-detail-content h2 { font-family: var(--font-display); font-size: 28px; margin: 40px 0 16px; }
.post-detail-content h3 { font-family: var(--font-display); font-size: 22px; margin: 32px 0 12px; }
.post-detail-content p { margin-bottom: 20px; }

.video-embed {
  position: relative; padding-bottom: 56.25%; height: 0;
  margin-bottom: 40px; border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-md);
}
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

.post-detail-footer { max-width: 760px; margin: 0 auto; padding: 0 24px 60px; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border: 1px solid var(--c-border);
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  color: var(--c-text-secondary); transition: all 0.2s;
}
.back-link:hover { border-color: var(--c-primary); color: var(--c-primary); }

/* ── ADMIN ── */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }
.admin-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 32px;
}
.admin-header h1 { font-family: var(--font-display); font-size: 32px; font-weight: 700; }
.admin-subtitle { font-size: 14px; color: var(--c-text-muted); margin-top: 4px; }

.admin-table-wrap {
  background: var(--c-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; padding: 14px 16px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--c-text-muted); background: var(--c-border-light);
  border-bottom: 1px solid var(--c-border);
}
.admin-table td {
  padding: 16px; font-size: 14px;
  border-bottom: 1px solid var(--c-border-light); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafaf8; }

.td-title { min-width: 220px; }
.post-title-cell { display: block; font-weight: 500; color: var(--c-text); }
.post-author-cell { display: block; font-size: 12px; color: var(--c-text-muted); margin-top: 2px; }
.td-date { white-space: nowrap; color: var(--c-text-muted); }
.td-actions { white-space: nowrap; }

.type-badge, .status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.type-badge.article { background: #eef3ff; color: #2563eb; }
.type-badge.vlog { background: #fdf0ed; color: var(--c-accent); }
.status-badge.draft { background: var(--c-draft-bg); color: var(--c-draft); }
.status-badge.published { background: var(--c-published-bg); color: var(--c-published); }

.btn-icon {
  background: none; border: 1px solid var(--c-border);
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500;
  cursor: pointer; margin-right: 6px; transition: all 0.15s;
  display: inline-block;
}
.btn-edit { color: var(--c-primary); }
.btn-edit:hover { background: var(--c-primary-light); border-color: var(--c-primary); }
.btn-view { color: var(--c-text-secondary); }
.btn-view:hover { background: var(--c-border-light); }
.btn-delete { color: var(--c-error); }
.btn-delete:hover { background: #fdeaea; border-color: var(--c-error); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 24px;
}
.alert-success { background: var(--c-published-bg); color: var(--c-success); }
.alert-error { background: #fdeaea; color: var(--c-error); }

/* ── FORM ── */
.post-form {
  background: var(--c-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 32px;
}
.form-error {
  background: #fdeaea; color: var(--c-error);
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; margin-bottom: 24px;
}
.form-error:empty { display: none; }
.field-error { color: var(--c-error); font-size: 12px; margin-top: 4px; display: block; }
.field-error:empty { display: none; }
.form-row { margin-bottom: 20px; }
.form-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--c-text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.label-hint {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--c-text-muted); font-size: 12px; margin-left: 8px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  font-size: 15px; font-family: var(--font-body);
  color: var(--c-text); background: var(--c-bg); transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 58, 0.1);
}
.form-group textarea { resize: vertical; line-height: 1.6; }

.image-preview {
  margin-bottom: 20px; border-radius: var(--radius);
  overflow: hidden; max-height: 300px; background: var(--c-border-light);
}
.image-preview img { width: 100%; max-height: 300px; object-fit: cover; }

.form-actions {
  display: flex; justify-content: flex-end; gap: 12px;
  padding-top: 24px; border-top: 1px solid var(--c-border-light);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #0d3f30; }
.btn-secondary {
  background: var(--c-surface); color: var(--c-text-secondary);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: var(--c-border-light); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 80px 24px; color: var(--c-text-secondary); }
.empty-state h2 {
  font-family: var(--font-display); font-size: 24px;
  margin-bottom: 8px; color: var(--c-text);
}
.empty-state p { margin-bottom: 24px; }

/* ── FOOTER ── */
.site-footer { background: var(--c-text); color: rgba(255,255,255,0.7); padding: 48px 24px; }
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand .logo-icon {
  background: rgba(255,255,255,0.15); font-size: 16px; width: 32px; height: 32px;
}
.footer-brand .logo-text { color: #fff; font-size: 18px; }
.footer-tagline { font-size: 13px; margin-left: 16px; }
.footer-copy { font-size: 13px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .main-nav { gap: 4px; }
  .main-nav a { padding: 6px 10px; font-size: 13px; }
  .hero-section { padding: 56px 16px; }
  .content-section { padding: 24px 16px 60px; }
  .posts-grid { grid-template-columns: 1fr; gap: 24px; }
  .post-card.featured { flex-direction: column; }
  .post-card.featured .post-card-image { width: 100%; min-height: 240px; }
  .post-card.featured .post-card-body { width: 100%; padding: 20px 24px 24px; }
  .post-card.featured .post-card-title { font-size: 22px; }
  .post-detail-header { height: 320px; }
  .post-detail-body { padding: 32px 16px 60px; }
  .admin-page { padding: 24px 16px 60px; }
  .admin-header { flex-direction: column; gap: 16px; }
  .form-row-2col { grid-template-columns: 1fr; }
  .post-form { padding: 20px; }
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
  .footer-brand { flex-direction: column; }
  .footer-tagline { margin-left: 0; }
}
@media (max-width: 480px) {
  .main-nav a { padding: 6px 8px; font-size: 12px; }
  .nav-admin { margin-left: 0; }
}

/* ── NAV LOGOUT ── */
.nav-logout-form { display: inline; margin: 0; padding: 0; }
.nav-logout {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--c-text-secondary); padding: 6px 12px;
  transition: color 0.2s;
}
.nav-logout:hover { color: var(--c-error); }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 70vh; display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); padding: 48px 40px;
  box-shadow: var(--shadow-md);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header .logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--c-primary); color: #fff;
  font-family: var(--font-display); font-size: 24px; font-weight: 700;
  margin-bottom: 16px;
}
.login-header h1 {
  font-family: var(--font-display); font-size: 24px;
  font-weight: 700; color: var(--c-text); margin-bottom: 4px;
}
.login-header p { color: var(--c-text-muted); font-size: 14px; }

.login-card .form-group { margin-bottom: 20px; }
.login-card label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--c-text); margin-bottom: 6px;
}
.login-card .form-control {
  width: 100%; padding: 10px 14px; font-size: 15px;
  font-family: var(--font-body); border: 1px solid var(--c-border);
  border-radius: var(--radius); background: var(--c-bg);
  color: var(--c-text); transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card .form-control:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}
.login-card .form-control::placeholder { color: var(--c-text-muted); }
.login-card .field-error { display: block; font-size: 12px; color: var(--c-error); margin-top: 4px; }

.form-check { margin-bottom: 24px; }
.check-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--c-text-secondary); cursor: pointer;
}
.check-label input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--c-primary);
}

.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

.login-card .alert-error {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--c-error);
  padding: 12px 16px; border-radius: var(--radius); font-size: 14px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px; }
}
