/*
 * Responsive app shell.
 *
 * Desktop (992px and wider) keeps the fixed side menu. Below 992px (tablets and phones):
 * - the page header is the top bar: menu button, page title, notifications, chat, profile;
 * - the side menu is a drawer opened by the menu button; a section's sub-menu
 *   (Financial, Settings, Website builder, Marketing) opens inside it with a Back button;
 * - page toolbars wrap instead of being cut off, and their dropdowns open as a sheet.
 * Behaviour: public/website/js/side-menu.js (WrokeDrawer).
 * Loaded after rtl.css, so the RTL rules here win over the desktop RTL ones.
 */

/* Section head (title + Add / Export / Columns buttons): when the buttons do not fit
   beside the title (phones, or a small laptop with a sub-menu open) they wrap. */
.sec-head {
    flex-wrap: wrap;
    gap: 12px;
}

.sec-head > ul {
    flex-wrap: wrap;
}

/* The count badge sits in the line after the title (it was placed outside the title box
   and covered the buttons when they came close). */
.sec-head h2 {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.sec-head h2 span,
html[dir="rtl"] .sec-head h2 span {
    position: static;
    transform: none;
    flex-shrink: 0;
}

/* Drawer-only controls: hidden on desktop. */
.wk-menu-btn,
.wk-drawer-close,
.wk-drawer-back,
.wk-drawer-backdrop {
    display: none;
}

@media (max-width: 991.98px) {

    /* ---------- Page area: full width, no side menu space ---------- */

    .content-body,
    .content-body.content-body-minimize,
    .content-financial,
    html[dir="rtl"] .content-body,
    html[dir="rtl"] .content-body.content-body-minimize,
    html[dir="rtl"] .content-financial {
        padding-left: 0;
        padding-right: 0;
    }

    .body-content .container,
    .sub-header .container {
        padding-right: 12px;
        padding-left: 12px;
    }

    /* Wide task rows scroll sideways inside their group. */
    .content-task .collapse {
        overflow-x: auto;
    }

    /* ---------- Top bar ---------- */

    .main-header,
    .content-financial .main-header,
    .content-body.content-body-minimize .main-header,
    html[dir="rtl"] .main-header,
    html[dir="rtl"] .content-financial .main-header,
    html[dir="rtl"] .content-body.content-body-minimize .main-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 99;
    }

    .main-header .container {
        gap: 8px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .wk-menu-btn {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: 5px;
        flex-shrink: 0;
        width: 42px;
        height: 42px;
        padding: 0 10px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        cursor: pointer;
    }

    .wk-menu-btn span {
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 2px;
        background: var(--wroke-text, #1f1f1f);
    }

    .wk-menu-btn span:nth-child(2) {
        width: 16px;
    }

    .wk-menu-btn:hover,
    .wk-menu-btn:focus-visible {
        background: var(--wroke-bg-hover, rgb(206 206 206 / 30%));
    }

    .main-header .name-proj {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    .main-header .txt-name-proj {
        min-width: 0;
    }

    .main-header .txt-name-proj h5 {
        margin: 0;
        font-size: 16px;
        /* an English project name in the Arabic bar is cut at its own end */
        unicode-bidi: plaintext;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* The date line is a desktop nicety; the bar keeps only the page name. */
    .main-header .txt-name-proj p {
        display: none;
    }

    .main-header .lst-menu {
        display: flex;
        width: auto;
        flex-shrink: 0;
    }

    .main-header .lst-menu > ul {
        gap: 2px;
    }

    .main-header .lst-menu > ul > li > a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
    }

    .main-header .lst-menu > ul > li.active > a:before,
    .main-header .lst-menu > ul > li > a.dropdown-toggle.show:before {
        width: 40px;
        height: 40px;
    }

    /* Reminders live in the menu; the bar keeps notifications, chat and profile. */
    .main-header .lst-menu .getMyReminders {
        display: none;
    }

    .main-header .lst-proflie,
    html[dir="rtl"] .main-header .lst-proflie {
        margin: 0;
        padding: 0;
    }

    .main-header .lst-proflie:before,
    .main-header .lst-proflie .dropdown-toggle:before,
    .main-header .lst-proflie .txt-profile {
        display: none;
    }

    .main-header .lst-proflie .dropdown-toggle {
        gap: 0;
    }

    .main-header .lst-proflie .dropdown-toggle figure {
        width: 32px;
        height: 32px;
    }

    /* Pending invitations are also in the profile menu (workspace switcher). */
    .main-header .workspace-invite-chips {
        display: none;
    }

    /* Header lists (notifications, chat, profile): a sheet under the bar, full width. */
    .main-header .lst-menu .dropdown-menu.show {
        position: fixed !important;
        top: 70px !important;
        left: 8px !important;
        right: 8px !important;
        bottom: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: calc(100vh - 86px);
        max-height: calc(100dvh - 86px);
        overflow-y: auto;
        transform: none !important;
        margin: 0 !important;
    }

    /* ---------- Side menu as a drawer ---------- */

    .aside_menu {
        display: none;
    }

    .main_asid,
    .aside_menu.main_asid.aside-minimize,
    html[dir="rtl"] .main_asid {
        display: flex;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: min(300px, 86vw);
        height: 100%;
        z-index: 1001;
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform .25s ease, visibility .25s;
    }

    html[dir="rtl"] .main_asid,
    html[dir="rtl"] .aside_menu.main_asid.aside-minimize {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }

    .main_asid.active,
    html[dir="rtl"] .main_asid.active,
    html[dir="rtl"] .aside_menu.main_asid.aside-minimize.active {
        visibility: visible;
        transform: none;
        box-shadow: var(--wroke-shadow-lg, 0 22px 48px rgb(0 0 0 / 18%));
    }

    /* The drawer always shows the full menu (logo and item names), never the icon rail. */
    .main_asid .logo-site,
    .aside_menu.main_asid.aside-minimize .logo-site {
        display: flex;
        justify-content: space-between;
        padding: 0 12px 0 20px;
    }

    html[dir="rtl"] .main_asid .logo-site {
        padding: 0 20px 0 12px;
    }

    .aside_menu.main_asid.aside-minimize .logo-site .logo-web {
        display: inline;
    }

    .aside_menu.main_asid.aside-minimize .logo-site .logo-minimize,
    .aside_menu.main_asid .menu-toggle,
    .aside_menu.main_asid.aside-minimize .menu-toggle {
        display: none;
    }

    .aside_menu.main_asid.aside-minimize .main_menu > li > a span,
    .aside_menu.main_asid.aside-minimize .support-st > a span {
        display: inline;
    }

    /* A section's sub-menu slides over the drawer. */
    .aside_financial.wk-sub-open,
    html[dir="rtl"] .aside_financial.wk-sub-open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: auto;
        width: min(300px, 86vw);
        height: 100%;
        z-index: 1002 !important;
        animation: wk-drawer-in-left .2s ease;
    }

    html[dir="rtl"] .aside_financial.wk-sub-open {
        left: auto;
        right: 0;
        animation-name: wk-drawer-in-right;
    }

    .aside_financial .logo-site {
        justify-content: flex-start;
        gap: 6px;
        padding: 0 12px;
    }

    .wk-drawer-close,
    .wk-drawer-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--wroke-text-secondary, #4f4f4f);
        font-size: 18px;
        cursor: pointer;
    }

    .wk-drawer-close:hover,
    .wk-drawer-close:focus-visible,
    .wk-drawer-back:hover,
    .wk-drawer-back:focus-visible {
        background: var(--wroke-bg-hover, rgb(206 206 206 / 30%));
    }

    html[dir="ltr"] .wk-drawer-back i {
        transform: scaleX(-1);
    }

    .wk-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: var(--wroke-bg-overlay, rgb(0 0 0 / 40%));
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s ease, visibility .25s;
    }

    body.wk-drawer-open .wk-drawer-backdrop {
        opacity: 1;
        visibility: visible;
    }

    body.wk-drawer-open {
        overflow: hidden;
    }

    /* The floating AI button sits above everything; on a small screen it would cover
       the open menu, a form's buttons or a sheet, so it steps aside meanwhile. */
    body.wk-drawer-open .wroke-ai-fab-wrap,
    body.modal-open .wroke-ai-fab-wrap,
    body:has(.sub-header .dropdown-menu.show, .sec-head .dropdown-menu.show, .main-header .dropdown-menu.show) .wroke-ai-fab-wrap {
        display: none;
    }

    .main-header .tg-notif.has-unread:before,
    .main-header .dropdown:nth-child(2) .tg-notif.has-unread:before {
        top: 8px;
        right: 8px;
    }

    /* ---------- Page toolbar (search, view tabs, sort, filter) ---------- */

    .sub-header {
        height: auto;
        min-height: 55px;
    }

    .sub-header .container {
        flex-wrap: wrap;
        gap: 0 12px;
        overflow: visible;
    }

    .sub-header .str-header {
        flex: 1 1 0;
        min-width: 0;
    }

    .sub-header .end-menu {
        flex-shrink: 0;
        margin-inline-start: auto;
    }

    /* View tabs (Board, List, Table…) scroll sideways inside their own row. */
    .sub-header .str-header > ul {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .sub-header .str-header > ul::-webkit-scrollbar {
        display: none;
    }

    .sub-header .str-header > ul > li {
        flex-shrink: 0;
    }

    .filter-proj {
        gap: 20px;
    }

    .filter-proj > li:not(:last-child):before {
        right: -10px;
    }

}

@media (max-width: 767.98px) {

    /* Toolbar dropdowns (sort, filter, columns…): a sheet at the bottom of the screen. */
    .sub-header .dropdown-menu.show,
    .sec-head .dropdown-menu.show {
        position: fixed !important;
        top: auto !important;
        bottom: 8px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: 75vh;
        max-height: 75dvh;
        overflow-y: auto;
        transform: none !important;
        margin: 0 !important;
        border-radius: 16px;
        /* the second shadow dims the page behind the sheet */
        box-shadow: 0 -8px 32px rgb(0 0 0 / 18%), 0 0 0 100vmax rgb(0 0 0 / 35%);
        z-index: 1060;
    }

    /* Page tabs (a project's Overview / Tasks / Team…, task views): a full row of their own,
       the page buttons (Edit, Chat, Add task…) on the row under them. */
    .sub-header .str-header:has(> .menu-project) {
        flex-basis: 100%;
    }

    .sub-header .str-header:has(> .menu-project) ~ .end-menu {
        padding: 8px 0 10px;
    }

    /* Tasks: search with sort / filter on one line, the quick filters scroll in a row below. */
    .sub-header .str-header:has(.task-quick-filters) {
        display: contents;
    }

    .sub-header .str-header:has(.task-quick-filters) .form-search {
        flex: 1 1 0;
        min-width: 0;
    }

    .sub-header .task-quick-filters {
        order: 3;
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 0 10px;
        width: 100%;
        scrollbar-width: none;
    }

    .sub-header .task-quick-filters::-webkit-scrollbar {
        display: none;
    }

    .sub-header .task-quick-filters__btn {
        flex-shrink: 0;
    }

    /* Tables scroll sideways in their box: column titles and status pills keep one line
       instead of squeezing into each other. */
    .table-container th,
    .table-container .type-status {
        white-space: nowrap;
    }

    /* Cards inside cards: less padding, so phone forms and lists keep their width. */
    .content-fncal,
    .content-task {
        padding: 14px 12px;
    }

    .content-fncal .content-task {
        padding: 0;
    }

    .sec-head h2 {
        font-size: 15px;
    }

    .sec-head .btn-site {
        height: 36px;
        padding: 8px 14px;
    }
}

@keyframes wk-drawer-in-left {
    from { transform: translateX(-100%); }
    to { transform: none; }
}

@keyframes wk-drawer-in-right {
    from { transform: translateX(100%); }
    to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .main_asid,
    .wk-drawer-backdrop {
        transition: none;
    }

    .aside_financial.wk-sub-open {
        animation: none;
    }
}

/* Sign-in pages (login, sign-up, code, passwords, workspace picker): on phones and
   tablets the form comes first; the welcome picture is only for wide screens. The
   logo sits on the row of the language switcher, at the other end. */
@media (max-width: 991.98px) {
    .section_sign_page:before {
        display: none;
    }

    .section_sign_page .wlc-sign {
        padding: 22px 0 0;
    }

    .section_sign_page .txt-wlc-sign {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 0;
    }

    .section_sign_page .txt-wlc-sign figure {
        margin: 0;
    }

    .section_sign_page .txt-wlc-sign figure img {
        max-width: 104px;
    }

    .section_sign_page .txt-wlc-sign h2,
    .section_sign_page .thumb-sign {
        display: none;
    }

    .cont-sign {
        height: auto;
        padding: 28px 0 32px;
    }

    .tp-reg {
        margin-bottom: 28px;
    }

    .policy-sign {
        position: static;
        margin-top: 28px;
    }
}

/* Sign-up wizard (subscriptions/newSubscription): on phones and tablets the green
   panel becomes a header (logo, language, the steps in one row) and the form takes the
   full width. "html[dir] body" outranks the fixed 450px side panel rules of rtl.css,
   which loads after this file on that page. */
@media (max-width: 991.98px) {
    html[dir] body .wizard-container {
        flex-direction: column;
    }

    html[dir] body .aside-timeline {
        position: static;
        width: 100%;
        height: auto;
        gap: 0;
    }

    html[dir] body .aside-timeline .logo-site {
        padding: 16px;
    }

    html[dir] body .aside-timeline .logo-site img {
        max-width: 104px;
    }

    html[dir] body .timeline {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        padding: 0 16px 16px;
    }

    html[dir] body .step {
        flex: 1 1 0;
        flex-direction: column;
        gap: 6px;
        margin: 0;
        text-align: center;
    }

    html[dir] body .step:before,
    html[dir] body .step:after,
    html[dir] body .txt-step p {
        display: none;
    }

    html[dir] body .icon-step {
        width: 36px;
        height: 36px;
    }

    html[dir] body .txt-step h3 {
        margin: 0;
        font-size: 11px;
        line-height: 1.4;
    }

    html[dir] body .wizard-container .tab-content {
        min-height: 0;
        padding: 0;
    }

    html[dir] body .wizard-container .tab-content .tab {
        padding: 24px 16px 32px;
    }

    html[dir] body .tab .sec-head {
        margin-bottom: 24px;
    }

    html[dir] body .tab .sec-head h2 {
        font-size: 22px;
    }

    html[dir] body .tab .form-inpt,
    html[dir] body .navigation-buttons {
        width: 100%;
    }

    html[dir] body .navigation-buttons {
        margin-top: 32px;
        gap: 12px;
    }

    html[dir] body .navigation-buttons button {
        height: 48px;
    }
}

@media (max-width: 575.98px) {
    html[dir] body .lst-many li {
        width: 50%;
        margin-bottom: 0;
    }
}
