/* ===== App shell: minimal navbar + left/right sidebars =====
   Used on "app-like" pages (chat, directory) instead of the full marketing
   navbar - see frontend/website/includes/app-navbar.html,
   app-sidebar-left.html, app-sidebar-right.html. Marketing pages (home,
   services, pricing, about, contact) keep the original full-width navbar.html
   and are untouched by anything in this file. */

:root {
    --app-sidebar-w: 260px;
    --app-sidebar-right-w: 280px;
}

/* ---- Navbar ----
   Full-width, not the generic centered .container. The navbar is its own
   row above the sidebars (not beside them), so its content just uses a
   normal edge gutter - it doesn't reserve sidebar-width space the way
   body/main-content does below it (that previously left a large empty gap
   at the start/end of the bar itself, which is what this was changed to
   remove). */
.app-navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 100%;
    padding: 0 24px;
}

.app-navbar-start {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

.app-navbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2, #f4f6fb);
    border-radius: 999px;
    padding: 8px 16px;
    max-width: 240px;
    width: 100%;
    color: var(--text-muted, #64748b);
}

.app-navbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    width: 100%;
    color: var(--text, #0f172a);
}

.app-navbar-end {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

@media (max-width: 860px) {
    .app-navbar-search { display: none; }
}

/* Login/Register: navbar's copy on desktop, the mobile drawer
   (app-sidebar-left)'s copy below that breakpoint - .auth-buttons'
   inline display (toggled by main.js based on auth state) stays in sync on
   both, this just decides which one is actually on screen. */
@media (max-width: 991px) {
    .app-navbar-end .auth-buttons { display: none !important; }
}

@media (min-width: 992px) {
    .app-sidebar-auth { display: none !important; }
}

.app-sidebar-auth {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 4px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-2, #e5e9f2);
}

.app-sidebar-auth .btn-nav-login,
.app-sidebar-auth .btn-nav-primary {
    text-align: center;
    width: 100%;
}

/* Slot navbar-shared.js relocates .user-profile into below 992px (see
   app-sidebar-left.html) - same divider treatment as .app-sidebar-auth
   above (they're mutually exclusive: guests see that, logged-in users see
   this), sitting between the nav links and the language/currency
   switchers. */
#sidebarUserProfileSlot:not(:empty) {
    margin: 4px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-2, #e5e9f2);
}

#sidebarUserProfileSlot .user-profile { display: flex; }

/* The account dropdown's generic min-width: 400px (main.css) doesn't fit
   the ~260px-wide sidebar - it silently overflowed the sidebar's fixed box
   with no horizontal scroll affordance, so opening it looked like nothing
   happened. Anchor it to the trigger's own end edge instead of the
   navbar's `right: 0` (which also assumed a wide navbar-relative
   ancestor) and cap its width to the sidebar's available inner space. */
#sidebarUserProfileSlot .dropdown-menu {
    position: static;
    margin-top: 8px;
    inset-inline-end: auto;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ---- Sidebars (desktop) ---- */
@media (min-width: 992px) {
    body.has-app-sidebar {
        padding-left: var(--app-sidebar-w);
    }

    body.has-app-sidebar-right {
        padding-right: var(--app-sidebar-right-w);
    }

    .app-sidebar-left {
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        bottom: 0;
        width: var(--app-sidebar-w);
        overflow-y: auto;
        background: var(--card, #ffffff);
        padding: 20px 14px;
        z-index: 60;
    }

    .app-sidebar-right {
        position: fixed;
        top: var(--navbar-h);
        right: 0;
        bottom: 0;
        width: var(--app-sidebar-right-w);
        overflow-y: auto;
        background: var(--card, #ffffff);
        padding: 20px 16px;
        z-index: 60;
    }

    [dir="rtl"] .app-sidebar-left { left: auto; right: 0; }
    [dir="rtl"] .app-sidebar-right { right: auto; left: 0; }
    [dir="rtl"] body.has-app-sidebar { padding-left: 0; padding-right: var(--app-sidebar-w); }
    [dir="rtl"] body.has-app-sidebar-right { padding-right: 0; padding-left: var(--app-sidebar-right-w); }

    /* Same fix as the navbar's combined-selector above, same reason: with
       both classes on <body> (directory page), the two single-class rules
       above fight over the same two properties and whichever comes second
       in the stylesheet wins for BOTH - resetting the other side back to 0
       and leaving body with no room reserved for that sidebar at all
       (its content sat underneath the sidebar/off past the viewport edge
       instead of the page shifting to make room). */
    [dir="rtl"] body.has-app-sidebar.has-app-sidebar-right {
        padding-left: var(--app-sidebar-right-w);
        padding-right: var(--app-sidebar-w);
    }
}

.app-sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text, #1e293b);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-sidebar-link svg { flex-shrink: 0; opacity: 0.75; }

.app-sidebar-link:hover {
    background: var(--bg-2, #f4f6fb);
}

.app-sidebar-link.nav-active {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.app-sidebar-link.nav-active svg { opacity: 1; }

.app-sidebar-divider {
    height: 1px;
    margin: 10px 12px;
    background: var(--border-2, #e5e9f2);
}

/* ---- Right sidebar: featured feed (random mix of firms/consultants,
   later also constitution articles/quotes) - each `kind` gets its own
   card look instead of one shared list style, per user request. ---- */
.app-sidebar-right-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.app-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.app-feed-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-2, #e5e9f2);
    background: var(--card, #ffffff);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.app-feed-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.app-feed-card-cover {
    flex-shrink: 0;
    object-fit: cover;
}

.app-feed-card-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.app-feed-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.app-feed-card-kind {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: fit-content;
    padding: 1px 7px;
    border-radius: 999px;
}

.app-feed-card-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.87rem;
    font-weight: 700;
    color: var(--text, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-feed-verified { flex-shrink: 0; }

.app-feed-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Lawyer/consultant card - circular avatar, blue accent (any consultant
   type - lawyer, psychologist, financial, ...; role_display distinguishes
   them, not a fixed color per type). */
.app-feed-card--lawyer .app-feed-card-cover {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.app-feed-card--lawyer .app-feed-card-initials { background: #2563eb; }

.app-feed-card--lawyer .app-feed-card-kind {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

/* Firm card - banner layout: a solid amber accent bar down the start edge
   and the name promoted above the kind badge (reversed from the consultant
   card's order), plus a pill-shaped location tag instead of plain text - a
   structural difference from the consultant row, not just a recolor. */
.app-feed-card--company {
    border-inline-start: 3px solid #d97706;
    background: linear-gradient(0deg, rgba(217, 119, 6, 0.04), rgba(217, 119, 6, 0.04)), var(--card, #ffffff);
}

.app-feed-card--company .app-feed-card-cover {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}

.app-feed-card--company .app-feed-card-initials { background: #d97706; border-radius: 12px; }

.app-feed-card--company .app-feed-card-body { gap: 3px; }

.app-feed-card--company .app-feed-card-kind {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
}

.app-feed-card--company .app-feed-card-meta {
    display: inline-block;
    width: fit-content;
    background: rgba(217, 119, 6, 0.08);
    padding: 1px 8px;
    border-radius: 999px;
}

/* Constitution article card - book icon tile, green accent so it reads as a
   third distinct "type" alongside consultants/firms. Its excerpt is longer
   than a name/location line, so it wraps (clamped to 2 lines) instead of
   the single-line ellipsis the other card kinds use. */
.app-feed-card--article {
    align-items: flex-start;
    background: linear-gradient(0deg, rgba(5, 150, 105, 0.04), rgba(5, 150, 105, 0.04)), var(--card, #ffffff);
}

.app-feed-card--article .app-feed-card-cover--article {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
}

.app-feed-card--article .app-feed-card-kind {
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
}

.app-feed-card--article .app-feed-card-name {
    white-space: normal;
}

.app-feed-card--article .app-feed-card-meta {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

/* Blog-post card - a fully vertical, image-forward layout (full-width
   cover on top, text below) instead of the horizontal avatar-row every
   other card kind uses - the structural shape alone (not just its violet
   accent) marks it as a distinct "type" at a glance. */
.app-feed-card--post {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    overflow: hidden;
    background: var(--card, #ffffff);
}

.app-feed-card-cover--post-image {
    width: 100%;
    height: 100px;
    border-radius: 0;
    object-fit: cover;
}

.app-feed-card-cover--post {
    width: 100%;
    height: 72px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.app-feed-card--post .app-feed-card-body {
    padding: 10px 12px 12px;
}

.app-feed-card--post .app-feed-card-kind {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.app-feed-card--post .app-feed-card-name {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.app-feed-empty {
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
    padding: 8px 0;
    margin: 0;
}

/* ---- Sidebar: language/currency switchers (bottom) ---- */
.app-sidebar-switchers {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-2, #e5e9f2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* The generic .dropdown-menu rule (main.css) is sized for the wide
   account/notification menus (min-width: 400px) - inside a ~260px sidebar
   that overflows to a scroll panel (which forces overflow-x: auto too),
   that 400px panel got clipped by the sidebar's own edge and its text was
   never visible. Override with a width that actually fits. */
.app-sidebar-switchers #currency-switcher {
    min-width: 150px;
    width: max-content;
    max-width: calc(var(--app-sidebar-w) - 40px);
    right: 0;
    left: auto;
}

[dir="rtl"] .app-sidebar-switchers #currency-switcher {
    right: auto;
    left: 0;
}

/* ---- Mobile: sidebars become a toggled drawer ---- */
@media (max-width: 991px) {
    .app-sidebar-right { display: none; }

    .app-sidebar-left {
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        bottom: 0;
        width: 260px;
        background: var(--card, #fff);
        padding: 20px 14px;
        overflow-y: auto;
        z-index: 200;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 30px rgba(0,0,0,0.15);
    }

    [dir="rtl"] .app-sidebar-left { left: auto; right: 0; transform: translateX(105%); }

    .app-sidebar-left.app-sidebar-open {
        transform: translateX(0);
    }

    .app-sidebar-toggle {
        display: flex !important;
    }
}

@media (min-width: 992px) {
    .app-sidebar-toggle { display: none !important; }
}
