@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;700&display=swap');

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

html, body {
    width: 100%;
}

body {
    font-family: 'Noto Nastaliq Urdu', serif;
    direction: rtl;
}

.site-header {
    width: 100%;
}

/* ---------- Top bar (logo) ---------- */
.topbar {
    background: #ffffff;
    border-bottom: 1px solid #eee;
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    direction: ltr;      /* physical control, independent of page RTL */
    justify-content: flex-end;
    align-items: center;
    padding: 10px 20px;
}
.logo-box img {
    height: 140px;
    min-height: 140px;
    display: block;
}

/* ---------- Main nav ---------- */
.main-nav {
    background: #141414;
    border-top: 6px solid #c0202c;
    margin-bottom: 10px;
}
.menu {
    max-width: 1400px;
    margin: 0 auto;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}
.menu > li {
    position: relative;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.menu > li:last-child {
    border-left: none;
}
.menu > li > a {
    display: block;
    padding: 14px 18px;
    color: #f2f2f2;
    text-decoration: none;
    font-size: 17px;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}
.menu > li > a:hover {
    background: #c0202c;
    color: #fff;
}
.menu > li.active > a {
    background: #c0202c;
    color: #fff;
}
.caret {
    font-size: 16px;
    margin-right: 4px;
}

/* ---------- Dropdown submenus ---------- */
.dropdown {
    list-style: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: #1e1e1e;
    border-top: 2px solid #c0202c;
    display: none;
    z-index: 50;
    box-shadow: 0 6px 14px rgba(0,0,0,0.3);
}
.menu > li.has-dropdown:hover > .dropdown {
    display: block;
}
.dropdown li a {
    display: block;
    padding: 10px 16px;
    color: #eee;
    text-decoration: none;
    font-size: 15px;
    border-bottom: 1px solid #2a2a2a;
}
.dropdown li a:hover {
    background: #c0202c;
    color: #fff;
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
    .menu { flex-direction: column; }
    .dropdown { position: static; box-shadow: none; }
}

/* ---------- News ticker ---------- */
.ticker-bar {
    display: flex;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #eee;
}
.ticker-inner {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    direction: rtl;
}
.ticker-label {
    background: #c0202c;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding: 10px 30px 10px 22px;
    margin-left: -14px;      /* lets the slanted edge overlap slightly into the ticker text */
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%);
}
.ticker-viewport {
    flex: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    direction: ltr; /* keeps the scroll's physical direction predictable */
}
.ticker-track {
    display: inline-flex;
    white-space: nowrap;
    animation: ticker-scroll 55s linear infinite;
}
.ticker-viewport:hover .ticker-track {
    animation-play-state: paused;
}
.ticker-set {
    display: inline-flex;
    white-space: nowrap;
    min-width: 100vw;   /* guarantees real off-screen content to reveal, even on light news days */
}
.ticker-item {
    display: inline-flex;
    align-items: center;
    direction: rtl;      /* Urdu text itself still reads right-to-left */
    font-size: 16px;
    color: #141414;
    padding: 0 18px;
    text-decoration: none;
}
.ticker-dot {
    color: #c0202c;
    font-size: 10px;
    margin-left: 8px;
}

/* .ticker-set is rendered twice back-to-back and padded to at least one
   viewport width, so sliding by exactly 50% of the track always reveals
   fresh content from the right and loops with no visible jump */
@keyframes ticker-scroll {
    from { transform: translateX(0%); }
    to   { transform: translateX(-50%); }
}

/* ---------- Ticker submission page ---------- */
.ticker-form-page {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.ticker-form-page h1 { color: #141414; margin-bottom: 6px; }
.ticker-form-page .hint { color: #666; margin-bottom: 20px; }
.ticker-form textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    direction: rtl;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
}
.ticker-form button {
    margin-top: 10px;
    background: #c0202c;
    color: #fff;
    border: none;
    padding: 10px 26px;
    font-size: 16px;
    font-family: inherit;
    border-radius: 4px;
    cursor: pointer;
}
.ticker-form button:hover { background: #9c1a23; }
.alert {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 14px;
}
.alert-success { background: #e6f7e9; color: #1c7c34; border: 1px solid #b7e3c1; }
.alert-error { background: #fdecea; color: #a3291f; border: 1px solid #f5c2bd; }
.today-heading { margin-top: 30px; color: #141414; }
.today-list { margin-top: 10px; list-style: none; }
.today-list li {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    color: #333;
}
.today-list li.empty { color: #999; }

/* ---------- Add post form ---------- */
.post-form-page {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px 60px;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.post-form-page h1 { color: #141414; margin-bottom: 20px; }
.post-form { display: flex; flex-direction: column; }
.post-form label {
    margin: 16px 0 6px;
    font-weight: 700;
    color: #141414;
}
.post-form input[type="text"],
.post-form input[type="file"],
.post-form select {
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
    direction: rtl;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}
#editor {
    background: #fff;
    min-height: 220px;
    font-size: 19px;         /* standard comfortable size for Urdu Nastaliq reading */
    font-family: 'Noto Nastaliq Urdu', serif;
}
.post-form button {
    margin-top: 20px;
    align-self: flex-start;
    background: #c0202c;
    color: #fff;
    border: none;
    padding: 12px 32px;
    font-size: 16px;
    font-family: inherit;
    border-radius: 4px;
    cursor: pointer;
}
.post-form button:hover { background: #9c1a23; }
.field-hint {
    font-size: 13px;
    color: #888;
    margin-top: 6px;
    direction: rtl;
}

/* ---------- Homepage post grid ---------- */
.post-grid-page {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    direction: rtl;
}
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}
.post-card {
    display: block;
    text-decoration: none;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.post-card-img {
    height: 170px;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
    position: relative;
}
.post-card-img-placeholder {
    background: linear-gradient(135deg, #1e1e1e, #3a3a3a);
}
.post-card-body { padding: 14px 16px; }
.post-card-title {
    font-size: 19px;
    color: #141414;
    font-family: 'Noto Nastaliq Urdu', serif;
    margin-bottom: 8px;
    line-height: 1.9;
}
.post-card-excerpt {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}
.post-card-date {
    font-size: 13px;
    color: #999;
}
.empty-state {
    text-align: center;
    color: #888;
    padding: 60px 0;
    font-size: 18px;
    direction: rtl;
}
.category-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid #c0202c;
}
.category-heading h1 {
    font-size: 26px;
    color: #141414;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.category-heading .back-link {
    font-size: 14px;
    color: #c0202c;
    text-decoration: none;
}
.category-heading .back-link:hover { text-decoration: underline; }

/* ---------- Play icon overlay (used on video thumbnails) ---------- */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
    pointer-events: none;
}
.play-icon svg { width: 100%; height: 100%; }

/* ---------- Video carousel (sits directly under the ticker) ---------- */
.video-section {
    max-width: 1400px;
    margin: 20px auto 40px;
    padding: 0 20px;
}
.video-section-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e5e5;
    direction: ltr; /* pins the button to the left and arrows to the right, deterministically */
}
.see-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: #141414;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 18px;
    border: 1.5px solid #141414;
    border-radius: 24px;
    direction: rtl; /* keeps the Urdu label + arrow in the right reading order */
}
.see-more-btn:hover { background: rgba(0,0,0,0.06); }
.carousel-arrows { display: flex; gap: 10px; }
.arrow-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid rgba(20,20,20,0.5);
    background: transparent;
    color: #141414;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.arrow-btn:hover { background: rgba(0,0,0,0.06); }
.video-carousel {
    display: flex;
    gap: 3px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    background: #eee;
    scrollbar-width: none;
    direction: rtl;
}
.video-carousel::-webkit-scrollbar { display: none; }
.video-card {
    flex: 0 0 20%;
    aspect-ratio: 6 / 5;
    scroll-snap-align: start;
    text-decoration: none;
}
.video-card-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #ccc;
    position: relative;
}
@media (max-width: 900px) {
    .video-card { flex-basis: 45%; }
}
@media (max-width: 560px) {
    .video-card { flex-basis: 70%; }
}

/* ---------- Single post page ---------- */
.post-page {
    max-width: 900px;
    margin: 0 auto 50px;
    padding: 0 20px;
    direction: rtl;
}
.post-banner {
    width: 100%;
    height: 340px;
    background-size: cover;
    background-position: center;
    border-radius: 6px;
    margin-top: 24px;
}
.post-category {
    display: inline-block;
    margin-top: 22px;
    padding: 4px 12px;
    background: #c0202c;
    color: #fff;
    font-size: 13px;
    text-decoration: none;
    border-radius: 3px;
}
.post-category:hover { background: #9c1a23; }
.post-title {
    font-size: 30px;
    color: #141414;
    font-family: 'Noto Nastaliq Urdu', serif;
    margin-top: 22px;
    line-height: 1.9;
}
.post-date {
    color: #999;
    font-size: 14px;
    margin-top: 8px;
    margin-bottom: 24px;
}
.video-player-wrap {
    margin-bottom: 24px;
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}
.video-player-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.post-content {
    font-size: 19px;          /* standard comfortable size for Urdu Nastaliq reading */
    line-height: 2;
    color: #222;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.post-content img { max-width: 100%; border-radius: 4px; margin: 14px 0; }
.post-content h1, .post-content h2, .post-content h3 { margin: 20px 0 10px; color: #141414; }
.not-found { text-align: center; padding: 60px 0; color: #888; direction: rtl; }

/* ---------- اہم خبریں + آج کا اخبار row ---------- */
.news-row {
    max-width: 1400px;
    margin: 20px auto 40px;
    padding: 0 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    direction: ltr; /* پہلا بلاک بائیں طرف، دوسرا دائیں طرف — deterministic regardless of the site's RTL */
}
.epaper-block, .important-block { min-width: 0; }
.epaper-block { flex: 0 1 40%; }
.important-block { flex: 0 1 60%; }

/* -- کالمز / بین الاقوامی row (below the news-row) -- */
.two-col-row {
    max-width: 1400px;
    margin: 0 auto 40px;
    padding: 0 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    direction: ltr; /* first block (بین الاقوامی) sits left, second (کالمز) sits right */
}
.two-col-item { min-width: 0; }
.two-col-row-grid .two-col-wide { flex: 0 1 65%; }
.two-col-row-grid .two-col-narrow { flex: 0 1 35%; }
@media (max-width: 900px) {
    .two-col-row { flex-direction: column; }
    .two-col-row-grid .two-col-wide,
    .two-col-row-grid .two-col-narrow { flex-basis: auto; width: 100%; }
}

/* -- Plain grid-list style (کالمز / بین الاقوامی): header + item rows, no
      big featured card, arranged in 1 or 2 columns depending on section width -- */
.cat-grid-block { background: #fff; }
.cat-item-grid {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 24px;
    padding: 4px 20px 6px;
}
.cat-item-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
}
.cat-item-grid .important-item { padding: 14px 0; }
@media (max-width: 560px) {
    .cat-item-grid.cols-2 { grid-template-columns: 1fr; }
}

/* -- Hero-card row (بین الاقوامی / تعلیم / ٹیکنالوجی): one full-width card
      per category, stacked; each has a big hero post on top and a compact
      list of up to 4 more posts below it -- */
.hero-row {
    max-width: 1400px;
    margin: 0 auto 40px;
    padding: 0 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    /* no direction override — normal page RTL already places the first DOM
       item (بین الاقوامی) on the right, matching the reference image */
}
.hero-card {
    flex: 1 1 0;
    min-width: 0;
    background: #fff;
}
@media (max-width: 900px) {
    .hero-row { flex-direction: column; }
}
.hero-card .section-head-bar { position: relative; }
.accent-square {
    position: absolute;
    top: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: #c0202c;
}
.hero-post { display: block; text-decoration: none; }
.hero-post-img {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 6;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}
.hero-post-title-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.72);
    color: #fff;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.9;
    padding: 14px 22px;
    text-align: right;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.hero-post-meta {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: #999;
    direction: rtl;
    padding: 10px 20px 4px;
}
.hero-post-meta span { display: inline-flex; align-items: center; gap: 4px; }
.hero-list { padding: 4px 20px 6px; }
.hero-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    direction: ltr; /* body پہلے (بائیں)، تھمب بعد میں (دائیں) */
}
.hero-list-item:last-child { border-bottom: none; }
.hero-list-item .important-item-body { flex: 1; min-width: 0; direction: rtl; }
.hero-list-item .important-item-thumb { flex: 0 0 90px; height: 80px; border-radius: 6px; background-size: cover; background-position: center; }
@media (max-width: 560px) {
    .hero-post-title-bar { font-size: 17px; padding: 10px 16px; }
}

/* -- آج کا اخبار (left block) -- */
.epaper-title-link { text-decoration: none; display: block; }
.epaper-title {
    font-size: 26px;
    font-weight: 800;
    color: #141414;
    direction: rtl;
    text-align: right;
    margin: 0 0 10px;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.section-red-line { height: 4px; background: #c0202c; margin-bottom: 16px; }
.epaper-viewer {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
}
.epaper-viewer img {
    width: 100%;
    height: auto;
    display: block;
}
.epaper-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.epaper-arrow:hover { background: rgba(0,0,0,0.65); }
.epaper-prev { left: 16px; }
.epaper-next { right: 16px; }
.epaper-expand {
    display: block;
    text-align: center;
    margin-top: 8px;
    color: #888;
    font-size: 22px;
    text-decoration: none;
}
.epaper-expand:hover { color: #141414; }

/* -- اہم خبریں (right block) -- */
.section-head-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0f0f0;
    padding: 16px 20px;
    direction: ltr; /* collapse-btn پہلے (بائیں)، عنوان بعد میں (دائیں) */
}
.collapse-btn {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    border: 1.5px solid #ccc;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 22px;
    text-decoration: none;
    flex-shrink: 0;
}
.collapse-btn:hover { background: #f7f7f7; }
.section-title {
    font-size: 30px;
    font-weight: 800;
    color: #141414;
    direction: rtl;
    margin: 0;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.important-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-top: 16px;
    direction: ltr; /* list پہلے (بائیں)، featured بعد میں (دائیں) */
}
.important-list {
    flex: 0 0 42%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.important-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    direction: ltr; /* body پہلے (بائیں)، تھمب بعد میں (دائیں) */
}
.important-item:last-child { border-bottom: none; }
.important-item-body {
    flex: 1;
    min-width: 0;
    direction: rtl;
}
.important-item-title {
    font-size: 16px;
    font-weight: 700;
    color: #141414;
    margin: 0 0 8px;
    line-height: 1.9;
}
.important-item-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: #999;
    direction: rtl;
}
.important-item-meta span, .featured-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.important-item-thumb {
    flex: 0 0 110px;
    height: 100px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}
.important-featured {
    flex: 1;
    min-width: 0;
    display: block;
    text-decoration: none;
    direction: rtl;
}
.featured-img {
    width: 100%;
    height: 260px;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
}
.featured-title-bar {
    background: #141414;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    padding: 16px 18px;
    line-height: 1.9;
}
.featured-meta {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: #999;
    padding: 12px 4px 6px;
}
.featured-excerpt {
    font-size: 15px;
    color: #444;
    line-height: 1.8;
    padding: 0 4px;
}
@media (max-width: 900px) {
    .news-row { flex-direction: column; }
    .important-content { flex-direction: column; }
    .important-list { flex-basis: auto; }
}

/* ---------- Site footer ---------- */
.site-footer {
    background: #000;
    color: #ccc;
    padding: 34px 20px 26px;
    margin-top: 40px;
    text-align: center;
}
.footer-inner { max-width: 1400px; margin: 0 auto; }
.footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}
.footer-social-icon {
    color: #fff;
    background: rgba(255,255,255,0.08);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.footer-social-icon:hover { background: #c0202c; }
.footer-credit {
    font-size: 14px;
    color: #ddd;
    margin-bottom: 8px;
    direction: ltr;
}
.footer-credit strong { color: #fff; }
.footer-copyright {
    font-size: 13px;
    color: #999;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
    line-height: 1.8;
}

/* ---------- مزید پڑھیں (related posts on the single-post page) ---------- */
.related-section {
    max-width: 1400px;
    margin: 10px auto 40px;
    padding: 0 20px;
}
.related-title-wrap { margin-bottom: 22px; }
.related-line { height: 3px; background: #c0202c; }
.related-title {
    text-align: center;
    font-size: 30px;
    color: #141414;
    padding: 16px 0;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px 24px;
    direction: rtl;
}
.related-card { text-decoration: none; display: block; }
.related-card-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
    background-color: #ddd;
    border-radius: 4px;
}
.related-card-title {
    margin-top: 10px;
    font-size: 16px;
    color: #141414;
    line-height: 1.9;
    text-align: right;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
@media (max-width: 900px) {
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .related-grid { grid-template-columns: 1fr; }
}

/* ---------- Pagination (category.php) ---------- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    direction: ltr; /* keeps page numbers in natural ascending visual order */
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    color: #141414;
    text-decoration: none;
    font-size: 14px;
    background: #fff;
}
.page-link:hover { background: #f2f2f2; }
.page-link.active {
    background: #c0202c;
    border-color: #c0202c;
    color: #fff;
}
.page-link.page-nav {
    font-family: 'Noto Nastaliq Urdu', serif;
    direction: rtl;
    padding: 0 16px;
}

/* ---------- Full e-paper reader page (epaper.php) ---------- */
.epaper-page {
    max-width: 1600px;
    margin: 0 auto 40px;
    padding: 0 20px;
    direction: rtl;
}
.epaper-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: #1c1c1c;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    direction: ltr; /* keeps the toolbar's left/right layout predictable regardless of page RTL */
}
.epaper-toolbar-nav { display: flex; gap: 8px; }
.epaper-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #2c2c2c;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
}
.epaper-tool-btn:hover { background: #3a3a3a; }
.epaper-tool-btn.disabled { opacity: 0.35; pointer-events: none; }
.epaper-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #c0202c;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 18px;
    border-radius: 4px;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.epaper-pdf-btn:hover { background: #9c1a23; }
.epaper-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-start: auto;
    flex-wrap: wrap;
}
.epaper-tool-pill {
    background: #2c2c2c;
    color: #fff;
    border: none;
    font-size: 14px;
    font-family: 'Noto Nastaliq Urdu', serif;
    direction: rtl;
    padding: 9px 16px;
    border-radius: 4px;
    cursor: pointer;
}
.epaper-tool-pill:hover, .epaper-tool-pill.active { background: #c0202c; }
.epaper-dropdown { position: relative; }
.epaper-dropdown-menu {
    display: none;
    position: absolute;
    top: 110%;
    left: 0;
    min-width: 180px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    z-index: 60;
    overflow: hidden;
    direction: rtl;
}
.epaper-dropdown-menu.open { display: block; }
.epaper-dropdown-menu a {
    display: block;
    padding: 10px 14px;
    color: #141414;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}
.epaper-dropdown-menu a:last-child { border-bottom: none; }
.epaper-dropdown-menu a:hover, .epaper-dropdown-menu a.active { background: #f2f2f2; color: #c0202c; }
.epaper-dropdown-empty { display: block; padding: 10px 14px; color: #999; font-size: 13px; }
.epaper-date-form input[type="date"] {
    padding: 8px 10px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    background: #fff;
    color: #141414;
}

.epaper-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 14px;
    direction: rtl;
}
.epaper-thumb {
    flex: 0 0 110px;
    cursor: pointer;
    text-align: center;
    opacity: 0.7;
}
.epaper-thumb.active { opacity: 1; }
.epaper-thumb img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 2px;
    display: block;
}
.epaper-thumb.active img { border-color: #c0202c; }
.epaper-thumb-label {
    display: inline-block;
    margin-top: 6px;
    background: #1c1c1c;
    color: #fff;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 2px;
    letter-spacing: 0.5px;
}
.epaper-thumb.active .epaper-thumb-label { background: #c0202c; }

.epaper-main-viewer {
    position: relative;
    background: #f4f4f4;
    overflow: hidden;
    text-align: center;
    border: 1px solid #eee;
}
.epaper-main-viewer img {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}
.epaper-lens {
    position: absolute;
    display: none;
    border: 2px solid #c0202c;
    border-radius: 50%;
    pointer-events: none;
    background-repeat: no-repeat;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.epaper-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 10px;
}
.epaper-grid-item img {
    width: 100%;
    display: block;
    border: 1px solid #eee;
    border-radius: 2px;
}
@media (max-width: 700px) {
    .epaper-toolbar-right { width: 100%; justify-content: space-between; }
}

/* ---------- Admin login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #141414;
    padding: 20px;
}
.login-box {
    background: #fff;
    border-radius: 8px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}
.login-title {
    text-align: center;
    font-size: 26px;
    color: #141414;
    margin-bottom: 22px;
}
.login-form { display: flex; flex-direction: column; }
.login-form label { margin: 12px 0 6px; font-weight: 700; color: #141414; }
.login-form input {
    padding: 11px 12px;
    font-size: 15px;
    font-family: inherit;
    direction: ltr;
    text-align: left;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.login-form button {
    margin-top: 20px;
    background: #c0202c;
    color: #fff;
    border: none;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    border-radius: 4px;
    cursor: pointer;
}
.login-form button:hover { background: #9c1a23; }

/* ---------- Admin dashboard ---------- */
.admin-topbar {
    background: #141414;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.admin-topbar-actions { display: flex; gap: 16px; }
.admin-view-site, .admin-logout {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 7px 14px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
}
.admin-logout:hover { background: #c0202c; }
.admin-view-site:hover { background: rgba(255,255,255,0.2); }
.admin-dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 20px 60px;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}
.admin-dashboard-title { font-size: 28px; color: #141414; margin-bottom: 6px; }
.admin-dashboard-sub { color: #777; margin-bottom: 28px; }
.admin-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}
.admin-tool-card {
    display: block;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.admin-tool-card:hover {
    box-shadow: 0 10px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}
.admin-tool-stat {
    display: inline-block;
    background: #f2f2f2;
    color: #666;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
}
.admin-tool-title { font-size: 19px; color: #141414; margin-bottom: 8px; }
.admin-tool-desc { font-size: 14px; color: #777; line-height: 1.7; }
