/* =========================================
   Qaumi Awaz Hub - style.css (fixed)
   Font file (optional, relative to this CSS):
   fonts/JameelNooriNastaleeq.woff2
========================================= */

@font-face {
    font-family: "Jameel Noori Nastaleeq";
    src: url("fonts/JameelNooriNastaleeq.woff2") format("woff2");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    --nav0: #00255f;
    --nav1: #00307a;
    --nav2: #022256;
    --deep: #00172e;
    --foot: #012958;
    --red: #bf1f1f;
    --ink: #14213d;
    --mute: #5b6577;
    --line: #dde2ea;
    --bg: #fff;
    --font-urdu: "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", "Noto Sans Arabic", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-padding-top: env(safe-area-inset-top, 0px);
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-urdu);
    line-height: 1.9;
    overflow-x: clip;
    position: relative;
    width: 100%;
}

/* Form controls do not inherit fonts by default.
   Icons are NOT touched, so Font Awesome keeps working. */
input, textarea, select, button { font-family: inherit; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Top bar ---------- */
.top { background: var(--deep); color: #fff; }
.top .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    gap: 10px;
    flex-wrap: wrap;
}
.soc { display: flex; gap: 6px; }
.soc a {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    font-size: 15px;
    line-height: 1;
    color: #fff;
}
.toplink { background-color: gray; }
.toplink:hover { background-color: var(--red); }
.toplink:active { background-color: #fff; color: gray; }

.time {
    background: #fff;
    color: var(--red);
    padding: 0 6px;
    border-radius: 3px;
    margin-inline-end: 6px;
}

/* ---------- Masthead ---------- */
.mast {
    --lw: min(340px, calc(100vw - 40px));
    position: relative;
    background: var(--red);
    color: #fff;
    padding: 0;
}
.mast::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: calc(var(--lw) * 0.0695);
    background: #fff;
}
.mast .wrap { position: relative; padding-top: 0; }
.mast h1 {
    margin: 0;
    font-size: clamp(34px, 6vw, 52px);
    line-height: 1.5;
    font-weight: 700;
}
.logo { display: block; width: min(100%, 140px); height: auto; }
.mast .logo { width: var(--lw); }

/* ---------- Navigation ---------- */
nav { background: var(--nav2); }
nav .wrap {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
nav a { padding: 14px 26px; color: #fff; font-weight: 700; }
nav a.on { background: var(--red); }
nav a:hover { background: rgba(255, 255, 255, .12); }
nav a.on:hover { background: var(--red); }

.links { display: flex; }
.burger {
    display: none;
    width: 100%;
    text-align: right;
    background: transparent;
    color: #fff;
    border: 0;
    border-radius: 0;
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 700;
}
.burger:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Latest ticker ---------- */
.latest { border-bottom: 1px solid var(--line); overflow: hidden; }
.latest .wrap {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 0 20px;
    width: 100%;          /* fix: wrap used to shrink to its content */
}
.lab {
    background: var(--mute);
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    padding: 6px 24px;
    margin-top: 10px;
    border-radius: 0 0 4px 4px;
    flex: none;
}
.latest span {
    flex: 1;
    min-width: 0;         /* fix: lets ellipsis work inside flex */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Sections ---------- */
.sec {
    margin: 28px 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 20px 20px 24px;
}
.sh {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--red);
    margin-bottom: 20px;
}
.sh h2 {
    margin: 0;
    background: var(--red);
    color: #fff;
    font-size: 22px;
    padding: 6px 24px;
    line-height: 1.7;
}
.ctrl { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; }

input, button {
    padding: 2px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: #fff;
}
button {
    background: var(--nav1);
    color: #fff;
    border-color: var(--nav1);
    font-weight: 700;
    cursor: pointer;
}
button:hover { background: var(--nav0); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* ---------- Edition cards (matches the classes the JS generates) ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}
.edition-card {
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.edition-card:hover { border-color: var(--nav1); }
.edition-card a.pri {
    display: block;
    aspect-ratio: 3 / 4;
    margin: 12px 12px 0;
    border: 1px solid var(--line);
    overflow: hidden;
    background: #f4f6fa;
}
.edition-card a.pri img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: top;
}
.edition-info { padding: 8px 12px 14px; }
.edition-info h3 { margin: 0; font-size: 20px; color: var(--nav1); line-height: 1.6; }
.edition-info p { margin: 0; color: var(--mute); font-size: 15px; line-height: 1.6; }
.edition-pdf {
    display: block;
    margin-top: 8px;
    padding: 2px 8px;
    text-align: center;
    border: 1px solid var(--red);
    border-radius: 4px;
    background: var(--red);
    color: #fff;
    font-weight: 700;
}
.edition-pdf:hover { background: #9c1010; }
.no-editions {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--mute);
    padding: 24px 0;
    margin: 0;
}

/* ---------- Archive ---------- */
.arch { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.arch a { border: 1px solid var(--line); border-radius: 4px; text-align: center; }
.arch a:hover { background: var(--nav1); color: #fff; border-color: var(--nav1); }

/* ---------- Footer ---------- */
.fd {
    background:var(--red);
    border-bottom: 5px solid var(--red);
    padding: 30px 0;
}
.fb {
    background: var(--foot);
    color: #d6deec;
    text-align: center;
    padding: 26px 16px;
    font-size: 15px;
}
.fb ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 22px;
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
}
.fb-link:hover { color: #fff; text-decoration: underline; }
.fb-link:active { color: #ff8a8a; }
.admin-link { color: var(--line); font-size: 11px; margin-inline-start: 10px; opacity: .6; }
.admin-link:active { color: rgb(210, 208, 208); }

/* ---------- Ads ---------- */
.ad-container { width: 100%; max-width: 1000px; margin: 20px auto; text-align: center; }
.ad-container[hidden] { display: none; }
.ad-banner { display: block; width: 100%; height: auto; object-fit: contain; margin: 0 auto; }

/* ---------- Lightbox / modals ---------- */
.lb {
    position: fixed;
    inset: 0;
    background: rgba(0, 23, 46, .92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    overflow: auto;
}
.lb[hidden] { display: none; }
.lb img { max-width: 100%; max-height: calc(100vh - 32px); object-fit: contain; background: #fff; }
.lbx {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    font-size: 18px;
    background: var(--red);
    border-color: var(--red);
    z-index: 2;
    display: grid;
    place-items: center;
    line-height: 1;
}

/* ---------- Published news (modals) ---------- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0;
}
.news-card {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow-wrap: anywhere;
}
.news-card:hover { border-color: var(--nav1); }
.news-article-link { display: block; }
.news-card h3 { color: var(--nav0); margin: 10px 0; font-size: 19px; line-height: 1.7; }
.news-card img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    margin: 0 auto 8px;
    border-radius: 6px;
}
.news-date { margin: 0; color: var(--mute); font-size: 14px; }

/* ---------- Admin dashboard ---------- */
#admin-lb {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 20, 40, .78);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
#admin-lb[hidden],
#admin-gate-view[hidden],
#admin-dashboard-view[hidden] { display: none !important; }

#admin-lb .lbx {
    position: fixed;
    top: 18px;
    left: 20px;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    background: #c62828;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    transition: .25s ease;
    display: grid;
    place-items: center;
    padding: 0;
    line-height: 1;
}
#admin-lb .lbx:hover { background: #a71919; transform: rotate(90deg); }

#admin-lb > div {
    background: #fff !important;
    width: 100%;
    max-width: 760px !important;
    max-height: calc(100vh - 40px) !important;
    overflow-y: auto;
    padding: 30px !important;
    border-radius: 14px !important;
    color: #263449 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    border-top: 5px solid var(--red);
    scrollbar-width: thin;
}
#admin-lb h1 { font-size: 27px !important; }
#admin-lb h2 { color: #183153; font-size: 18px; font-weight: 700; }

#admin-dashboard-view > h2 {
    background: #f4f7fb;
    border-right: 4px solid var(--red);
    padding: 12px 14px;
    margin: 28px 0 16px;
    border-radius: 5px;
    line-height: 1.8;
}

/* All five admin forms (edition, 3x news, ad) */
#admin-dashboard-view form {
    background: #fff;
    border: 1px solid #e0e6ef;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(20, 40, 70, .05);
}
#admin-dashboard-view form br { display: none; }
#admin-dashboard-view label {
    display: block;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    margin: 15px 0 7px;
}
#admin-dashboard-view form > label:first-child { margin-top: 0; }

#admin-dashboard-view input,
#admin-dashboard-view select,
#admin-dashboard-view textarea,
#admin-gate-view input {
    width: 100%;
    padding: 12px 14px;
    min-height: 45px;
    border: 1px solid #d5dce7;
    border-radius: 7px;
    background: #fbfcfe;
    color: #263449;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
#admin-dashboard-view textarea { resize: vertical; line-height: 1.8; }
#admin-dashboard-view input:focus,
#admin-dashboard-view select:focus,
#admin-dashboard-view textarea:focus,
#admin-gate-view input:focus {
    border-color: #24476b;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(36, 71, 107, .10);
}
#admin-dashboard-view input[type="file"] { padding: 8px; background: #f8fafc; }

#admin-dashboard-view form button[type="submit"] {
    width: 100%;
    min-height: 46px;
    margin-top: 22px;
    padding: 12px 18px;
    border: none;
    border-radius: 7px;
    background: rgb(90, 90, 90);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
}
#admin-dashboard-view form button[type="submit"]:hover {
    background: #05105a;
    box-shadow: 0 5px 14px rgba(5, 16, 90, .18);
    transform: translateY(-1px);
}
#admin-dashboard-view form button:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* Headlines panel */
#admin-dashboard-view > div:has(#adm-easy-headlines) {
    background: #f8fafc;
    border: 1px solid #e0e6ef;
    border-radius: 10px;
    padding: 20px;
}
#adm-easy-headlines { min-height: 100px; }
#adm-save-headlines-btn {
    background: #183153;
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    border-radius: 7px;
    transition: background .2s, transform .2s;
}
#adm-save-headlines-btn:hover { background: #24476b; transform: translateY(-1px); }

#admin-gate-view { padding: 28px 15px; }
#admin-login-btn { min-height: 44px; border-radius: 7px; font-size: 15px; transition: background .2s; }
#admin-login-btn:hover { background: #a71919 !important; }
#admin-logout-btn { padding: 9px 22px; border-radius: 6px; font-weight: 700; background: #64748b; border-color: #64748b; }
#admin-logout-btn:hover { background: #475569; }

/* ---------- Modal panels (replaces inline styles) ---------- */
.panel {
    background: var(--bg);
    width: 100%;
    max-width: 850px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: clamp(20px, 5vw, 35px);
    border-radius: 8px;
    color: var(--ink);
    direction: rtl;
    text-align: right;
    line-height: 1.8;
}
.panel.narrow { max-width: 750px; }
.panel-head { text-align: center; margin-bottom: 25px; border-bottom: 3px solid var(--red); padding-bottom: 15px; }
.panel-head h1 { margin: 0 0 10px; color: var(--nav0); font-size: clamp(24px, 4vw, 32px); font-weight: 700; }
.panel-head p { margin: 0; color: var(--red); font-weight: 700; font-size: 16px; }
.panel h2 {
    color: var(--nav1);
    font-size: 20px;
    border-right: 4px solid var(--red);
    padding-right: 10px;
    margin: 25px 0 15px;
}
.panel p { font-size: 16px; margin: 0 0 14px; }
.panel ul { padding-inline-start: 20px; margin: 0 0 20px; }
.panel li { margin-bottom: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 25px; }
.card { background: #f4f6fa; border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.card h3 { margin: 0 0 8px; color: var(--nav1); font-size: 18px; font-weight: 700; }
.card p { margin: 0; font-size: 14px; color: var(--mute); }
.cta {
    background: #fff8f8;
    border: 2px dashed var(--red);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-top: 30px;
}
.cta h3 { margin: 0 0 10px; color: var(--nav0); font-size: 18px; }
.cta p { font-size: 15px; color: var(--mute); }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 700;
    color: #fff;
    background: var(--red);
}
.btn.wa { background: #25d366; }
.btn.mail { background: var(--nav1); }
.btn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 30px; }
.btn-row .btn { justify-content: center; padding: 12px; }
.note { background: #f4f6fa; border: 1px solid var(--line); border-radius: 6px; padding: 15px; text-align: center; margin-top: 25px; font-size: 14px; color: var(--mute); }
.note a { color: var(--nav1); font-weight: 700; }
.alert { background: #fff8f8; border-right: 4px solid var(--red); padding: 12px 18px; border-radius: 4px; margin-bottom: 25px; font-size: 15px; color: #721c24; }
.team { display: flex; justify-content: center; margin-bottom: 30px; }
.team figure { margin: 0; text-align: center; background: #f4f6fa; border: 1px solid var(--line); border-radius: 8px; padding: 15px; }
.team img { width: min(220px, 60vw); height: min(220px, 60vw); border-radius: 50%; object-fit: cover; background: #dde2ea; }
.team strong { display: block; color: var(--nav0); font-size: 18px; margin-top: 10px; }
.team small { color: var(--mute); }
.contact-form { display: flex; flex-direction: column; gap: 15px; }
.contact-form label { display: block; margin-bottom: 5px; font-weight: 700; font-size: 15px; }
.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    color: var(--ink);
}
.contact-form button { background: var(--red); border: 0; padding: 12px; font-size: 16px; }
.contact-form button:hover { background: #9c1010; }
.ltr { direction: ltr; unicode-bidi: embed; }

/* Single article page (article.php) */
.article { max-width: 800px; margin: 30px auto; }
.article h1 { color: var(--nav0); line-height: 1.6; }
.article img { display: block; max-height: 450px; margin: 0 auto 16px; border-radius: 6px; }
.article .body { font-size: 18px; line-height: 2.1; }
.article .back { display: inline-block; margin-top: 20px; color: var(--nav1); font-weight: 700; }

/* ---------- Responsive ---------- */
@media (min-width: 1400px) {
    .wrap { max-width: 1320px; }
    .mast { --lw: min(420px, calc(100vw - 40px)); }
    .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

@media (max-width: 900px) {
    .mast { --lw: min(300px, calc(100vw - 40px)); }
    .sec { margin: 20px 0; padding: 16px; }
    .lab { font-size: 18px; padding: 4px 16px; }
}

@media (max-width: 600px) {
    .wrap { padding: 0 12px; }
    .top .wrap { padding: 6px 12px; justify-content: center; font-size: 14px; }
    .soc a { width: 30px; height: 30px; font-size: 13px; }
    .mast { --lw: min(280px, calc(100vw - 24px)); }
    .mast .wrap { display: flex; justify-content: center; }
    .latest .wrap { padding: 0 12px; gap: 10px; }
    .lab { font-size: 16px; padding: 2px 12px; }

    nav .wrap { display: block; overflow: visible; padding: 0; }
    .burger { display: block; }
    .links { display: none; flex-direction: column; border-top: 1px solid rgba(255, 255, 255, .2); }
    .links.open { display: flex; }
    .links a { padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); }

    .sec { padding: 12px; margin: 16px 0; }
    .sh { border-bottom: 0; gap: 0; margin-bottom: 14px; }
    .sh h2 { width: 100%; font-size: 18px; padding: 5 19px; }
    .ctrl { width: 100%; padding: 10px 0 0; }
    .ctrl input { flex: 1; min-width: 0; }

    .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .edition-card a.pri { margin: 8px 8px 0; }
    .edition-info { padding: 6px 8px 10px; }
    .edition-info h3 { font-size: 16px; }
    .edition-info p { font-size: 13px; }
    .arch { grid-template-columns: repeat(3, 1fr); }

    .fd { padding: 24px 0; }
    .fd .wrap { display: flex; justify-content: center; }
    .fb { font-size: 14px; padding: 20px 12px; }

    #admin-lb { padding: 10px; }
    #admin-lb > div { padding: 18px !important; max-height: calc(100vh - 20px) !important; border-radius: 10px !important; }
    #admin-lb h1 { font-size: 21px !important; }
    #admin-dashboard-view > h2 { font-size: 15px; padding: 10px; }
    #admin-dashboard-view form { padding: 15px; }
    #admin-lb .lbx { top: 8px; left: 8px; width: 36px; height: 36px; }
}

@media (max-width: 360px) {
    .grid { grid-template-columns: 1fr; }
    .arch { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}

/* Admin: manage published news */
.admin-news-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border: 1px solid #e0e6ef;
    border-radius: 8px;
    background: #fff;
}
.admin-news-row small { color: var(--mute); }
.admin-del { background: #c62828; border-color: #c62828; padding: 6px 14px; flex: none; }
.admin-del:hover { background: #a71919; }

/* Admin: contact messages */
.admin-msg {
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid #e0e6ef;
    border-radius: 8px;
    background: #fff;
}
.admin-msg-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.admin-msg small { color: var(--mute); }
.admin-msg p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 10px; font-size: 16px; }