@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Playfair+Display:wght@700;900&family=Noto+Naskh+Arabic:wght@400;700&family=Inter:wght@400;600;700&display=swap');

:root {
  --ink: #0b1720;
  --ink-soft: #1a3a4d;
  --sky: #eaf5fc;
  --sky-2: #dcecf7;
  --blue: #1a5680;
  --blue-dark: #0a3a5c;
  --line: #b9dcee;
  --card-bg: #ffffff;
  --danger: #a3242e;
  --radius: 6px;
}

html {
  font-size: 112.5%; /* bumps all rem-based text site-wide one size up from the browser default */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: 'Inter', 'Noto Naskh Arabic', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.65;
}

html[dir="rtl"] body { font-family: 'Noto Naskh Arabic', 'Inter', sans-serif; }

h1, h2, h3, h4 {
  font-family: 'Playfair Display', 'Amiri', serif;
  color: var(--ink);
  font-weight: 900;
  margin: 0 0 .5em;
}
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4 {
  font-family: 'Amiri', 'Playfair Display', serif;
}

p, span, div, label, a, li, td, th, input, textarea, select, button {
  color: var(--ink);
  font-weight: 700;
}

a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Standalone header (used only if phpFox isn't found) */
.site-header { background: var(--blue-dark); border-bottom: 4px solid var(--blue); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 16px 20px;
}
.site-header .brand { color: #eaf5fc !important; }
.site-header .main-nav a { color: #eaf5fc !important; }

/* Slim bar used when embedded inside phpFox's own header/footer */
.fartan-bar { background: var(--blue-dark); border-bottom: 4px solid var(--blue); margin-bottom: 24px; }
.fartan-bar-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 14px 20px;
}
.fartan-bar .brand { color: #eaf5fc !important; font-family: 'Playfair Display', 'Amiri', serif; font-size: 1.08rem; font-weight: 900; }
.fartan-bar .main-nav a { color: #eaf5fc !important; }

.brand { font-family: 'Playfair Display', 'Amiri', serif; font-size: 1.14rem; font-weight: 900; }
.main-nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.main-nav a:not(.lang-switch) {
  font-weight: 700 !important; font-size: 0.84rem !important;
  border: 2px solid currentColor !important;
  padding: 6px 16px !important;
  border-radius: 20px !important;
  transition: background .15s ease;
  display: inline-block;
}
.main-nav a:not(.lang-switch):hover { text-decoration: none !important; background: rgba(255,255,255,.15); }
.lang-switch { border: 2px solid var(--blue) !important; padding: 4px 14px !important; border-radius: 20px !important; font-size: 0.84rem !important; display: inline-block; }

.main-content { padding: 0 20px 60px; min-height: 60vh; }
.site-header + .main-content, .site-header ~ main.main-content { padding-top: 32px; }

.site-footer { padding: 24px 20px; text-align: center; color: var(--ink-soft); border-top: 1px solid var(--line); }

/* Buttons */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: var(--radius);
  background: var(--blue); color: #ffffff !important; border: none;
  font-weight: 700; cursor: pointer; font-size: 1rem;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-danger { background: var(--danger); }
.btn-secondary { background: var(--ink-soft); }
.btn-small { padding: 5px 12px; font-size: .85rem; }

/* Forms */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--card-bg); font-size: 1rem; font-family: inherit;
}
textarea { min-height: 110px !important; resize: vertical !important; overflow: auto !important; }
form.inline { display: inline; }

.card {
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(10,58,92,.08);
}

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 700; }
.alert-ok { background: #dff3e6; border: 1px solid #4a9a6a; }
.alert-error { background: #fbe2e2; border: 1px solid var(--danger); }

/* Post feed */
.post-list { display: grid; gap: 20px; }
.post-card { display: flex; gap: 16px; }
.post-card .thumb {
  width: 120px; height: 120px; border-radius: var(--radius); object-fit: cover;
  border: 2px solid var(--line); flex-shrink: 0; background: #fff;
}
.post-card .meta { font-size: .9rem; color: var(--ink-soft); margin-bottom: 6px; }

/* Homepage grid: 3 articles per row */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.post-grid .post-card { flex-direction: column; }
.post-grid .post-card .thumb { width: 100%; height: 36px; }
.post-grid .post-card h2 { font-size: 1.2rem; }
@media (max-width: 900px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }

.pagination {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 30px 0;
}
.pagination a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 8px; border-radius: var(--radius);
  background: var(--card-bg); border: 2px solid var(--line); color: var(--ink) !important;
  font-weight: 700;
}
.pagination a:hover { border-color: var(--blue); text-decoration: none; }
.pagination a.active { background: var(--blue); border-color: var(--blue); color: #fff !important; }
.avatar-round {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; vertical-align: middle;
  border: 2px solid var(--blue); margin-inline-end: 8px;
}
.avatar-corner {
  width: 120px; height: 120px; border-radius: var(--radius); object-fit: cover;
  border: 2px solid var(--blue); flex-shrink: 0;
}
.post-author-block { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-author-block .name { font-size: 1.05rem; }
.avatar-large { width: 300px; height: 300px; border-radius: var(--radius); object-fit: cover; border: 3px solid var(--blue); }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.tabs a {
  padding: 8px 18px; border-radius: 8px 8px 0 0; background: var(--sky-2);
  border: 1px solid var(--line); border-bottom: none; color: var(--ink) !important;
}
.tabs a.active { background: var(--card-bg); border-bottom: 2px solid var(--card-bg); margin-bottom: -2px; }

.post-body { font-size: 1.15rem; white-space: pre-wrap; }

.post-cover-img { max-width: 60%; border-radius: 6px; margin-bottom: 16px; display: block; }
@media (max-width: 640px) { .post-cover-img { max-width: 100%; } }

table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }

.site-stats { color: var(--ink-soft); font-size: .95rem; margin: -6px 0 24px; }

.action-row {
  display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}

.fb-share {
  display: inline-flex; align-items: center; gap: 8px; background: #1877f2 !important;
  color: #fff !important; padding: 10px 18px; border-radius: var(--radius); font-weight: 700;
}
.fb-share:hover { background: #145dbf !important; }

.contact-box { margin-top: 30px; border-top: 2px dashed var(--line); padding-top: 20px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: .8rem; }
.badge-admin { background: var(--blue); color: #fff; }
.badge-user { background: var(--line); }
.badge-active { background: #4a9a6a; color: #fff; }
.badge-disabled { background: var(--danger); color: #fff; }

@media (max-width: 640px) {
  .post-card { flex-direction: column; }
  .post-card .thumb { width: 100%; height: 200px; }

  /* Keep the writing experience effortless on a phone: bigger text, full-width
     controls, no cramped side-by-side buttons. */
  .card { padding: 14px; }
  textarea { min-height: 110px !important; }
  .btn { display: block; width: 100%; text-align: center; margin: 8px 0 0; font-size: 1.05rem; padding: 14px 16px; }
  .btn + .btn { margin-inline-start: 0; }
  .main-nav { gap: 8px; }
  .main-nav a:not(.lang-switch) { font-size: 0.7rem !important; padding: 4px 10px !important; }
  .lang-switch { font-size: 0.7rem !important; padding: 3px 10px !important; }
  .brand { font-size: 0.9rem !important; }
}
