/* ===================================================
   JaVo Closed Header Shell
=================================================== */
.javo-header {
    position: relative;
    top: 0;
    z-index: 9999;
}
.site-custom-header {
    inline-size: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0 clamp(20px, 3vw, 40px);
    color: #0f172a;
    
    
}
.header-inner {
    position: relative;
    z-index: 100;
    display: grid;
    /* LEFT | CENTER | RIGHT */
    grid-template-columns:
        minmax(140px, 1fr)
        auto
        minmax(140px, 1fr);
    grid-template-areas:
        "actions search logo";
    align-items: center;
    column-gap: 16px;
    inline-size: 100%;
    max-inline-size: 1400px;
    min-block-size: 58px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0;
    direction: ltr;
    
}
.logo-wrapper {
    grid-area: logo;
    justify-self: end;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    min-inline-size: 0;
    block-size: 100%;
}
.site-logo {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    block-size: 44px;
    max-inline-size: 100%;

    margin: 0;
    padding: 0;

    background: transparent;
    border: 0;
    box-shadow: none;

    text-decoration: none;
}
.site-logo picture {
    display: flex;
    block-size: 100%;
    max-inline-size: 100%;
}

.site-logo img {
    display: block;

    inline-size: auto;
    block-size: 100%;

    max-inline-size: 100%;
    max-block-size: 58px;

    margin: 0;
    padding: 0;

    object-fit: contain;

    background: transparent;
    border: 0;
    box-shadow: none !important;
    filter: none !important;
}

.logo-shimmer {
    display: none !important;
}


@media (hover: hover) {
    .site-logo:hover {
        opacity: 1;
    }

    .site-logo:hover img {
        filter: none !important;
        box-shadow: none !important;
        transform: none !important;
    }
}
.header-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    justify-self: start;
    align-self: center;
    gap: 8px;
    min-inline-size: 0;
    max-inline-size: 100%;
    margin: 0;
    padding: 0;
    direction: ltr;
}
@media (max-width: 480px) {
    .close-btn {
        top: 20px;
        left: 20px;
        width: 40px;
        height: 40px;
    }
}
/* ===================================================
   JaVo Header Search
=================================================== */

.javo-header .javo-search-trigger,
.javo-header .javo-search-close,
.javo-header .javo-search-submit {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: #0b1c2d;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.javo-header .javo-search-trigger {
    grid-area: search;
    justify-self: center;
    justify-content: center;
    inline-size: 42px;
    min-inline-size: 0;
    block-size: 42px;
    padding: 0;
    color: #B3E7FF;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(179, 231, 255, 0.20);
    border-radius: 12px;
    box-shadow: none;
    direction: rtl;
    transition: background-color 160ms ease;
}

@media (hover: hover) {
    .javo-header .javo-search-trigger:hover {
        background: rgba(255, 255, 255, 0.12);
    }
}

.javo-search-trigger svg {
    flex: 0 0 auto;
    inline-size: 20px;
    block-size: 20px;
}

.javo-search-trigger-label {
    display: none;
}

.javo-header .javo-search-trigger:active {
    transform: scale(0.97);
}

.javo-header .javo-search-trigger:focus-visible,
.javo-header .javo-search-close:focus-visible,
.javo-header .javo-search-submit:focus-visible,
.javo-header .javo-search-input:focus-visible,
.javo-header .javo-search-result:focus-visible {
    outline: 3px solid rgba(2, 132, 199, 0.38);
    outline-offset: 3px;
}

.javo-header .javo-search-trigger:focus-visible {
    outline-color: #0284c7;
}

.javo-search-dialog {
    position: fixed;
    inset: 0;
    inline-size: min(720px, calc(100vw - 32px));
    max-inline-size: none;
    block-size: auto;
    max-block-size: none;
    box-sizing: border-box;
    margin: auto;
    padding: 0;
    overflow: visible;
    color: #0b1c2d;
    background: transparent;
    border: 0;
    direction: rtl;
    opacity: 0;
    transition:
        opacity 180ms ease,
        display 180ms allow-discrete,
        overlay 180ms allow-discrete;
}

.javo-search-dialog:not([open]) {
    display: none;
}

.javo-search-dialog[open] {
    opacity: 1;
}

@starting-style {
    .javo-search-dialog[open] {
        opacity: 0;
    }
}

.javo-search-dialog::backdrop {
    background: rgba(11, 28, 45, 0.55);
    opacity: 0;
    transition:
        opacity 180ms ease,
        display 180ms allow-discrete,
        overlay 180ms allow-discrete;
}

.javo-search-dialog[open]::backdrop {
    opacity: 1;
}

@starting-style {
    .javo-search-dialog[open]::backdrop {
        opacity: 0;
    }
}

.javo-search-panel {
    display: flex;
    flex-direction: column;
    inline-size: 100%;
    min-block-size: 240px;
    max-block-size: min(760px, calc(100vh - 48px));
    overflow: hidden;
    background: rgba(255, 255, 255, 0.99);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
    animation: javo-search-enter 190ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@supports (height: 100dvh) {
    .javo-search-panel {
        max-block-size: min(760px, calc(100dvh - 48px));
    }
}

@keyframes javo-search-enter {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.javo-search-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 10px;
}

.javo-search-title {
    margin: 0;
    color: #0b1c2d;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.5;
}

.javo-header .javo-search-close {
    inline-size: 44px;
    block-size: 44px;
    margin-inline-start: auto;
    color: #334155;
    font-size: 24px;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 13px;
    transition:
        color 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease;
}

.javo-search-form {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    min-inline-size: 0;
    min-block-size: 56px;
    margin: 0 20px 14px;
    padding: 4px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.javo-search-form:focus-within {
    background: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.javo-header .javo-search-input {
    flex: 1 1 auto;
    min-inline-size: 0;
    block-size: 48px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 14px;
    color: #0f172a73;
    font: inherit;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.5;
    text-align: start;
    background: transparent;
    border: 0;
    border-radius: 14px;
    box-shadow: none;
    outline: none;
    direction: rtl;
}

.javo-header .javo-search-input::placeholder {
    color: #64748b;
    opacity: 1;
}

.javo-header .javo-search-input::-webkit-search-cancel-button {
    inline-size: 18px;
    block-size: 18px;
    cursor: pointer;
}

.javo-header .javo-search-submit {
    inline-size: 48px;
    block-size: 48px;
    color: #ffffff;
    background: #0369a1;
    border: 1px solid #0369a1;
    border-radius: 14px;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

@media (hover: hover) {
    .javo-header .javo-search-submit:hover {
        background: #075985;
        border-color: #075985;
    }
}

.javo-header .javo-search-submit:active {
    transform: scale(0.95);
}

.javo-search-status,
.javo-search-results {
    min-inline-size: 0;
    box-sizing: border-box;
    direction: rtl;
    text-align: start;
}

.javo-search-status[hidden],
.javo-search-results[hidden] {
    display: none !important;
}

.javo-search-status {
    flex: 1 1 auto;
    min-block-size: 120px;
    padding: 34px 24px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.8;
    text-align: center;
}

.javo-search-state-error .javo-search-status {
    color: #9f1239;
}

.javo-search-results {
    flex: 1 1 auto;
    margin: 0;
    padding: 4px 12px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.javo-header .javo-search-result {
    display: flex;
    align-items: center;
    inline-size: 100%;
    min-inline-size: 0;
    gap: 12px;
    box-sizing: border-box;
    padding: 10px;
    color: #0b1c2d;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 15px;
    transition:
        background-color 150ms ease,
        border-color 150ms ease;
}

.javo-header .javo-search-result + .javo-search-result {
    margin-block-start: 2px;
}

.javo-header .javo-search-result:hover,
.javo-header .javo-search-result.is-active,
.javo-header .javo-search-result[aria-selected="true"] {
    color: #0b1c2d;
    background: #f0f9ff;
    border-color: rgba(14, 165, 233, 0.24);
}

.javo-search-result-media {
    display: flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    inline-size: 52px;
    block-size: 52px;
    overflow: hidden;
    color: #0369a1;
    font-size: 19px;
    font-weight: 800;
    background: #e0f2fe;
    border-radius: 13px;
}

.javo-search-result-media img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.javo-search-result-fallback {
    line-height: 1;
}

.javo-search-result-content {
    display: flex;
    flex: 1 1 auto;
    min-inline-size: 0;
    flex-direction: column;
    gap: 2px;
}

.javo-search-result-title,
.javo-search-result-subtitle,
.javo-search-result-context {
    display: block;
    min-inline-size: 0;
    overflow: hidden;
    unicode-bidi: plaintext;
}

.javo-search-result-title,
.javo-search-result-subtitle {
    text-overflow: ellipsis;
    white-space: nowrap;
}

.javo-search-result-title {
    color: #0b1c2d;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.65;
}

.javo-search-result-subtitle {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.6;
}

.javo-search-result-context {
    display: -webkit-box;
    margin-block-start: 2px;
    color: #475569;
    font-size: 12px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.javo-search-result-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    color: #0369a1;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.4;
    white-space: nowrap;
    background: #e0f2fe;
    border-radius: 999px;
}

body.javo-search-scroll-locked {
    overscroll-behavior: none;
}

.javo-episode-card[id^="javo-episode-"] {
    scroll-margin-block-start: 112px;
}

@media (max-width: 767px) {
    .javo-header .site-custom-header {
        padding-block-start: env(safe-area-inset-top);
        padding-right: max(12px, env(safe-area-inset-right));
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .javo-header .header-inner {
        grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
        grid-template-areas: "actions search logo";
        gap: 6px;
        min-block-size: 60px;
    }

  .javo-header .logo-wrapper {
       min-inline-size: 0;
       justify-self: end;
       align-self: center;
   }

   .javo-header .site-logo {
       transform: translateY(2px);
   }

   .javo-header .site-logo img {
       inline-size: auto;
       block-size: 44px;
   }

    /* ===================================================
       Mobile Search Dialog
    =================================================== */
    .javo-search-dialog {
        inset: 0 0 auto 0;
        inline-size: 100%;
        block-size: 40vh;
        max-block-size: 40vh;
        margin: 0;
        padding: 0;
        overflow: hidden;
        border: 0;
        border-radius: 0 0 22px 22px;
    }

    @supports (height: 100dvh) {
        .javo-search-dialog {
            block-size: 40dvh;
            max-block-size: 40dvh;
        }
    }

    .javo-search-panel {
        inline-size: 100%;
        block-size: 100%;
        min-block-size: 0;
        max-block-size: 100%;
        box-sizing: border-box;

        display: flex;
        flex-direction: column;

        padding-block-start: 0;
        padding-block-end: env(safe-area-inset-bottom);

        border: 0;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -14px 40px rgba(15, 23, 42, 0.16);

        overflow: hidden;
    }

    .javo-search-header {
        flex: 0 0 auto;
        padding: 10px 12px 8px;
    }

    .javo-search-title {
        font-size: 17px;
    }

    .javo-search-form {
        flex: 0 0 auto;
        min-block-size: 54px;
        margin: 0 12px 10px;
        border-radius: 16px;
    }

    .javo-header .javo-search-input {
        block-size: 46px;
        padding-inline: 12px;
        font-size: 16px;
    }

    .javo-header .javo-search-submit {
        inline-size: 46px;
        block-size: 46px;
        border-radius: 12px;
    }

    /* فقط لیست نتایج اسکرول شود */
    .javo-search-results {
        flex: 1 1 auto;
        min-block-size: 0;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;

        padding: 4px 8px max(12px, env(safe-area-inset-bottom));
    }

    .javo-header .javo-search-result {
        gap: 9px;
        padding: 9px 7px;
        border-radius: 12px;
    }

    .javo-search-result-media {
        flex-basis: 48px;
        inline-size: 48px;
        block-size: 48px;
        border-radius: 11px;
    }

    .javo-search-result-title {
        font-size: 14px;
    }

    .javo-search-result-subtitle,
    .javo-search-result-context {
        font-size: 12px;
    }

    .javo-search-result-badge {
        padding: 3px 7px;
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .javo-header .site-logo img {
        inline-size: auto;
        block-size: 40px;
    }

    .javo-search-result-badge {
        align-self: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .javo-header .site-logo,
    .javo-header .site-logo img,
    .javo-header .javo-search-trigger,
    .javo-header .javo-search-close,
    .javo-header .javo-search-submit,
    .javo-header .javo-search-form,
    .javo-header .javo-search-result,
    .javo-header .login-button-modern,
    .javo-header .user-account-link {
        transition: none;
    }

    .javo-search-panel {
        animation: none;
    }

    .javo-search-dialog,
    .javo-search-dialog::backdrop {
        transition: none;
    }
}
/* ===================================================
   Closed Header Account UI
=================================================== */

.header-account,
.user-profile-wrapper {
    display: flex;
    min-inline-size: 0;
    max-inline-size: 100%;
    align-items: center;
}

.header-account {
    margin: 0;
    justify-self: start;
    direction: rtl;
}

.javo-header .login-button-modern,
.javo-header .user-account-link {
    display: inline-flex;
    min-inline-size: 0;
    max-inline-size: 100%;
    block-size: 42px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    color: #B3E7FF;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    background: transparent;
    border: 0;
    border-radius: 11px;
    box-shadow: none;
    transition: background-color 160ms ease;
}

.javo-header .login-button-modern svg,
.javo-header .header-user-icon {
    flex: 0 0 20px;
    inline-size: 20px;
    block-size: 20px;
}

.user-name {
    min-inline-size: 0;
    max-inline-size: 132px;
    overflow: hidden;
    color: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (hover: hover) {
    .javo-header .login-button-modern:hover,
    .javo-header .user-account-link:hover {
        background: rgba(255, 255, 255, 0.08);
    }
}

.javo-header .login-button-modern:active,
.javo-header .user-account-link:active {
    transform: scale(0.97);
}

.javo-header .login-button-modern:focus-visible,
.javo-header .user-account-link:focus-visible {
    outline: 3px solid #0284c7;
    outline-offset: 3px;
}

@media (max-width: 767px) {
    .javo-header .login-button-modern,
    .javo-header .user-account-link {
        inline-size: 42px;
        padding: 0;
        gap: 0;
    }

    .javo-header .login-button-modern span,
    .javo-header .user-name {
        display: none;
    }
}

/* ===================================================
   Desktop alignment with the global content shell
=================================================== */
@media (min-width: 1101px) {
    .javo-header .site-custom-header {
        padding-inline: 0;
    }

    .javo-header .header-inner {
        inline-size: min(
            calc(
                100% -
                var(--javo-site-desktop-gutter) -
                var(--javo-site-desktop-gutter)
            ),
            var(--javo-site-content-max)
        );
        max-inline-size: none;
    }
}
