/* ============================================================
   Aljazair Press v4.0.12 — الشريط العلوي الاحترافي
   (الطقس الدوّار + أوقات الصلاة + أسعار الصرف + أرشيف الجريدة
   + اللافتة الحمراء + أزرار القائمة السريعة)
   يعتمد متغيرات الألوان القائمة في style.css ف يعمل تلقائياً
   مع الوضع الليلي (--card-bg, --text-dark, --border-color...)
   ============================================================ */

/* ------------------------------------------------------------
   0) الشريط الموحّد .ajp-infobar
   ------------------------------------------------------------ */
.ajp-infobar {
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    font-size: 13px;
    position: relative;
    z-index: 1001;
}
.ajp-infobar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 46px;
    flex-wrap: nowrap;
    /* ملاحظة: بلا overflow-x هنا حتى لا تُقص القوائم المنسدلة (الأرشيف/البحث)
       — وضع التمرير الأفقي للهواتف فقط في استعلامات الوسائط أدناه */
    padding-top: 4px;
    padding-bottom: 4px;
}
.ajp-infobar-row::-webkit-scrollbar { display: none; }
.ajp-infobar-side,
.ajp-infobar-links,
.ajp-infobar-widgets,
.ajp-infobar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.ajp-infobar-widgets { flex: 0 1 auto; gap: 16px; }
.ajp-infobar-left { margin-inline-start: auto; }

/* شارة التاريخ */
.ajp-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark, #1e293b);
    font-weight: 700;
    white-space: nowrap;
}
.ajp-date-ico { color: #c21d1d; display: inline-flex; }

/* روابط الشريط العلوي (قائمة مخصصة) */
.ajp-topbar-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.ajp-topbar-links li a {
    display: inline-block;
    padding: 4px 8px;
    color: var(--text-muted, #64748b);
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    white-space: nowrap;
}
.ajp-topbar-links li a:hover {
    color: var(--accent-red, #d93025);
    background: rgba(217, 48, 37, .08);
}

/* ------------------------------------------------------------
   1) دوّار الطقس حسب الولايات
   ------------------------------------------------------------ */
.ajp-wx {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.ajp-wx-pill {
    background: var(--ajp-deepred, #9c1616);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 4px 13px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease;
}
.ajp-wx-pill:hover { background: #b51e1e; }
.ajp-wx-pill:active { transform: scale(.96); }

.ajp-wx-ico { display: inline-flex; align-items: center; color: #5470c6; }
.ajp-wx-ico .ajp-wx-svg { display: block; }
.ajp-wx-ico.is-day { color: #e8a013; }
.ajp-wx-ico.is-cloud { color: #64748b; }
.ajp-wx-ico.is-rain { color: #3b82c4; }
.ajp-wx-ico.is-storm { color: #7c3aed; }

.ajp-wx-temp {
    font-size: 19px;
    font-weight: 800;
    color: var(--ajp-deepred, #9c1616);
    line-height: 1;
    min-width: 34px;
    text-align: center;
    transition: opacity .25s ease;
}
.ajp-wx-hl {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    font-size: 10px;
    line-height: 1.25;
    color: var(--text-muted, #64748b);
    font-weight: 700;
}
.ajp-wx-hi { color: #b45309; }
.ajp-wx-lo { color: #2563eb; }
.ajp-wx-hi, .ajp-wx-lo { white-space: nowrap; }

.ajp-wx-arrows { display: inline-flex; gap: 3px; }
.ajp-wx-nav {
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-light, #f4f6f9);
    color: var(--text-muted, #64748b);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: all .2s ease;
}
.ajp-wx-nav:hover {
    background: var(--ajp-deepred, #9c1616);
    color: #fff;
    border-color: var(--ajp-deepred, #9c1616);
}

/* انتقال ناعم عند التبديل */
.ajp-wx.is-fading .ajp-wx-temp,
.ajp-wx.is-fading .ajp-wx-hl,
.ajp-wx.is-fading .ajp-wx-pill,
.ajp-wx.is-fading .ajp-wx-ico {
    opacity: .25;
}

/* ------------------------------------------------------------
   2) أسعار الصرف
   ------------------------------------------------------------ */
.ajp-fx {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ajp-fx-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.ajp-fx-code {
    background: #0c7a3d;
    color: #fff;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .3px;
}
.ajp-fx-value {
    color: #0c7a3d;
    font-weight: 800;
    font-size: 13.5px;
}
.ajp-fx-dzd {
    color: var(--text-muted, #64748b);
    font-size: 10.5px;
    font-weight: 600;
}
.ajp-fx-manual .ajp-fx-value { opacity: .75; }

/* ------------------------------------------------------------
   3) أوقات الصلاة
   ------------------------------------------------------------ */
.ajp-prayer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-light, #f4f6f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 999px;
    padding: 3px 8px;
}
.ajp-prayer-ico {
    color: var(--ajp-deepred, #9c1616);
    display: inline-flex;
    padding-inline-end: 4px;
}
.ajp-prayer-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    padding: 1px 7px;
    border-radius: 9px;
    transition: background .2s ease, color .2s ease;
}
.ajp-prayer-name {
    font-size: 9.5px;
    color: var(--text-muted, #64748b);
    font-weight: 600;
}
.ajp-prayer-time {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-dark, #1e293b);
    font-variant-numeric: tabular-nums;
}
/* الصلاة القادمة — تمييز أحمر داكن كالمرجع */
.ajp-prayer-item.is-next {
    background: var(--ajp-deepred, #9c1616);
}
.ajp-prayer-item.is-next .ajp-prayer-name,
.ajp-prayer-item.is-next .ajp-prayer-time {
    color: #fff;
}
.ajp-prayer-count {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ajp-deepred, #9c1616);
    padding-inline-start: 4px;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   4) القوائم المنسدلة العامة (الأرشيف / المزيد / البحث)
   ------------------------------------------------------------ */
.ajp-dd { position: relative; display: inline-flex; }
.ajp-dd-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    transition: all .2s ease;
    white-space: nowrap;
}
.ajp-dd-trigger:hover {
    color: var(--accent-red, #d93025);
    background: rgba(217, 48, 37, .07);
}
.ajp-dd-panel {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    min-width: 190px;
    max-width: 320px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(11, 30, 51, .16);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 1100;
}
.ajp-dd.is-open .ajp-dd-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.ajp-dd-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}
.ajp-dd-panel ul li a {
    display: block;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--text-dark, #1e293b);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.ajp-dd-panel ul li a:hover {
    background: rgba(217, 48, 37, .08);
    color: var(--accent-red, #d93025);
}
/* لوحة أرشيف الجريدة على يسار الزر (نهاية الشريط) */
.ajp-infobar-left .ajp-dd-panel { inset-inline-start: auto; inset-inline-end: 0; }

/* زر دخول مصغّر داخل الشريط الموحّد */
.ajp-infobar-left .ajp-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 999px;
    padding: 4.5px 13px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-dark, #1e293b);
    text-decoration: none;
    white-space: nowrap;
    transition: all .2s ease;
}
.ajp-infobar-left .ajp-login-btn:hover {
    background: var(--ajp-deepred, #9c1616);
    border-color: var(--ajp-deepred, #9c1616);
    color: #fff;
}
.ajp-infobar-left .ajp-register-btn {
    display: none; /* يكفي زر الدخول في الشريط الموحّد */
}
.ajp-infobar-left .ajp-account-menu { position: static; }

/* زر البث المصغّر */
.ajp-live-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4.5px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   5) اللافتة الحمراء للخبر الرئيسي
   ------------------------------------------------------------ */
.ajp-red-banner-wrap { margin-top: 14px; margin-bottom: 4px; }
.ajp-red-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #c31d1d 0%, #9c1616 100%);
    color: #fff;
    text-decoration: none;
    text-align: center;
    border-radius: 12px;
    padding: 15px 26px;
    font-size: clamp(16px, 2.1vw, 25px);
    font-weight: 800;
    line-height: 1.55;
    box-shadow: 0 10px 26px rgba(156, 22, 22, .30);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.ajp-red-banner:hover {
    filter: brightness(1.08);
    box-shadow: 0 12px 30px rgba(156, 22, 22, .40);
    transform: translateY(-1px);
    color: #fff;
}
.ajp-red-banner-tag {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .18);
    border-radius: 50%;
    font-size: 15px;
}
.ajp-red-banner-text { flex: 1 1 auto; }

/* ------------------------------------------------------------
   6) أزرار القائمة السريعة داخل nav (المزيد / الفيديو / البحث)
   ------------------------------------------------------------ */
.ajp-nav-quick {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: 8px;
}
.ajp-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #d3302a, #a31313);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 6.5px 15px;
    font-size: 12.5px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .18s ease, transform .18s ease;
}
.ajp-quick-btn:hover { filter: brightness(1.12); transform: translateY(-1px); color: #fff; }
.ajp-more-btn .ajp-dd-panel { color: initial; }

.ajp-more .ajp-dd-panel {
    inset-inline-start: auto;
    inset-inline-end: 0;
    min-width: 220px;
}
.ajp-more .ajp-dd-panel ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
}
.ajp-more .ajp-dd-panel ul li a { border-radius: 8px; }

.ajp-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color, #e2e8f0);
    background: transparent;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all .2s ease;
}
.ajp-search-btn:hover,
.ajp-search.is-open .ajp-search-btn {
    background: var(--ajp-deepred, #9c1616);
    border-color: var(--ajp-deepred, #9c1616);
    color: #fff;
}
.ajp-search-panel { min-width: 260px; inset-inline-start: auto; inset-inline-end: 0; }
.ajp-search-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
.ajp-search-form input[type="search"] {
    flex: 1 1 auto;
    width: 170px;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 7px 11px;
    font-family: inherit;
    font-size: 13px;
    background: var(--bg-light, #f4f6f9);
    color: var(--text-dark, #1e293b);
}
.ajp-search-form input[type="search"]:focus { outline: 2px solid rgba(156, 22, 22, .35); border-color: var(--ajp-deepred, #9c1616); }
.ajp-search-form button {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 0;
    background: var(--ajp-deepred, #9c1616);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter .18s ease;
}
.ajp-search-form button:hover { filter: brightness(1.15); }

/* ------------------------------------------------------------
   7) الاستجابة (Responsive)
   ------------------------------------------------------------ */
@media (max-width: 1200px) {
    .ajp-fx { display: none; }
}
@media (max-width: 1024px) {
    /* الهواتف/التابلت: شريط قابل للتمرير أفقاً + إخفاء ما لا يلزم،
       والقوائم المنسدلة تُخفى لأنها داخل سياق قصّ لا يمكن فتحها داخله */
    .ajp-infobar-row {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .ajp-infobar-row::-webkit-scrollbar { display: none; }
    .ajp-infobar-links { display: none; }
    .ajp-prayer-count { display: none; }
    .ajp-archive { display: none; }
}
@media (max-width: 820px) {
    .ajp-wx-hl { display: none; }
    .ajp-wx-arrows { display: none; }
}
@media (max-width: 640px) {
    .ajp-prayer { display: none; }
    .ajp-red-banner { padding: 12px 16px; gap: 9px; }
    .ajp-red-banner-tag { width: 25px; height: 25px; font-size: 13px; }
    .ajp-nav-quick { margin-inline-start: 4px; gap: 5px; }
    .ajp-quick-btn { padding: 5.5px 11px; font-size: 11.5px; }
    .ajp-search-panel { min-width: 210px; }
}
@media (max-width: 420px) {
    .ajp-quick-btn span { display: none; } /* أيقونات فقط على الهواتف الصغيرة */
    .ajp-quick-btn { padding: 5.5px 9px; }
}

/* ------------------------------------------------------------
   8) الوضع الليلي (يرث المتغيرات — تعديلات دقيقة فقط)
   ------------------------------------------------------------ */
html[data-theme="dark"] .ajp-wx-pill,
html[data-theme="dark"] .ajp-prayer-item.is-next,
html[data-theme="dark"] .ajp-search-form button {
    background: #b52525;
}
html[data-theme="dark"] .ajp-fx-code { background: #128a48; }
html[data-theme="dark"] .ajp-fx-value { color: #35c47c; }
html[data-theme="dark"] .ajp-red-banner {
    background: linear-gradient(135deg, #d32a2a 0%, #a51818 100%);
}
html[data-theme="dark"] .ajp-quick-btn {
    background: linear-gradient(135deg, #d3302a, #a31313);
}
html[data-theme="dark"] .ajp-dd-panel {
    box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
}

/* حركة مخفّضة */
@media (prefers-reduced-motion: reduce) {
    .ajp-wx-temp, .ajp-wx-hl, .ajp-wx-pill, .ajp-wx-ico,
    .ajp-dd-panel, .ajp-red-banner, .ajp-quick-btn {
        transition: none !important;
    }
}
