/* ===== MoMot Blog - Main Stylesheet ===== */
:root {
  --deep-blue: #1a2a6c;
  --deep-blue-light: #243a8a;
  --deep-blue-dark: #0f1d50;
  --gold: #c9a84c;
  --gold-light: #d9be6e;
  --bg: #f8f7f4;
  --card-bg: #ffffff;
  --text: #2c2c2c;
  --text-muted: #777;
  --border: #e8e4dd;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --radius: 10px;
  --max-width: 960px;
  --nav-height: 64px;
}

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

body {
  font-family: "Georgia", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
}

a { color: var(--deep-blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold); }

.loading-text {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 15px;
}

/* ===== Navbar ===== */
.navbar {
  position: sticky; top:0; z-index:100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--deep-blue);
}
.nav-logo {
  width: 40px; height: 40px;
  background: #fff;
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.nav-logo-text {
  font-family: "Georgia", serif;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  color: var(--deep-blue);
  position: relative;
}
.nav-logo-text .tm-top {
  color: var(--deep-blue);
  letter-spacing: -1px;
}
.nav-logo-text .tm-gold {
  color: var(--gold);
  position: absolute;
  top: 3px;
  left: 3px;
}
.nav-site-name {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--deep-blue);
}
.nav-links { display:flex; gap:28px; list-style:none; }
.nav-links a {
  font-size: 15px;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--deep-blue);
  border-bottom-color: var(--gold);
}

/* Mobile nav toggle */
.nav-toggle { display:none; background:none; border:none; cursor:pointer; padding:8px; }
.nav-toggle span {
  display:block; width:22px; height:2px;
  background:var(--deep-blue); margin:5px 0;
  transition: all 0.3s;
}

/* ===== Main Content ===== */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ===== Hero / Intro ===== */
.hero {
  text-align: center;
  padding: 48px 20px 36px;
}
.hero h1 {
  font-size: 36px;
  color: var(--deep-blue);
  margin-bottom: 8px;
  letter-spacing: 2px;
}
.hero p {
  color: var(--text-muted);
  font-size: 16px;
}

/* ===== Post Cards ===== */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 8px;
}
.post-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
}
.post-card-img {
  height: 180px;
  background: linear-gradient(135deg, var(--deep-blue) 0%, #2a4a9c 50%, var(--gold) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.post-card-img span {
  font-size: 40px;
  color: rgba(255,255,255,0.7);
}
.post-card-body { padding: 20px; }
.post-card-body h3 {
  font-size: 18px;
  margin-bottom: 6px;
}
.post-card-body h3 a { color: var(--deep-blue); }
.post-card-body h3 a:hover { color: var(--gold); }
.post-card-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.post-card-excerpt {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}
.post-card-tags { margin-top: 12px; }
.post-card-tags span {
  display: inline-block;
  background: #f0ece4;
  color: var(--deep-blue);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  margin-right: 6px;
}

/* ===== Sidebar / About snippet ===== */
.about-snippet {
  margin-top: 60px;
  padding: 36px 24px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.about-snippet h2 {
  font-size: 22px;
  color: var(--deep-blue);
  margin-bottom: 12px;
}
.about-snippet p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  font-size: 15px;
}
.about-snippet .btn {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 28px;
  background: var(--deep-blue);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.2s;
}
.about-snippet .btn:hover {
  background: var(--gold);
  color: #fff;
}

/* ===== Single Post Page ===== */
.post-header {
  text-align: center;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.post-header h1 {
  font-size: 30px;
  color: var(--deep-blue);
  margin-bottom: 8px;
}
.post-header .post-meta {
  color: var(--text-muted);
  font-size: 14px;
}
.post-content {
  font-size: 16px;
  line-height: 2;
}
.post-content h1 {
  font-size: 26px;
  color: var(--deep-blue);
  margin: 36px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gold);
}
.post-content h2 {
  font-size: 22px;
  color: var(--deep-blue);
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gold);
}
.post-content h3 {
  font-size: 18px;
  color: var(--deep-blue);
  margin: 24px 0 8px;
}
.post-content p { margin-bottom: 16px; }
.post-content ul, .post-content ol {
  margin: 12px 0 16px 24px;
}
.post-content li { margin-bottom: 6px; }
.post-content blockquote {
  border-left: 3px solid var(--gold);
  padding: 8px 16px;
  margin: 20px 0;
  background: #faf9f6;
  color: #666;
  font-style: italic;
}
.post-content code {
  background: #f0ece4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}
.post-content pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.5;
}
.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.post-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
}
.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.post-footer a {
  display: inline-block;
  padding: 10px 28px;
  background: var(--deep-blue);
  color: #fff;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.2s;
}
.post-footer a:hover { background: var(--gold); color:#fff; }

/* ===== About Page ===== */
.about-page { max-width: 700px; margin: 0 auto; padding: 40px 0; }
.about-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--deep-blue) 0%, var(--gold) 100%);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #fff;
}
.about-page h1 {
  text-align: center;
  font-size: 28px;
  color: var(--deep-blue);
  margin-bottom: 8px;
}
.about-page .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 36px;
}
.about-page h2 {
  font-size: 20px;
  color: var(--deep-blue);
  margin: 28px 0 12px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--gold);
}
.about-page p { margin-bottom: 14px; font-size: 15px; }
.about-page ul { margin: 8px 0 16px 20px; }
.about-page li { margin-bottom: 6px; font-size: 15px; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 28px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 40px;
}
.pagination a, .pagination span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--card-bg);
}
.pagination a:hover { border-color: var(--gold); color: var(--gold); }
.pagination .current {
  background: var(--deep-blue);
  color: #fff;
  border-color: var(--deep-blue);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--deep-blue) 0%, #2a4a9c 50%, var(--deep-blue-dark) 100%);
}
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  text-align: center;
}
.login-header {
  margin-bottom: 28px;
}
.login-header .nav-logo {
  margin: 0 auto 16px;
  width: 56px;
  height: 56px;
  border-width: 3px;
}
.login-header .nav-logo-text {
  font-size: 20px;
}
.login-header h1 {
  font-size: 22px;
  color: var(--deep-blue);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.login-header p {
  color: var(--text-muted);
  font-size: 14px;
}
.login-form .form-group {
  margin-bottom: 16px;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #faf9f6;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
.login-error {
  color: #d44;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px;
  background: #fef0f0;
  border-radius: 6px;
}
.btn-login {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  font-weight: bold;
  background: var(--deep-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 1px;
}
.btn-login:hover {
  background: var(--gold);
}
.login-back {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-back:hover { color: var(--gold); }

/* ============================================================
   ADMIN PAGE
   ============================================================ */
.admin-page {
  background: #f0efe9;
}
.admin-navbar {
  background: var(--deep-blue) !important;
  border-bottom: 2px solid var(--gold) !important;
}
.admin-navbar .nav-site-name,
.admin-navbar .nav-brand {
  color: #fff !important;
}
.admin-navbar .nav-logo {
  border-color: var(--gold);
  background: transparent;
}
.admin-navbar .nav-logo-text {
  color: #fff !important;
}
.admin-navbar .nav-logo-text .tm-top {
  color: var(--gold) !important;
}

.btn-logout {
  padding: 6px 20px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.1);
  border-color: #fff;
}

.admin-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.admin-tab {
  flex: 1;
  padding: 12px 20px;
  font-size: 15px;
  font-family: inherit;
  font-weight: bold;
  background: var(--card-bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.admin-tab:first-child { border-radius: 8px 0 0 8px; }
.admin-tab:last-child { border-radius: 0 8px 8px 0; }
.admin-tab.active {
  background: var(--deep-blue);
  color: #fff;
  border-color: var(--deep-blue);
}
.admin-tab:hover:not(.active) {
  background: #f0ece4;
}

/* Status */
.status-msg {
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  text-align: center;
}
.status-msg.success {
  background: #e6f4ea;
  color: #1b7a30;
  border: 1px solid #b7dfc4;
}
.status-msg.error {
  background: #fef0f0;
  color: #c0392b;
  border: 1px solid #f5c6cb;
}

/* Admin Panel */
.admin-panel {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
}

/* Form */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--deep-blue);
  margin-bottom: 6px;
}
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-family: "Consolas", "Courier New", "Noto Sans SC", monospace;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  resize: vertical;
  min-height: 400px;
  line-height: 1.7;
  background: #faf9f6;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.editor-toolbar label {
  margin-bottom: 0;
}
.toolbar-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-insert-image {
  padding: 4px 14px;
  font-size: 13px;
  font-family: inherit;
  background: #f0ece4;
  color: var(--deep-blue);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-insert-image:hover {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-preview-toggle {
  padding: 4px 16px;
  font-size: 13px;
  font-family: inherit;
  background: #f0ece4;
  color: var(--deep-blue);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-preview-toggle:hover {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}

.post-preview {
  min-height: 400px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fdfcf9;
  overflow-y: auto;
}

.btn-publish {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  font-weight: bold;
  background: var(--deep-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 1px;
}
.btn-publish:hover {
  background: var(--gold);
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 12px 16px;
  background: #f5f2eb;
  color: var(--deep-blue);
  font-weight: bold;
  border-bottom: 2px solid var(--border);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.admin-table tr:hover td {
  background: #fdfcf9;
}
.admin-table .actions {
  white-space: nowrap;
}
.admin-table .btn-edit {
  padding: 4px 14px;
  font-size: 12px;
  font-family: inherit;
  background: var(--deep-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 6px;
  transition: background 0.2s;
}
.admin-table .btn-edit:hover { background: var(--gold); }
.admin-table .btn-del {
  padding: 4px 14px;
  font-size: 12px;
  font-family: inherit;
  background: transparent;
  color: #c0392b;
  border: 1px solid #e0b4b4;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.admin-table .btn-del:hover {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}
.admin-table .loading-text {
  padding: 32px 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .post-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .nav-links {
    display: none;
    position: absolute; top: var(--nav-height);
    left: 0; right: 0;
    background: #fff;
    flex-direction: column;
    padding: 12px 20px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .post-header h1 { font-size: 24px; }
  .about-page { padding: 20px; }

  .admin-layout { padding: 16px 12px 40px; }
  .admin-panel { padding: 20px 16px; }
  .admin-table { font-size: 13px; }
  .admin-table th, .admin-table td { padding: 10px 8px; }
  .form-textarea { min-height: 280px; }
  .login-card { padding: 28px 20px; }
}
