/* Site Variable Tokens */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #16a34a;
  --nav: #0f172a;
  --navText: #e5e7eb;
  --shadow: 0 10px 30px rgba(0, 0, 0, .08);
  --radius: 0px;
  --max: 480px;
}

/* Admin Override */
.admin-body {
  --max: 100%;
}

/* Global Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

a {
  color: #0310ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Layout */
#outer-wrapper {
  max-width: var(--max);
  margin: 0px auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.top-link {
  margin-top: 30px;
  margin-left: auto;
  margin-right: auto;
  max-width: 400px;
  min-height: 250px;
}

/* Header */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.brandbox {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eaf7ee;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-weight: 800;
  flex: 0 0 auto;
}

.brand-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title strong {
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Navigation */
.topnav {
  background: var(--nav);
  padding: 4px;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  color: var(--navText);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, .08);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .06);
  color: var(--navText);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

/* Content Container */
.contbox {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 2%;
  padding-top: 0px;
}

/* Headings */
h3 {
  margin: 0px;
}

/* Article */
.post-title {
  font-size: 28px;
  line-height: 1.25;
  margin: 0px;
  letter-spacing: -0.02em;
  margin-top: 30px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: #fafafa;
  border-radius: 999px;
  padding: 6px 10px;
}

.meta-chip .cat-text {
  color: #111827;
  font-weight: 800;
}

.main-post {
  font-size: 16px;
  line-height: 1.8;
  margin-top: 20px;
}

.main-post p {
  margin: 0 0 14px;
}

.main-post h2 {
  margin: 26px 0 10px;
  font-size: 22px;
  line-height: 1.35;
}

.main-post blockquote {
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--brand);
  background: #f0fdf4;
  border-radius: 10px;
  color: #14532d;
  font-style: italic;
}

/* Advertisement Blocks */
.ad-label {
  text-align: center;
  font-size: 12px;
  color: #999999;
  margin-bottom: 5px;
  margin-top: 0px;
  font-family: Arial, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ad-wrapper {
  text-align: center;
}

.ad-slot-default {
  min-width: 300px;
  min-height: 250px;
}

/* Next Banner (next_banner.php replacement) */
.next-banner {
  display: block;
  color: #0310ff !important;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.next-banner:hover {
  text-decoration: underline;
}

.next-banner h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: inherit;
}

.next-banner p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: inherit;
}

/* Related Article */
.related-article {
  margin: 20px 0;
}

/* Sidebar Widgets */
.sidebar {
  margin-top: 20px;
}

.widget {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  margin-bottom: 14px;
}

.widget .w-title {
  background: #f8fafc;
  padding: 10px 12px;
  font-weight: 900;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.widget .w-body {
  padding: 10px 12px;
}

.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}

.widget li:last-child {
  border-bottom: none;
}

.widget li a {
  color: #0f172a;
  font-weight: 700;
}

.widget li a:hover {
  color: var(--brand);
  text-decoration: none;
}

/* Footer */
.footer {
  background: var(--nav);
  color: var(--navText);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.footer a {
  color: var(--navText);
  opacity: .9;
  font-weight: 700;
}

.footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Responsive Media Queries */
@media (max-width:980px) {
  .contbox {
    grid-template-columns: 1fr;
  }
}

@media (max-width:720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin-top: 10px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
  }

  .post-title {
    font-size: 20px;
  }
}

/* --- Contact Form Styles --- */
.contact-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  padding: 20px 0;
}

.contact-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.contact-form-wrapper {
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  padding: 0 10px;
}

.form-textarea {
  width: 100%;
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: sans-serif;
  font-size: 14px;
  padding: 10px;
}

.btn-submit {
  width: 100%;
  height: 42px;
  border: none;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 42px;
  display: inline-block;
}

.btn-submit:hover {
  opacity: 0.9;
  text-decoration: none;
}

.success-alert {
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: 4px;
  height: 48px;
  line-height: 48px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
}

.spacer-y-16 {
  height: 16px;
}

/* --- Admin Panel Styles --- */
.admin-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  height: 50px;
}

.admin-header-row span {
  font-size: 18px;
  font-weight: 800;
}

.admin-logout-btn {
  color: #b91c1c;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.admin-logout-btn:hover {
  text-decoration: underline;
}

.admin-tabs-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.admin-tab-link {
  flex: 1;
  height: 38px;
  line-height: 38px;
  text-align: center;
  font-weight: 700;
  border-radius: 4px;
  font-size: 13px;
  text-decoration: none;
}

.admin-tab-link.active {
  background: var(--brand);
  color: #fff;
}

.admin-tab-link.inactive {
  background: #e5e7eb;
  color: var(--text);
}

.admin-tab-link.inactive:hover {
  background: #d1d5db;
  text-decoration: none;
}

.admin-status-message {
  border-radius: 4px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
}

.admin-status-error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fee2e2;
}

.admin-status-success {
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #dcfce7;
}

.admin-main-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.admin-card-spacer {
  height: 16px;
}

.admin-flex-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.admin-card-inner-width {
  width: 92%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border);
  height: 40px;
}

.admin-sub-header-title {
  font-weight: 700;
}

.admin-add-page-btn {
  background: var(--brand);
  color: white;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  height: 28px;
  line-height: 28px;
  width: 90px;
  text-align: center;
}

.admin-add-page-btn:hover {
  background: #15803d;
  text-decoration: none;
}

.admin-pages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.admin-page-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 48px;
  width: 100%;
}

.admin-page-spacer-x {
  width: 8px;
}

.admin-page-text-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.admin-page-title-text {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-page-meta-text {
  font-size: 11px;
  color: var(--muted);
}

.admin-page-actions-col {
  display: flex;
  gap: 8px;
}

.admin-edit-action {
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}

.admin-edit-action:hover {
  text-decoration: underline;
}

.admin-delete-action {
  color: #b91c1c;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
}

.admin-delete-action:hover {
  text-decoration: underline;
}

.admin-empty-state {
  color: var(--muted);
  text-align: center;
  height: 50px;
  line-height: 50px;
}

.admin-form-title-row {
  border-bottom: 1px dashed var(--border);
  height: 30px;
}

.admin-form-title-text {
  font-weight: 700;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.admin-form-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 10px;
  font-size: 13px;
}

.admin-form-textarea {
  width: 100%;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: sans-serif;
  font-size: 13px;
  padding: 8px 10px;
}

.admin-form-textarea-code {
  width: 100%;
  height: 180px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  padding: 10px;
}

.admin-form-textarea-med {
  width: 100%;
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  padding: 10px;
}

.admin-btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.admin-btn-save {
  flex: 1;
  height: 38px;
  border: none;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 38px;
  font-size: 13px;
}

.admin-btn-save:hover {
  background: #15803d;
}

.admin-btn-cancel {
  flex: 1;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  text-align: center;
  line-height: 38px;
  font-size: 13px;
  background: #fafafa;
}

.admin-btn-cancel:hover {
  background: #f3f4f6;
  text-decoration: none;
}

.admin-btn-submit-wide {
  width: 100%;
  height: 38px;
  border: none;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 38px;
  font-size: 13px;
}

.admin-btn-submit-wide:hover {
  background: #15803d;
}

.admin-spacer-bottom {
  height: 24px;
}

/* Content Only Layout */
.content-only-main {
  padding: 20px;
}

.content-only-title {
  margin-top: 10px;
}