/* ==========================================================================
   SITE HEADER + FOOTER (partials/_header.html, partials/_footer.html)
   White bar: brand mark, five section links, compact icon tools and the
   orange "أضف إعلانك" button. Footer: one row with brand, copyright, links.
   Loaded on every page after style.css / yojad-header.css.
   ========================================================================== */

:root {
    --sh-bg: #ffffff;
    --sh-ink: #0f172a;
    --sh-text: #334155;
    --sh-muted: #64748b;
    --sh-line: #e2e8f0;
    --sh-chip: #f1f5f9;
    --sh-accent: #ff6001;
    --sh-accent-hover: #e65600;
    --sh-accent-text: #d14f00;
    --sh-brand: #4b315e;
}
[data-theme='dark'] {
    --sh-bg: #1a171f;
    --sh-ink: #f1f5f9;
    --sh-text: #cbd5e1;
    --sh-muted: #94a3b8;
    --sh-line: #2f2b36;
    --sh-chip: #2a2631;
    --sh-accent-text: #ff8c42;
}

/* ---- Bar ---- */
.sh {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1040;
    padding: 0 !important;            /* main.js sets inline padding on scroll */
    background: var(--sh-bg);
    border-bottom: 1px solid var(--sh-line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06) !important;
    font-family: 'Cairo', sans-serif;
}
.sh-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 68px;
}

/* ---- Brand (logo image; light/dark artwork swaps with the theme) ---- */
.sh-brand { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.sh-logo { display: block; width: auto; object-fit: contain; }
.sh-brand .sh-logo { height: 46px; max-width: 200px; }
.sh-logo--dark { display: none; }
[data-theme='dark'] .sh-logo--light { display: none; }
[data-theme='dark'] .sh-logo--dark { display: block; }

/* ---- Section links ---- */
.sh-nav { display: none; align-items: center; gap: 1.4rem; font-size: .9rem; font-weight: 500; }
.sh-nav-link { color: var(--sh-text); text-decoration: none; transition: color .2s ease; white-space: nowrap; }
.sh-nav-link:hover,
.sh-nav-link.is-active { color: var(--sh-accent-text); }
.sh-nav-link.is-active { font-weight: 800; }
@media (min-width: 1200px) { .sh-nav { display: flex; } }

/* ---- Actions ---- */
.sh-actions { display: flex; align-items: center; gap: .4rem; }
.sh-desktop { display: none !important; }
@media (min-width: 992px) { .sh-desktop { display: inline-flex !important; } }

.sh-icon {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--sh-text);
    font-size: .95rem;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease;
}
.sh-icon:hover,
.sh-icon[aria-expanded='true'] { background: var(--sh-chip); color: var(--sh-accent-text); }
.sh-icon--text { width: auto; min-width: 38px; padding: 0 .5rem; font-size: .8rem; font-weight: 800; }
.sh-icon.dropdown-toggle::after { display: none; }
.sh-badge {
    position: absolute;
    top: 2px;
    inset-inline-end: 0;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border: 2px solid var(--sh-bg);
    border-radius: 999px;
    background: var(--sh-accent);
    color: #fff;
    font-size: .6rem;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
}
.sh .header-theme-toggle .theme-icon-dark { display: none; }
[data-theme='dark'] .sh .header-theme-toggle .theme-icon-light { display: none; }
[data-theme='dark'] .sh .header-theme-toggle .theme-icon-dark { display: inline; }

.sh-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-start: .15rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sh-brand);
    color: #fff;
    font-size: .85rem;
    font-weight: 900;
}
.sh-avatar:hover { box-shadow: 0 0 0 3px rgba(75, 49, 94, .2); }

.sh-login {
    display: none;
    padding: .5rem .75rem;
    color: var(--sh-text);
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.sh-login:hover { color: var(--sh-accent-text); }
@media (min-width: 576px) { .sh-login { display: inline-block; } }

/* أضف إعلانك — quick-add trigger restyled as the orange header button */
.sh-cta-wrap { display: none; }
@media (min-width: 768px) { .sh-cta-wrap { display: block; } }
.sh .sh-cta {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1rem;
    border: 0;
    border-radius: 9px;
    background: var(--sh-accent);
    color: #fff;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
    transition: background-color .2s ease;
}
.sh .sh-cta:hover { background: var(--sh-accent-hover); color: #fff; }
.sh .sh-cta .quick-add-trigger-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: var(--sh-accent);
    font-size: .6rem;
}

/* Hamburger (mobile / tablet) */
.sh .sh-burger {
    width: 40px;
    height: 40px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    margin-inline-start: .15rem;
    border: 1px solid var(--sh-line);
    border-radius: 10px;
    background: var(--sh-bg);
}
.sh .sh-burger span { display: block; width: 18px; height: 2px; margin: 0; border-radius: 2px; background: var(--sh-ink) !important; transition: transform .25s ease, opacity .25s ease; }  /* beats the legacy .hamburger colors */
.sh .sh-burger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.sh .sh-burger.active span:nth-child(2) { opacity: 0; }
.sh .sh-burger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (min-width: 1200px) { .sh .sh-burger { display: none; } }

/* Dropdowns opened from the bar */
.sh .dropdown-menu {
    margin-top: .5rem !important;
    border: 1px solid var(--sh-line);
    border-radius: 12px;
    box-shadow: 0 16px 40px -12px rgba(15, 23, 42, .25);
    font-size: .85rem;
}
.sh .notif-dropdown { width: min(360px, calc(100vw - 24px)); }
.sh .header-user-section .dropdown-menu { max-height: calc(100vh - 90px); overflow-y: auto; min-width: 250px; }

/* Small screens: compact brand */
@media (max-width: 575.98px) {
    .sh-row { min-height: 60px; gap: .5rem; }
    .sh-brand .sh-logo { height: 36px; max-width: 140px; }
    .sh-icon { width: 34px; height: 34px; }
    .sh-actions { gap: .15rem; }
}

/* ---- Search bar under the header ---- */
.sh-search {
    display: none;
    position: fixed;
    top: var(--fixed-header-height, 68px);
    right: 0;
    left: 0;
    z-index: 1039;
    padding: .75rem 0;
    background: var(--sh-bg);
    border-bottom: 1px solid var(--sh-line);
    box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .3);
}
.sh-search.is-open { display: block; }
.sh-search-form {
    display: flex;
    align-items: center;
    gap: .6rem;
    max-width: 720px;
    margin: 0 auto;
    padding: .35rem .35rem .35rem .9rem;
    border-radius: 12px;
    background: var(--sh-chip);
}
[dir='rtl'] .sh-search-form { padding: .35rem .9rem .35rem .35rem; }
.sh-search-form i { color: var(--sh-muted); }
.sh-search-form input { flex: 1; min-width: 0; height: 38px; border: 0; outline: 0; background: transparent; color: var(--sh-ink); font-size: .9rem; }
.sh-search-form button {
    padding: 0 1.2rem;
    height: 38px;
    border: 0;
    border-radius: 9px;
    background: var(--sh-accent);
    color: #fff;
    font-size: .85rem;
    font-weight: 800;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer.ft.sf {
    margin: 0;
    padding: 2rem 0;
    background: var(--sh-bg);
    border-top: 1px solid var(--sh-line);
    color: var(--sh-muted);
    font-size: .875rem;
}
.sf-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}
.sf-brand { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.sf-brand { gap: .9rem; }
.sf-logo-link { display: inline-flex; }
.sf-brand .sf-logo { height: 36px; max-width: 160px; }
.sf-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-weight: 500; }
.sf-links a,
.sf-socials a { color: var(--sh-muted); text-decoration: none; transition: color .2s ease; }
.sf-links a:hover,
.sf-socials a:hover { color: var(--sh-accent-text); }
.sf-socials { display: flex; gap: 1rem; font-size: 1rem; }
@media (max-width: 767.98px) {
    .sf-row { flex-direction: column; text-align: center; }
    .sf-brand, .sf-links { justify-content: center; }
}

/* ==========================================================================
   PAGE LOADER (partials/_pre_loader.html) — overrides the old ring loader
   ========================================================================== */
#preloader.pl {
    background: var(--sh-bg);
    flex-direction: column;
}
.pl-box { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; padding: 1rem; }
.pl .pl-logo { height: 64px; max-width: min(260px, 70vw); animation: pl-breathe 1.8s ease-in-out infinite; }
.pl-bar {
    position: relative;
    width: 180px;
    height: 4px;
    border-radius: 999px;
    background: var(--sh-chip);
    overflow: hidden;
}
.pl-bar span {
    position: absolute;
    inset-block: 0;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sh-accent), #ff8c42);
    animation: pl-slide 1.1s cubic-bezier(.4, 0, .2, 1) infinite;
}
.pl-tag { margin: 0; color: var(--sh-muted); font-family: 'Cairo', sans-serif; font-size: .8rem; font-weight: 600; text-align: center; }
@keyframes pl-slide {
    0%   { inset-inline-start: -40%; }
    100% { inset-inline-start: 100%; }
}
@keyframes pl-breathe {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .85; transform: scale(.97); }
}
@media (prefers-reduced-motion: reduce) {
    .pl .pl-logo, .pl-bar span { animation: none; }
    .pl-bar span { inset-inline-start: 0; width: 100%; }
}
