/* =========================================
   VARIABEL TEMA BIRU LAUT (TERANG & GELAP)
   ========================================= */
:root,
[data-theme="light"] {
  --bg-page: #F4F8FB;
  --bg-surface: #FFFFFF;
  --bg-subtle: #E9F2F8;
  --text-primary: #102332;
  --text-secondary: #3A556A;
  --text-muted: #647F94;
  --accent: #0E6BA8;
  --accent-hover: #095180;
  --accent-soft: rgba(14, 107, 168, 0.08);
  --border: #D6E4EE;
  --danger: #B83232;
  --shadow-sm: 0 2px 10px rgba(16, 35, 50, 0.04);
  --shadow-lg: 0 18px 40px rgba(11, 22, 34, 0.16);
}

[data-theme="dark"] {
  --bg-page: #0B1622;
  --bg-surface: #112131;
  --bg-subtle: #162B40;
  --text-primary: #E8F1F8;
  --text-secondary: #B9CDE0;
  --text-muted: #7F9BB3;
  --accent: #38A3E8;
  --accent-hover: #62B8F0;
  --accent-soft: rgba(56, 163, 232, 0.12);
  --border: #1E3750;
  --danger: #E05A5A;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.5);
}

/* =========================================
   RESET & TIPOGRAFI DASAR
   ========================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 700px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================
   HEADER & NAVIGASI
   ========================================= */
.site-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 2.25rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.brand-group {
  cursor: pointer;
}

.site-title {
  margin: 0;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.site-tagline {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.site-nav {
  margin-top: 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  background: none;
  border: none;
  padding: 0.35rem 0;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.admin-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* =========================================
   TOMBOL & ELEMEN FORM
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1.05rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background-color: var(--accent-soft);
  color: var(--text-primary);
}

.btn-danger {
  background-color: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

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

.file-label {
  cursor: pointer;
  user-select: none;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.93rem;
  color: var(--text-primary);
  background-color: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-control-sm {
  padding: 0.42rem 0.7rem;
  font-size: 0.85rem;
}

/* =========================================
   DAFTAR TULISAN (BERANDA)
   ========================================= */
.main-content {
  flex: 1;
}

.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  padding: 1.65rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.post-item:first-child {
  padding-top: 0.25rem;
}

.post-item:last-child {
  border-bottom: none;
}

.post-item:hover .post-item-title {
  color: var(--accent);
}

.post-item-content {
  flex: 1;
  min-width: 0;
}

.post-item-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.post-item-title {
  margin: 0 0 0.5rem;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.38rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.post-item-excerpt {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-item-thumb {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
}

/* =========================================
   HALAMAN BACA (READER VIEW)
   ========================================= */
.reader-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.back-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  cursor: pointer;
}

.back-link:hover {
  text-decoration: underline;
}

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

.reader-article {
  max-width: 660px;
  margin: 0 auto;
}

.reader-header {
  margin-bottom: 1.75rem;
}

.reader-title {
  margin: 0 0 0.65rem;
  font-family: 'Lora', Georgia, serif;
  font-size: 2.05rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.reader-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.reader-cover {
  margin: 0 0 2rem;
}

.reader-cover img {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Tipografi Isi Bacaan & Kutipan Bergaris Biru Laut */
.reader-body {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.88;
  color: var(--text-primary);
  word-wrap: break-word;
}

.reader-body p {
  margin: 0 0 1.45rem;
}

.reader-body h2 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 600;
  margin: 2.2rem 0 0.9rem;
  line-height: 1.35;
  color: var(--text-primary);
}

.reader-body blockquote {
  margin: 1.75rem 0;
  padding: 0.35rem 0 0.35rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  font-style: italic;
  background-color: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}

.reader-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.25rem auto;
  width: 45%;
}

.reader-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.75rem auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.reader-pagination {
  max-width: 660px;
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.page-nav-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.page-nav-btn:hover {
  border-color: var(--accent);
}

.page-nav-btn.next {
  text-align: right;
}

.page-nav-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.page-nav-title {
  display: block;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================
   HALAMAN TENTANG & PENGATURAN ADMIN
   ========================================= */
.about-card {
  padding: 0.5rem 0 1.5rem;
}

.about-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.6rem;
  margin: 0 0 1rem;
}

.about-bio {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--text-secondary);
  white-space: pre-line;
}

.admin-settings {
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.settings-heading {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  color: var(--accent);
}

.settings-subheading {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.settings-desc {
  margin: 0 0 1.15rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* =========================================
   FOOTER & PEMICU RAHASIA
   ========================================= */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.secret-dot {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0 0.35rem;
  cursor: default;
  user-select: none;
}

/* =========================================
   MODAL & EDITOR TULISAN
   ========================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(8, 17, 26, 0.68);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-sm {
  max-width: 390px;
  padding: 1.5rem;
}

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

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

.modal-sm .modal-header {
  padding: 0 0 1rem;
  margin-bottom: 1rem;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.editor-header-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.mode-switch {
  display: inline-flex;
  background-color: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.mode-btn {
  background: none;
  border: none;
  padding: 0.3rem 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.mode-btn.active {
  background-color: var(--accent);
  color: #FFFFFF;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-primary);
}

.editor-pane {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
  flex: 1;
}

.title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
}

.title-input::placeholder {
  color: var(--text-muted);
}

.cover-uploader {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background-color: var(--bg-page);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.cover-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cover-controls .form-control-sm {
  flex: 1;
  min-width: 180px;
}

.cover-preview {
  margin-top: 0.75rem;
}

.cover-preview img {
  max-height: 180px;
  width: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  background-color: var(--bg-page);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.tool-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.83rem;
  padding: 0.32rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.rich-editor {
  min-height: 290px;
  padding: 1.15rem;
  background-color: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  font-family: 'Lora', Georgia, serif;
  font-size: 1.06rem;
  line-height: 1.82;
  color: var(--text-primary);
  outline: none;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}

.rich-editor p {
  margin: 0 0 1rem;
}

.rich-editor h2 {
  font-size: 1.35rem;
  margin: 1.5rem 0 0.75rem;
}

.rich-editor blockquote {
  margin: 1.25rem 0;
  padding: 0.3rem 0 0.3rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-secondary);
  font-style: italic;
  background-color: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}

.rich-editor hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem auto;
  width: 45%;
}

.rich-editor img {
  max-width: 100%;
  border-radius: 6px;
  margin: 1rem 0;
  display: block;
}

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

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
}

/* =========================================
   TOAST NOTIFIKASI
   ========================================= */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-primary);
  color: var(--bg-page);
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
}

/* =========================================
   RESPONSIF MOBILE
   ========================================= */
@media (max-width: 600px) {
  .app-shell {
    padding: 1.65rem 1rem 2.75rem;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .post-item {
    flex-direction: column-reverse;
    gap: 0.85rem;
  }

  .post-item-thumb {
    width: 100%;
    height: 185px;
  }

  .reader-title {
    font-size: 1.68rem;
  }

  .reader-body {
    font-size: 1.06rem;
  }

  .reader-pagination {
    grid-template-columns: 1fr;
  }
}
