/* =============================================================
   sha8lny.com — Responsive desktop upgrade (RESPONSIVE_DESKTOP_V2)
   -------------------------------------------------------------
   ADDITIVE + REVERSIBLE. Every rule is scoped to `body.rx-desktop`
   and wrapped in a min-width media query. Under 768px this file
   makes ZERO changes — the mobile baseline in app.css is the source
   of truth. "Preserve the experience. Expand the canvas."
   ============================================================= */

body.rx-desktop {
    /* Focused default: unclassified pages (login, profile/job edit, settings,
       legal, simple forms) stay in a comfortable centered column and never
       stretch. Pages that benefit from breadth opt into a wider shell below. */
    --rx-shell: 680px;
    --rx-form-col: 600px;        /* focused form column */
    --rx-header: 1200px;         /* header/footer bar width (independent of page shell) */
    --rx-gap: 24px;
}

/* Per-page shell widths (set via @yield('body-class')). */
body.rx-desktop.shell-home { --rx-shell: 1240px; }
body.rx-desktop.shell-listing { --rx-shell: 1300px; }
body.rx-desktop.shell-dashboard { --rx-shell: 1120px; }
body.rx-desktop.shell-detail { --rx-shell: 960px; }
body.rx-desktop.shell-form { --rx-shell: 1080px; }
body.rx-desktop.shell-inbox { --rx-shell: 860px; }

/* =========================================================
   TABLET + DESKTOP SHELL (>= 768px)
   ========================================================= */
@media (min-width: 768px) {
    body.rx-desktop .app {
        max-width: none;
        margin: 0;
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
        background: var(--bg);
        min-height: 100vh;
    }

    /* Full-bleed header bar with an inner constrained row. */
    body.rx-desktop .topbar {
        position: sticky;
        top: 0;
        display: flex;
        grid-template-columns: none;
        align-items: center;
        gap: 20px;
        padding: 14px max(24px, calc((100% - var(--rx-header)) / 2));
        box-shadow: 0 1px 0 var(--border);
    }

    body.rx-desktop .topbar .brand { justify-self: unset; }
    body.rx-desktop .topbar .back-btn { display: none; }
    /* Collapse the mobile centering slot on desktop. */
    body.rx-desktop .topbar .topbar-edge { display: none; }
    body.rx-desktop .topbar .topbar-account {
        width: auto;
        flex: 0 0 auto;
        margin-inline-start: auto;
    }
    /* Trailing account/login controls pin to the far edge. */
    body.rx-desktop .topbar .guest-login-actions { margin-inline-start: auto; }

    /* Constrain + center the main content column. */
    body.rx-desktop .content {
        width: 100%;
        max-width: var(--rx-shell);
        margin: 0 auto;
        padding: 28px 24px 48px;
    }
    /* Sticky bottom CTA is a mobile pattern; desktop actions live in-flow. */
    body.rx-desktop .content.has-sticky { padding-bottom: 48px; }

    body.rx-desktop .footer {
        max-width: var(--rx-header);
        margin: 0 auto;
    }
}

/* Desktop header nav is hidden on mobile/tablet, shown >= 1024px. */
body.rx-desktop .desktop-nav,
body.rx-desktop .guest-login-actions { display: none; }

@media (min-width: 1024px) {
    body.rx-desktop .desktop-nav {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-inline-start: 16px;
        font-size: 15px;
        font-weight: 700;
    }
    body.rx-desktop .desktop-nav a {
        padding: 9px 14px;
        border-radius: 12px;
        color: var(--muted);
        white-space: nowrap;
    }
    body.rx-desktop .desktop-nav a:hover { background: #f1f5f4; color: var(--text); }
    body.rx-desktop .desktop-nav a.active { color: var(--green-dark); background: #eafff2; }
    body.rx-desktop .desktop-nav .rapid-access-nav-link {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        border: 1px solid #f0d48b;
        background: linear-gradient(135deg, #fff9e8, #fff3c9);
        color: #76520b;
    }
    body.rx-desktop .desktop-nav .rapid-access-nav-link:hover,
    body.rx-desktop .desktop-nav .rapid-access-nav-link.active {
        border-color: #dcae38;
        background: linear-gradient(135deg, #fff4cd, #ffe9a2);
        color: #5f4005;
        box-shadow: 0 6px 18px rgba(176, 126, 16, .12);
    }
    body.rx-desktop .desktop-nav-menu {
        position: relative;
    }
    body.rx-desktop .desktop-nav-menu > summary {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 9px 14px;
        border-radius: 12px;
        color: var(--muted);
        white-space: nowrap;
        list-style: none;
        cursor: pointer;
    }
    body.rx-desktop .desktop-nav-menu > summary::-webkit-details-marker {
        display: none;
    }
    body.rx-desktop .desktop-nav-menu > summary:hover,
    body.rx-desktop .desktop-nav-menu > summary:focus-visible,
    body.rx-desktop .desktop-nav-menu[open] > summary {
        background: #f1f5f4;
        color: var(--text);
        outline: none;
    }
    body.rx-desktop .desktop-nav-menu > summary.active {
        background: #eafff2;
        color: var(--green-dark);
    }
    body.rx-desktop .desktop-nav-menu > summary span {
        font-size: 13px;
        transition: transform .16s ease;
    }
    body.rx-desktop .desktop-nav-menu[open] > summary span {
        transform: rotate(180deg);
    }
    body.rx-desktop .desktop-nav-dropdown {
        position: absolute;
        inset-inline-start: 0;
        top: calc(100% + 8px);
        z-index: 40;
        display: grid;
        width: 286px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: var(--card);
        box-shadow: var(--shadow-lg);
    }
    body.rx-desktop .desktop-nav-dropdown .desktop-nav-dropdown-label {
        padding: 7px 10px 4px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
    }
    body.rx-desktop .desktop-nav-dropdown a {
        display: grid;
        gap: 2px;
        padding: 9px 10px;
        border-radius: 10px;
        white-space: normal;
    }
    body.rx-desktop .desktop-nav-dropdown a strong {
        color: var(--text);
        font-size: 13px;
    }
    body.rx-desktop .desktop-nav-dropdown a small {
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
        line-height: 1.45;
    }
    body.rx-desktop .desktop-nav-dropdown a.active strong {
        color: var(--green-dark);
    }
    body.rx-desktop .desktop-nav-dropdown .desktop-nav-dropdown-rapid-access {
        margin-block: 3px;
        border: 1px solid #efd58f;
        background: linear-gradient(135deg, #fffaf0, #fff3cf);
    }
    body.rx-desktop .desktop-nav-dropdown .desktop-nav-dropdown-rapid-access:hover,
    body.rx-desktop .desktop-nav-dropdown .desktop-nav-dropdown-rapid-access:focus-visible {
        border-color: #dcaf3d;
        background: linear-gradient(135deg, #fff5d4, #ffe9a9);
        outline: none;
    }
    body.rx-desktop .desktop-nav-dropdown .desktop-nav-dropdown-rapid-access strong {
        color: #6d4d08;
    }
    body.rx-desktop .desktop-nav .desktop-nav-cta {
        background: var(--green);
        color: #fff;
        margin-inline-start: 4px;
    }
    body.rx-desktop .desktop-nav .desktop-nav-cta:hover { background: var(--green-dark); color: #fff; }
    body.rx-desktop .desktop-nav .desktop-nav-cta.outline {
        background: transparent;
        color: var(--text);
        border: 2px solid var(--border);
    }
    body.rx-desktop .desktop-nav .desktop-nav-cta.outline:hover { border-color: var(--green); background: #eafff2; }

    body.rx-desktop .guest-login-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    body.rx-desktop .guest-login-link {
        display: inline-flex;
        align-items: center;
        padding: 9px 13px;
        border-radius: 12px;
        border: 2px solid var(--border);
        font-weight: 800;
        font-size: 14px;
        white-space: nowrap;
    }
    body.rx-desktop .guest-login-link:hover { border-color: var(--green); }
    body.rx-desktop .guest-login-link.business {
        border-color: #bfe9cf;
        background: #eafff2;
        color: var(--green-dark);
    }
    body.rx-desktop .guest-mobile-menu { display: none; }
}

/* =========================================================
   TYPOGRAPHY — modest desktop scale, controlled line length
   ========================================================= */
@media (min-width: 1024px) {
    body.rx-desktop h1 { font-size: 32px; }
    body.rx-desktop h2 { font-size: 24px; }
    /* Keep Arabic paragraphs readable — never full shell width. */
    body.rx-desktop .content > p,
    body.rx-desktop .seo-intro p,
    body.rx-desktop .hero p { max-width: 68ch; }
}

/* =========================================================
   HOMEPAGE — two-column hero + multi-column sections
   ========================================================= */
@media (min-width: 1024px) {
    body.rx-desktop.shell-home .hero {
        display: grid;
        grid-template-columns: 1.15fr 0.85fr;
        align-items: center;
        gap: 40px;
        padding: 48px 44px;
        text-align: right;
    }
    body.rx-desktop.shell-home .hero > .emoji { display: none; }
    body.rx-desktop.shell-home .hero .rx-hero-copy { grid-column: 1; }
    body.rx-desktop.shell-home .hero h1 { font-size: 40px; line-height: 1.25; }
    body.rx-desktop.shell-home .hero p { font-size: 18px; max-width: 52ch; }

    body.rx-desktop.shell-home .hero-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Hero CTAs sit inline instead of stacked full-width. */
    body.rx-desktop.shell-home .hero .hero-actions .btn {
        display: inline-flex;
        width: auto;
        margin: 0;
    }

    /* Visual/preview panel on the left (RTL). */
    body.rx-desktop.shell-home .rx-hero-visual {
        grid-column: 2;
        display: grid;
        place-items: center;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 24px;
        padding: 30px 26px;
        box-shadow: var(--shadow-lg);
        min-height: 260px;
    }
    body.rx-desktop.shell-home .rx-hero-visual .rx-hero-note { color: var(--muted); font-size: 15px; margin-top: 12px; text-align: center; }

    /* value-grid 2-col -> 4-col on desktop. */
    body.rx-desktop.shell-home .value-grid { grid-template-columns: repeat(4, 1fr); }
    /* how-it-works step list reads better as a row. */
    body.rx-desktop.shell-home .steps-list { flex-direction: row; }
    body.rx-desktop.shell-home .steps-list .step-item { flex: 1; }

    /* Latest jobs preview as a responsive grid. */
    body.rx-desktop.shell-home .rx-jobs-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        align-items: stretch;
    }
    body.rx-desktop.shell-home .rx-jobs-grid + .btn { width: auto; display: inline-flex; margin-top: 18px; }
}

/* =========================================================
   RESPONSIVE GRID PRIMITIVE (cards)
   ========================================================= */
@media (min-width: 768px) {
    body.rx-desktop .rx-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        align-items: stretch;
    }
}
@media (min-width: 1280px) {
    body.rx-desktop .rx-grid.rx-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Equal-height cards with actions pinned to the bottom, so CTAs line up
   across every card in a row regardless of body length. */
@media (min-width: 768px) {
    body.rx-desktop .rx-grid > .card,
    body.rx-desktop .rx-jobs-grid > .card,
    body.rx-desktop .rx-results-cards > .card {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    body.rx-desktop .rx-grid > .card > .btn-row,
    body.rx-desktop .rx-grid > .card > .btn:last-child,
    body.rx-desktop .rx-jobs-grid > .card > .btn-row,
    body.rx-desktop .rx-jobs-grid > .card > .btn:last-child,
    body.rx-desktop .rx-results-cards > .card > .btn-row,
    body.rx-desktop .rx-results-cards > .card > .btn:last-child {
        margin-top: auto;
    }
}

/* =========================================================
   LISTINGS — filter sidebar + results grid (jobs / workers)
   ========================================================= */
@media (min-width: 1024px) {
    body.rx-desktop.shell-listing .rx-listing {
        display: grid;
        grid-template-columns: 300px 1fr;
        gap: 28px;
        align-items: start;
    }
    /* Filters become a sticky sidebar (right in RTL). */
    body.rx-desktop.shell-listing .rx-listing .filters {
        position: sticky;
        top: 84px;
        margin: 0;
    }
    body.rx-desktop.shell-listing .rx-listing .filters .row { flex-direction: column; }
    body.rx-desktop.shell-listing .rx-listing .filters .row > * { flex: 1 1 100%; }

    body.rx-desktop.shell-listing .rx-results { grid-column: 2; }
    /* These cards are information-dense (kv lists); two columns keeps them
       readable and stops CTA labels wrapping to 3–4 lines. */
    body.rx-desktop.shell-listing .rx-results-cards {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        align-items: stretch;
    }
    /* Empty state should never sit in a single grid cell. */
    body.rx-desktop.shell-listing .rx-results-cards > .empty { grid-column: 1 / -1; }
}

/* =========================================================
   DETAIL PAGES (jobs/show)
   Conservative pass: readable centered column (shell-detail width) with
   related cards in a grid. The live apply/WhatsApp CTAs are intentionally
   left in-flow inside the main card — relocating conversion-critical,
   analytics-tagged actions into a sticky sidebar deserves its own change.
   ========================================================= */

/* =========================================================
   FORMS — focused column + supporting aside
   ========================================================= */
@media (min-width: 1024px) {
    body.rx-desktop.shell-form .rx-form-split {
        display: grid;
        grid-template-columns: var(--rx-form-col) 1fr;
        gap: 40px;
        align-items: start;
    }
    body.rx-desktop.shell-form .rx-form-split .rx-form-main { min-width: 0; }

    /* Supporting column: trust points / what-happens-next. */
    body.rx-desktop.shell-form .rx-form-aside {
        display: block;
        position: sticky;
        top: 84px;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 24px;
        box-shadow: var(--shadow);
    }
    body.rx-desktop.shell-form .rx-form-aside h3 { font-size: 18px; margin: 0 0 14px; }
    body.rx-desktop.shell-form .rx-form-aside ul { list-style: none; margin: 0; padding: 0; }
    body.rx-desktop.shell-form .rx-form-aside li {
        display: flex; gap: 10px; align-items: flex-start;
        padding: 9px 0; color: var(--text); font-size: 15px; font-weight: 600;
    }
    body.rx-desktop.shell-form .rx-form-aside li::before { content: "✓"; color: var(--green-dark); font-weight: 800; }
    /* Multi-step CTA un-fixes and sits inside the form column. */
    body.rx-desktop.shell-form .sticky-cta {
        position: static;
        max-width: none;
        border-top: none;
        padding: 16px 0 0;
        background: transparent;
    }
}

/* =========================================================
   DASHBOARDS — wider, grouped modules
   ========================================================= */
@media (min-width: 1024px) {
    body.rx-desktop.shell-dashboard .rx-dash {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        align-items: start;
    }
    /* Let a module span the full width when tagged. */
    body.rx-desktop.shell-dashboard .rx-dash > .rx-span-2 { grid-column: 1 / -1; }
    /* KPI summary row. */
    body.rx-desktop.shell-dashboard .rx-kpis {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 14px;
    }

    /* In-card action buttons flow inline instead of stretching full width. */
    body.rx-desktop.shell-dashboard .card .btn {
        display: inline-flex;
        width: auto;
        min-width: 160px;
        margin-inline-end: 10px;
    }
    /* Keep the top motivational/profile stack at a comfortable reading width. */
    body.rx-desktop.shell-dashboard .rx-dash-lead { max-width: 720px; }
}

/* Notification inbox uses the focused `shell-inbox` width (see top of file). */

/* =========================================================
   ADMIN / FOUNDER — use more width on large screens
   ========================================================= */
@media (min-width: 1280px) {
    body.rx-desktop .admin-body { max-width: 1360px; }
}
