/* ══════════════════════════════════════════════════════════
   dr.ps Feed — Facebook-inspired 3-column layout (RTL)
   Scope: only on body.feed-page (avoids clobbering classic pages)
══════════════════════════════════════════════════════════ */
body.feed-page {
    /* Medical palette derived from dr.ps logo (navy + orange + white) */
    --fd-primary:   #1E40AF;  /* medical navy — trust, authority */
    --fd-primary-d: #1E3A8A;  /* deeper navy for hover */
    --fd-primary-l: #DBEAFE;  /* very light blue tint for backgrounds */
    --fd-accent:    #EA580C;  /* brand orange — warmth, CTAs */
    --fd-accent-d:  #C2410C;
    --fd-accent-l:  #FFEDD5;
    --fd-teal:      #0891B2;  /* clinical teal — "online", live status */
    --fd-teal-l:    #CFFAFE;
    --fd-success:   #059669;  /* genuine success only (used sparingly) */
    --fd-danger:    #DC2626;  /* emergencies, errors, urgent */
    --fd-text:      #0F172A;  /* slate-900 */
    --fd-text-2:    #475569;  /* slate-600 */
    --fd-border:    #E2E8F0;  /* slate-200 */
    --fd-surface:   #ffffff;
    --fd-bg:        #F1F5F9;  /* slate-100 — clean hospital backdrop */
    --fd-hover:     #EFF6FF;  /* blue-50 */
    --fd-shadow:    0 1px 2px rgba(30,64,175,.06);
    --fd-shadow-h:  0 4px 14px rgba(30,64,175,.12);
    --fd-topbar-h:  56px;
    --fd-radius:    12px;

    background: var(--fd-bg);
    font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
    color: var(--fd-text);
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ── Always hide the OLD classic site header when our shell is active ── */
body.feed-page > header.fixed-top,
body.feed-page > .backmask {
    display: none !important;
}

/* ── Hide footer + WhatsApp button ONLY on the actual feed home page ── */
body.feed-page.fd-is-feed > footer.hide-print,
body.feed-page.fd-is-feed .whatsapp.hide-print {
    display: none !important;
}

/* ── Shell layout for non-feed pages ────────────────────────────
   The topbar is sticky (in flow), so we just need a bit of bottom
   padding on mobile to clear the bottom-nav. We DO NOT add max-width
   here — dashboards use their own container-fluid grid and would
   break if we constrained them. Simple text pages can opt in via
   <div class="fd-shell-narrow"> instead. */
body.feed-page:not(.fd-is-feed) {
    padding-top: 0 !important;
}
@media (max-width: 768px) {
    body.feed-page:not(.fd-is-feed) > .fd-shell-content {
        padding-bottom: 70px; /* clear the bottom-nav */
    }
}

/* Opt-in narrow container for simple text/form pages
   (login, signup, privacy, terms, etc.) */
.fd-shell-narrow {
    max-width: 720px;
    margin: 20px auto;
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow);
    padding: 24px;
}
@media (max-width: 768px) {
    .fd-shell-narrow { margin: 10px; padding: 16px; }
}

/* ══════════════════════════════════════════════════════════
   Legacy color normalization
   ─────────────────────────────────
   Many existing pages hard-coded the old "pharmacy green"
   palette inline. We can't touch their content per the brief,
   so we map the most common offenders to the medical palette
   when they appear inside our shell. Conservative scope:
   only background-color / color on elements that aren't
   explicit framework components.
══════════════════════════════════════════════════════════ */
body.feed-page .btn-success,
body.feed-page .bg-success {
    background-color: var(--fd-primary) !important;
    border-color: var(--fd-primary) !important;
}
body.feed-page .text-success { color: var(--fd-primary) !important; }
body.feed-page a.text-success:hover { color: var(--fd-primary-d) !important; }

/* Old hero gradient backgrounds → medical navy gradient */
body.feed-page [style*="linear-gradient"][style*="064e3b"],
body.feed-page [style*="linear-gradient"][style*="065f46"],
body.feed-page [style*="linear-gradient"][style*="047857"] {
    background: linear-gradient(135deg, #1E3A8A, #1E40AF, #0891B2) !important;
}

/* Common "old primary green" button-like elements */
body.feed-page [style*="background:#0EA968"],
body.feed-page [style*="background: #0EA968"],
body.feed-page [style*="background-color:#0EA968"],
body.feed-page [style*="background-color: #0EA968"] {
    background-color: var(--fd-primary) !important;
}
body.feed-page [style*="color:#0EA968"],
body.feed-page [style*="color: #0EA968"] { color: var(--fd-primary) !important; }
body.feed-page [style*="color:#047857"],
body.feed-page [style*="color: #047857"] { color: var(--fd-primary-d) !important; }

/* Extend coverage for hero/banner gradients commonly written in pages */
body.feed-page section[style*="064e3b"],
body.feed-page section[style*="065f46"],
body.feed-page section[style*="047857"],
body.feed-page section[style*="059669"],
body.feed-page section[style*="0EA968"],
body.feed-page div[style*="background"][style*="064e3b"],
body.feed-page div[style*="background"][style*="065f46"],
body.feed-page div[style*="background"][style*="047857"],
body.feed-page div[style*="background"][style*="059669"],
body.feed-page div[style*="background"][style*="0EA968"],
body.feed-page div[style*="background"][style*="0ea968"],
body.feed-page div[style*="background"][style*="10b981"],
body.feed-page div[style*="background"][style*="16a34a"],
body.feed-page div[style*="background"][style*="22c55e"] {
    background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 50%, #0891B2 100%) !important;
}

/* Common standalone green text/icons → navy */
body.feed-page [style*="color:#059669"],
body.feed-page [style*="color: #059669"],
body.feed-page [style*="color:#10b981"],
body.feed-page [style*="color: #10b981"],
body.feed-page [style*="color:#16a34a"],
body.feed-page [style*="color: #16a34a"],
body.feed-page [style*="color:#22c55e"],
body.feed-page [style*="color: #22c55e"] { color: var(--fd-primary) !important; }

/* Whatsapp & WA-themed buttons keep their brand green
   (they are NOT part of our palette — they're WhatsApp brand).
   The overrides above are specific to known palette hex codes only. */

[data-theme="dark"] body.feed-page,
body.feed-page[data-theme="dark"] {
    --fd-text:    #e4e6eb;
    --fd-text-2:  #b0b3b8;
    --fd-border:  #3a3b3c;
    --fd-surface: #242526;
    --fd-bg:      #18191a;
    --fd-hover:   #3a3b3c;
}

/* ══════════════════════════════════════════════════════════
   Topbar — sticky
══════════════════════════════════════════════════════════ */
.fd-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--fd-topbar-h);
    background: var(--fd-surface);
    border-bottom: 1px solid var(--fd-border);
    box-shadow: var(--fd-shadow);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
}

.fd-topbar-left,
.fd-topbar-center,
.fd-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fd-topbar-right { justify-content: flex-start; }
.fd-topbar-left  { justify-content: flex-end; }

.fd-logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: inherit;
}
.fd-logo img { width: 40px; height: 40px; border-radius: 50%; object-fit: contain; background: #fff; }
.fd-logo-text {
    font-size: 14px; font-weight: 800; color: var(--fd-primary);
    line-height: 1.1;
}
.fd-logo-text small { display: block; font-size: 10px; color: var(--fd-text-2); font-weight: 500; }

/* ── Search ── */
.fd-search {
    position: relative;
    width: 100%; max-width: 360px;
}
.fd-search-input-wrap {
    position: relative;
    display: flex; align-items: center;
    background: var(--fd-bg); border-radius: 50px;
    padding: 0 16px; height: 40px;
}
.fd-search-input-wrap i { color: var(--fd-text-2); margin-inline-end: 8px; }
.fd-search input {
    flex: 1; background: transparent; border: 0; outline: 0;
    font-size: 14px; color: var(--fd-text);
    font-family: inherit;
}
.fd-search input::placeholder { color: var(--fd-text-2); }

.fd-search-suggest {
    position: absolute;
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: calc(100% + 6px);
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow-h);
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 0;
    display: none;
    z-index: 1100;
}
.fd-search-suggest.open { display: block; }

.fd-suggest-group-label {
    padding: 8px 14px 4px;
    font-size: 11px; font-weight: 700; color: var(--fd-text-2);
    text-transform: uppercase; letter-spacing: .5px;
}
.fd-suggest-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    text-decoration: none; color: var(--fd-text);
    cursor: pointer;
    transition: background .15s;
}
.fd-suggest-item:hover,
.fd-suggest-item.active { background: var(--fd-hover); }
.fd-suggest-item-ic {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.fd-suggest-item-body { flex: 1; min-width: 0; }
.fd-suggest-item-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-suggest-item-meta  { font-size: 11px; color: var(--fd-text-2); }
.fd-suggest-empty { padding: 14px; text-align: center; color: var(--fd-text-2); font-size: 13px; }

/* ── Nav pills (desktop) ── */
.fd-nav {
    display: flex; align-items: center; gap: 6px;
}
.fd-nav-item {
    padding: 0 30px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: var(--fd-text-2);
    text-decoration: none;
    font-size: 20px;
    position: relative;
    transition: background .15s;
}
.fd-nav-item:hover { background: var(--fd-hover); color: var(--fd-text); }
.fd-nav-item.active { color: var(--fd-primary); }
.fd-nav-item.active::after {
    content: ''; position: absolute; bottom: -2px; inset-inline: 12px; height: 3px;
    background: var(--fd-primary); border-radius: 2px;
}

/* ── Topbar action icons (notif, msgs, account) ── */
.fd-icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--fd-bg);
    border: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--fd-text); cursor: pointer;
    position: relative;
    text-decoration: none;
    transition: background .15s;
}
.fd-icon-btn:hover { background: var(--fd-hover); }
.fd-icon-btn .fd-badge {
    position: absolute; top: -2px; inset-inline-end: -2px;
    background: #e41e3f; color: #fff;
    font-size: 11px; font-weight: 700;
    border-radius: 100px; padding: 2px 6px;
    min-width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--fd-surface);
}

/* ── Account dropdown ── */
.fd-account { position: relative; }
.fd-account-btn { padding: 0; overflow: hidden; }
.fd-account-btn img,
.fd-account-btn .fd-avatar-fallback {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
}

.fd-dropdown {
    position: absolute;
    inset-inline-end: 0; top: calc(100% + 8px);
    width: 320px;
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow-h);
    padding: 8px;
    display: none;
    z-index: 1100;
}
.fd-dropdown.open { display: block; }
.fd-dropdown-header {
    padding: 10px; display: flex; align-items: center; gap: 12px;
    border-radius: 8px; background: var(--fd-bg);
    margin-bottom: 8px;
}
.fd-dropdown-header .fd-avatar-fallback,
.fd-dropdown-header img {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
}
.fd-dropdown-header .name { font-size: 15px; font-weight: 700; }
.fd-dropdown-header .sub { font-size: 12px; color: var(--fd-text-2); }

.fd-dropdown-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: 8px;
    color: var(--fd-text); text-decoration: none;
    font-size: 14px;
    transition: background .15s;
    border: 0; background: transparent; width: 100%; cursor: pointer;
    font-family: inherit;
}
.fd-dropdown-item:hover { background: var(--fd-hover); }
.fd-dropdown-item i { width: 24px; text-align: center; color: var(--fd-text-2); }

.fd-dropdown-divider {
    height: 1px; background: var(--fd-border); margin: 6px -8px;
}

/* ── Notifications dropdown ── */
.fd-notif-dropdown {
    width: 360px; max-height: 70vh; overflow-y: auto;
}
.fd-notif-dropdown h4 {
    font-size: 18px; font-weight: 700; margin: 8px 10px 12px;
}
.fd-notif-empty {
    padding: 30px 16px; text-align: center; color: var(--fd-text-2); font-size: 14px;
}
.fd-notif-item {
    display: flex; gap: 12px; padding: 10px;
    border-radius: 8px;
    text-decoration: none; color: var(--fd-text);
    transition: background .15s;
}
.fd-notif-item:hover { background: var(--fd-hover); }
.fd-notif-item.unread { background: var(--fd-primary-l); }
.fd-notif-item.unread:hover { background: #C7DBFB; }
.fd-notif-ic {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--fd-bg); color: var(--fd-text-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.fd-notif-body { flex: 1; min-width: 0; }
.fd-notif-content { font-size: 14px; line-height: 1.5; }
.fd-notif-time { font-size: 12px; color: var(--fd-primary); margin-top: 4px; }

/* ══════════════════════════════════════════════════════════
   Main 3-column layout
══════════════════════════════════════════════════════════ */
.fd-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    align-items: start;
}

.fd-rail {
    position: sticky;
    top: calc(var(--fd-topbar-h) + 16px);
    max-height: calc(100vh - var(--fd-topbar-h) - 24px);
    overflow-y: auto;
    padding-inline-end: 4px;
}
.fd-rail::-webkit-scrollbar { width: 6px; }
.fd-rail::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.fd-rail:hover::-webkit-scrollbar-thumb { background: #bbb; }

.fd-main { min-width: 0; }

/* ══════════════════════════════════════════════════════════
   Cards (shared)
══════════════════════════════════════════════════════════ */
.fd-card {
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow);
    margin-bottom: 16px;
    overflow: hidden;
}
.fd-card-header {
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--fd-border);
}
.fd-card-header h3 {
    font-size: 15px; font-weight: 700; margin: 0; flex: 1;
}
.fd-card-header .fd-card-link {
    font-size: 13px; color: var(--fd-primary); text-decoration: none; font-weight: 600;
}
.fd-card-body { padding: 16px; }

/* ── User card (left rail) ── */
.fd-user-card { padding: 14px; }
.fd-user-card .row1 {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
    text-decoration: none; color: inherit;
}
.fd-user-card .av {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
    overflow: hidden;
}
.fd-user-card .av img { width: 100%; height: 100%; object-fit: cover; }
.fd-user-card .name { font-size: 15px; font-weight: 700; }
.fd-user-card .meta { font-size: 12px; color: var(--fd-text-2); }

/* ── Left rail nav items ── */
.fd-rail-nav { padding: 4px; }
.fd-rail-nav .item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: 8px;
    color: var(--fd-text); text-decoration: none;
    font-size: 14px; font-weight: 600;
    transition: background .15s;
}
.fd-rail-nav .item:hover { background: var(--fd-hover); }
.fd-rail-nav .item i {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
}
.fd-rail-nav .item .badge-count {
    margin-inline-start: auto;
    background: var(--fd-primary); color: #fff;
    font-size: 11px; font-weight: 700;
    border-radius: 100px; padding: 2px 8px;
}

/* ── Quick actions strip ── */
.fd-quick {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
}
.fd-quick a {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding: 12px;
    background: var(--fd-bg); border-radius: 10px;
    color: var(--fd-text); text-decoration: none;
    font-size: 12px; font-weight: 700;
    text-align: center;
    transition: transform .15s, background .15s;
}
.fd-quick a:hover { background: var(--fd-primary-l); transform: translateY(-2px); color: var(--fd-primary); }
.fd-quick a i {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--fd-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.fd-quick a.urgent i { background: #e41e3f; }

/* ── Stories bar (health campaigns) ── */
.fd-stories {
    display: flex; gap: 8px;
    padding: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.fd-stories::-webkit-scrollbar { display: none; }
.fd-story {
    flex-shrink: 0;
    width: 112px; height: 200px;
    border-radius: var(--fd-radius);
    background-size: cover; background-position: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    color: #fff; text-decoration: none;
    box-shadow: var(--fd-shadow);
    transition: transform .15s;
}
.fd-story:hover { transform: scale(1.02); color: #fff; }
.fd-story::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.7) 0%, rgba(0,0,0,0) 60%);
}
.fd-story-title {
    position: absolute;
    inset-inline-start: 8px; inset-inline-end: 8px; bottom: 8px;
    font-size: 13px; font-weight: 700; line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0,0,0,.5);
    z-index: 2;
}
.fd-story-tag {
    position: absolute; top: 8px; inset-inline-start: 8px;
    background: var(--fd-primary); color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 100px;
    z-index: 2;
}

/* ══════════════════════════════════════════════════════════
   Feed cards
══════════════════════════════════════════════════════════ */
.fd-feed-card {
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

/* Doctor recommendation card */
.fd-doc-card-head {
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
}
.fd-doc-card-tag {
    font-size: 11px; font-weight: 800; letter-spacing: .5px;
    color: var(--fd-primary);
    background: var(--fd-primary-l);
    padding: 4px 10px; border-radius: 100px;
}
.fd-doc-card-tag.nearby   { color: var(--fd-teal);   background: var(--fd-teal-l); }
.fd-doc-card-tag.upcoming { color: var(--fd-accent); background: var(--fd-accent-l); }
.fd-doc-card-tag.featured { color: #B45309;          background: #FEF3C7; }
.fd-doc-card-tag.post     { color: var(--fd-primary); background: var(--fd-primary-l); }

.fd-doc-card-body {
    padding: 16px;
    display: flex; gap: 14px;
}
.fd-doc-av {
    width: 80px; height: 80px;
    border-radius: 50%; overflow: hidden;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; flex-shrink: 0;
}
.fd-doc-av img { width: 100%; height: 100%; object-fit: cover; }
.fd-doc-info { flex: 1; min-width: 0; }
.fd-doc-info h3 {
    font-size: 17px; font-weight: 800; margin: 0 0 4px;
}
.fd-doc-info h3 a { color: inherit; text-decoration: none; }
.fd-doc-info h3 a:hover { color: var(--fd-primary); }
.fd-doc-cat {
    display: inline-block;
    font-size: 12px; color: var(--fd-text-2);
    margin-bottom: 6px;
}
.fd-doc-meta {
    display: flex; flex-wrap: wrap; gap: 10px;
    font-size: 12px; color: var(--fd-text-2);
}
.fd-doc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.fd-doc-meta i { font-size: 11px; }
.fd-doc-rating { color: #D97706 !important; font-weight: 700; }

.fd-doc-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--fd-border);
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4px;
}
.fd-msg-doctor-btn {
    border: 0; background: transparent;
    color: var(--fd-text-2); font-size: 13px; font-weight: 700;
    padding: 8px; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-family: inherit; transition: background .15s;
}
.fd-msg-doctor-btn:hover { background: var(--fd-hover); color: var(--fd-primary); }
.fd-doc-actions button,
.fd-doc-actions a {
    border: 0; background: transparent;
    color: var(--fd-text-2); font-size: 13px; font-weight: 700;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    text-decoration: none;
    transition: background .15s;
    font-family: inherit;
}
.fd-doc-actions button:hover,
.fd-doc-actions a:hover { background: var(--fd-hover); }
.fd-doc-actions .primary {
    background: var(--fd-primary); color: #fff;
}
.fd-doc-actions .primary:hover { background: var(--fd-primary-d); }
.fd-doc-actions .fav.is-fav { color: #e41e3f; }
.fd-doc-actions .fav.is-fav i { font-weight: 900; }

/* Reservation reminder card */
.fd-res-card {
    background: linear-gradient(135deg, var(--fd-accent-l) 0%, #FED7AA 100%);
    border-radius: var(--fd-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 14px;
    border-inline-start: 4px solid var(--fd-accent);
}
.fd-res-card .ic {
    width: 52px; height: 52px; border-radius: 50%;
    background: #fff; color: var(--fd-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(234,88,12,.15);
}
.fd-res-card .body { flex: 1; min-width: 0; }
.fd-res-card .body h4 { font-size: 14px; font-weight: 700; margin: 0 0 4px; color: #7C2D12; }
.fd-res-card .body p { font-size: 12px; margin: 0; color: #9A3412; }
.fd-res-card a.go {
    background: var(--fd-accent); color: #fff;
    padding: 8px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
}
.fd-res-card a.go:hover { background: var(--fd-accent-d); color: #fff; }

/* Clinic card */
.fd-clinic-card .fd-doc-card-body {
    flex-direction: column;
}
.fd-clinic-card .fd-doc-av {
    width: 100%; height: 140px; border-radius: 8px;
}

/* ══════════════════════════════════════════════════════════
   Skeleton loading
══════════════════════════════════════════════════════════ */
.fd-skel {
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--fd-shadow);
}
.fd-skel-row { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.fd-skel-circle {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: fdShimmer 1.4s infinite;
}
.fd-skel-line {
    height: 12px; border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: fdShimmer 1.4s infinite;
    margin-bottom: 8px;
}
.fd-skel-line.w-60 { width: 60%; }
.fd-skel-line.w-40 { width: 40%; }
.fd-skel-line.w-80 { width: 80%; }
.fd-skel-block {
    height: 36px; border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: fdShimmer 1.4s infinite;
    margin-top: 10px;
}
@keyframes fdShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ══════════════════════════════════════════════════════════
   Right rail
══════════════════════════════════════════════════════════ */
.fd-online-list { padding: 4px; }
.fd-online-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 8px;
    text-decoration: none; color: var(--fd-text);
    transition: background .15s;
}
.fd-online-item:hover { background: var(--fd-hover); }
.fd-online-av {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    position: relative; overflow: visible;
}
.fd-online-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.fd-online-av .dot {
    position: absolute; bottom: 0; inset-inline-end: 0;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--fd-teal); border: 2px solid var(--fd-surface);
    box-shadow: 0 0 0 2px rgba(8,145,178,.2);
}
.fd-online-body { flex: 1; min-width: 0; }
.fd-online-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-online-cat  { font-size: 11px; color: var(--fd-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Specialty chips in right rail */
.fd-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
.fd-chip {
    background: var(--fd-bg); color: var(--fd-text);
    padding: 6px 12px; border-radius: 100px;
    font-size: 12px; font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.fd-chip:hover { background: var(--fd-primary-l); color: var(--fd-primary); }

/* ══════════════════════════════════════════════════════════
   Sentinel + end-of-feed
══════════════════════════════════════════════════════════ */
.fd-end {
    text-align: center; padding: 30px 12px;
    color: var(--fd-text-2); font-size: 13px;
}
.fd-load-error {
    background: #fee2e2; color: #991b1b;
    padding: 10px 14px; border-radius: 8px;
    margin: 0 0 12px; font-size: 13px; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between;
}
.fd-load-error button {
    background: #991b1b; color: #fff; border: 0;
    padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit;
}

/* ══════════════════════════════════════════════════════════
   Bottom nav (mobile)
══════════════════════════════════════════════════════════ */
.fd-bottom-nav {
    display: none;
    position: fixed;
    inset-inline: 0; bottom: 0;
    background: var(--fd-surface);
    border-top: 1px solid var(--fd-border);
    z-index: 999;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.fd-bottom-nav-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 56px;
}
.fd-bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-decoration: none; color: var(--fd-text-2);
    font-size: 10px; font-weight: 600;
    gap: 2px;
    position: relative;
}
.fd-bottom-nav a i { font-size: 18px; }
.fd-bottom-nav a.active { color: var(--fd-primary); }
.fd-bottom-nav a .fd-badge {
    position: absolute; top: 6px; inset-inline-end: calc(50% - 20px);
    background: #e41e3f; color: #fff;
    font-size: 9px; font-weight: 700;
    border-radius: 100px; padding: 1px 5px;
    min-width: 14px; line-height: 1.3;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════
   Geolocation prompt
══════════════════════════════════════════════════════════ */
.fd-geo-prompt {
    background: linear-gradient(135deg, var(--fd-teal-l) 0%, #A5F3FC 100%);
    border-radius: var(--fd-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 12px;
    border-inline-start: 4px solid var(--fd-teal);
}
.fd-geo-prompt i { font-size: 24px; color: var(--fd-teal); }
.fd-geo-prompt .text { flex: 1; font-size: 13px; color: #155E75; }
.fd-geo-prompt .text strong { display: block; margin-bottom: 2px; }
.fd-geo-prompt button {
    background: var(--fd-teal); color: #fff; border: 0;
    padding: 8px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    font-family: inherit;
}
.fd-geo-prompt .dismiss {
    background: transparent; color: #155E75;
    font-size: 18px; padding: 0 6px;
}

/* ══════════════════════════════════════════════════════════
   Responsive
══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .fd-layout {
        grid-template-columns: 1fr 320px;
        padding: 12px;
    }
    .fd-rail.fd-left { display: none; }
}
@media (max-width: 900px) {
    .fd-nav { display: none; }
    .fd-topbar-center { display: none; }
}
@media (max-width: 768px) {
    .fd-layout {
        grid-template-columns: 1fr;
        padding: 8px;
        padding-bottom: 76px; /* room for bottom nav */
    }
    .fd-rail { display: none; }
    .fd-bottom-nav { display: block; }
    .fd-search { max-width: none; }
    .fd-search-input-wrap { height: 36px; }
    .fd-topbar { grid-template-columns: auto 1fr auto; padding: 0 10px; }
    .fd-logo-text { display: none; }
    .fd-topbar-right { gap: 4px; }
    .fd-icon-btn { width: 36px; height: 36px; font-size: 14px; }
    .fd-quick { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 576px) {
    .fd-doc-card-body { flex-direction: column; align-items: center; text-align: center; }
    .fd-doc-meta { justify-content: center; }
    .fd-doc-actions { grid-template-columns: 1fr 1fr; }
    .fd-doc-actions .primary { grid-column: 1 / -1; }
    .fd-res-card { flex-wrap: wrap; }
    .fd-res-card a.go { width: 100%; text-align: center; }
}

/* Accessibility focus states */
.fd-icon-btn:focus-visible,
.fd-nav-item:focus-visible,
.fd-suggest-item:focus-visible,
.fd-dropdown-item:focus-visible,
.fd-doc-actions button:focus-visible,
.fd-doc-actions a:focus-visible {
    outline: 2px solid var(--fd-primary);
    outline-offset: 2px;
}

/* Hide built-in scrollbar in suggest list */
.fd-search-suggest::-webkit-scrollbar { width: 6px; }
.fd-search-suggest::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ══════════════════════════════════════════════════════════
   PHASE 2 — Posts, Follow, Conversations
══════════════════════════════════════════════════════════ */

/* ── Composer ── */
.fd-composer { padding: 12px; }
.fd-composer-trigger {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 100px;
    background: var(--fd-bg); cursor: pointer;
    color: var(--fd-text-2); font-size: 14px;
    transition: background .15s;
}
.fd-composer-trigger:hover { background: var(--fd-hover); }
.fd-composer-av {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; font-size: 16px; flex-shrink: 0;
}
.fd-composer-av img { width: 100%; height: 100%; object-fit: cover; }

.fd-composer-body { padding-top: 12px; }
.fd-composer-type {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px;
}
.fd-composer-type label { cursor: pointer; }
.fd-composer-type input { display: none; }
.fd-composer-type span {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px; border: 2px solid var(--fd-border);
    border-radius: 8px; font-size: 13px; font-weight: 600;
    color: var(--fd-text-2); transition: all .15s;
}
.fd-composer-type input:checked + span {
    border-color: var(--fd-primary); color: var(--fd-primary);
    background: var(--fd-primary-l);
}
.fd-composer-input,
.fd-composer-text {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--fd-border); border-radius: 8px;
    font-family: inherit; font-size: 14px; margin-bottom: 8px;
    color: var(--fd-text); background: var(--fd-surface);
    resize: vertical;
}
.fd-composer-input:focus,
.fd-composer-text:focus { outline: 2px solid var(--fd-primary); outline-offset: -1px; }
.fd-composer-foot {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.fd-composer-image {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; background: var(--fd-bg); border-radius: 8px;
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--fd-text-2);
}
.fd-composer-image:hover { background: var(--fd-hover); color: var(--fd-primary); }
.fd-composer-imgname { font-size: 12px; color: var(--fd-text-2); flex: 1; min-width: 0;
                       overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-composer-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.fd-composer-actions button {
    padding: 8px 18px; border: 0; border-radius: 8px;
    font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.fd-composer-actions .cancel { background: var(--fd-bg); color: var(--fd-text); }
.fd-composer-actions .cancel:hover { background: var(--fd-hover); }
.fd-composer-actions .submit { background: var(--fd-primary); color: #fff; }
.fd-composer-actions .submit:hover { background: var(--fd-primary-d); }
.fd-composer-actions .submit:disabled { opacity: .5; cursor: not-allowed; }
.fd-composer-msg { margin-top: 10px; font-size: 13px; }
.fd-composer-msg.error   { color: var(--fd-danger); }
.fd-composer-msg.success { color: var(--fd-success); }

/* ── Post card ── */
.fd-post-card { /* inherits fd-feed-card */ }
.fd-post-head {
    padding: 12px 16px;
    display: flex; align-items: center; gap: 10px;
}
.fd-post-author { display: flex; gap: 10px; flex: 1; text-decoration: none; color: inherit; min-width: 0; }
.fd-post-av {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; overflow: hidden; flex-shrink: 0;
}
.fd-post-av img { width: 100%; height: 100%; object-fit: cover; }
.fd-post-name {
    font-size: 14px; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fd-post-meta {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--fd-text-2);
    margin-top: 2px; flex-wrap: wrap;
}
.fd-post-type {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 100px;
    font-size: 11px; font-weight: 700;
}
.fd-post-type-tip      { color: #B45309; background: #FEF3C7; }
.fd-post-type-article  { color: var(--fd-primary); background: var(--fd-primary-l); }
.fd-post-type-announce { color: var(--fd-accent);  background: var(--fd-accent-l); }
.fd-post-delete {
    width: 36px; height: 36px; border-radius: 50%;
    border: 0; background: transparent; color: var(--fd-text-2);
    cursor: pointer; transition: background .15s;
}
.fd-post-delete:hover { background: #FEE2E2; color: var(--fd-danger); }

.fd-post-body { padding: 0 16px 12px; }
.fd-post-title {
    font-size: 17px; font-weight: 800; line-height: 1.4;
    margin: 0 0 8px; color: var(--fd-text);
}
.fd-post-text {
    font-size: 14px; line-height: 1.8; color: var(--fd-text);
    word-break: break-word;
}
.fd-post-image {
    width: 100%; max-height: 480px; object-fit: cover;
    border-radius: 8px; margin-top: 12px;
}
.fd-post-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 10px; padding: 8px 12px;
    background: var(--fd-primary-l); color: var(--fd-primary);
    border-radius: 8px; font-size: 13px; font-weight: 600;
    text-decoration: none;
}
.fd-post-link:hover { background: #BFDBFE; color: var(--fd-primary-d); }

.fd-post-stats {
    padding: 8px 16px;
    display: flex; gap: 14px;
    font-size: 12px; color: var(--fd-text-2);
    border-top: 1px solid var(--fd-border);
}

.fd-post-actions {
    padding: 6px;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    border-top: 1px solid var(--fd-border);
}
.fd-post-actions button,
.fd-post-actions a {
    border: 0; background: transparent; cursor: pointer;
    padding: 10px; border-radius: 8px;
    font-family: inherit; font-size: 13px; font-weight: 700;
    color: var(--fd-text-2); text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background .15s;
}
.fd-post-actions button:hover,
.fd-post-actions a:hover { background: var(--fd-hover); }
.fd-post-like-btn.active   { color: var(--fd-primary); }
.fd-post-save-btn.active   { color: var(--fd-accent); }
.fd-post-book-btn          { color: var(--fd-primary) !important; }

/* ── Follow button on doctor cards ── */
.fd-follow-btn {
    border: 0; padding: 8px 16px; border-radius: 8px;
    background: var(--fd-primary); color: #fff;
    font-family: inherit; font-size: 12px; font-weight: 700;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s;
}
.fd-follow-btn:hover { background: var(--fd-primary-d); }
.fd-follow-btn.following {
    background: var(--fd-bg); color: var(--fd-text);
    border: 1px solid var(--fd-border);
}
.fd-follow-btn.following:hover { background: #FEE2E2; color: var(--fd-danger); border-color: #FCA5A5; }
.fd-follow-btn.following:hover .followed-lbl { display: none; }
.fd-follow-btn.following:hover .unfollow-lbl { display: inline; }
.fd-follow-btn.following .unfollow-lbl { display: none; }

/* ── Conversation list page ── */
.fd-conv-wrap {
    max-width: 1100px; margin: 0 auto; padding: 16px;
    display: grid; grid-template-columns: 340px 1fr; gap: 16px;
    min-height: calc(100vh - var(--fd-topbar-h) - 32px);
}
.fd-conv-list, .fd-conv-pane {
    background: var(--fd-surface); border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow); overflow: hidden;
    display: flex; flex-direction: column;
}
.fd-conv-list-head { padding: 14px 16px; border-bottom: 1px solid var(--fd-border); }
.fd-conv-list-head h2 { font-size: 18px; font-weight: 800; margin: 0; }
.fd-conv-items { overflow-y: auto; flex: 1; }
.fd-conv-item {
    display: flex; gap: 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--fd-border);
    text-decoration: none; color: inherit;
    transition: background .15s;
}
.fd-conv-item:hover { background: var(--fd-hover); }
.fd-conv-item.active { background: var(--fd-primary-l); }
.fd-conv-item.unread .fd-conv-name { font-weight: 800; }
.fd-conv-item.unread .fd-conv-preview { color: var(--fd-text); font-weight: 600; }
.fd-conv-av {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--fd-primary-l); color: var(--fd-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; overflow: hidden; flex-shrink: 0;
}
.fd-conv-av img { width: 100%; height: 100%; object-fit: cover; }
.fd-conv-body { flex: 1; min-width: 0; }
.fd-conv-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-conv-preview {
    font-size: 12px; color: var(--fd-text-2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fd-conv-time {
    font-size: 11px; color: var(--fd-text-2);
    flex-shrink: 0; align-self: flex-start; padding-top: 4px;
}
.fd-conv-badge {
    background: var(--fd-accent); color: #fff;
    font-size: 10px; font-weight: 800;
    border-radius: 100px; padding: 2px 8px;
    align-self: center;
}

/* Chat pane */
.fd-conv-pane-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--fd-border);
}
.fd-conv-pane-head .name { font-size: 15px; font-weight: 700; }
.fd-conv-pane-head .sub { font-size: 12px; color: var(--fd-text-2); }
.fd-msg-stream {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 8px;
    background: var(--fd-bg);
}
.fd-msg {
    max-width: 70%;
    padding: 10px 14px; border-radius: 16px;
    font-size: 14px; line-height: 1.6;
    word-break: break-word;
}
.fd-msg-out {
    background: var(--fd-primary); color: #fff;
    align-self: flex-end; border-bottom-right-radius: 4px;
}
.fd-msg-in {
    background: var(--fd-surface); color: var(--fd-text);
    align-self: flex-start; border-bottom-left-radius: 4px;
    box-shadow: var(--fd-shadow);
}
.fd-msg-time {
    font-size: 10px; opacity: .7; margin-top: 4px; display: block;
}
.fd-msg-form {
    display: flex; gap: 8px; padding: 12px 14px;
    border-top: 1px solid var(--fd-border);
    background: var(--fd-surface);
}
.fd-msg-form textarea {
    flex: 1; padding: 10px 14px;
    background: var(--fd-bg); border: 0; border-radius: 20px;
    font-family: inherit; font-size: 14px; color: var(--fd-text);
    resize: none; max-height: 100px;
    outline: 0;
}
.fd-msg-form button {
    width: 42px; height: 42px; border-radius: 50%;
    border: 0; background: var(--fd-primary); color: #fff;
    cursor: pointer; font-size: 16px;
    align-self: flex-end;
}
.fd-msg-form button:hover { background: var(--fd-primary-d); }
.fd-msg-form button:disabled { opacity: .5; cursor: not-allowed; }

.fd-conv-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--fd-text-2); font-size: 14px; gap: 10px;
    padding: 30px; text-align: center;
}
.fd-conv-empty i { font-size: 48px; color: var(--fd-border); }

@media (max-width: 768px) {
    .fd-conv-wrap {
        grid-template-columns: 1fr;
        padding: 0;
        padding-bottom: 60px;
    }
    .fd-conv-pane { display: none; }
    .fd-conv-wrap.fd-pane-open .fd-conv-list { display: none; }
    .fd-conv-wrap.fd-pane-open .fd-conv-pane { display: flex; }
}

/* ── Floating chat widget (from feed.blade) ── */
.fd-chat-pop {
    position: fixed;
    bottom: 20px; inset-inline-end: 20px;
    width: 340px; max-height: 480px;
    background: var(--fd-surface);
    border-radius: var(--fd-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    display: none; flex-direction: column;
    z-index: 1050;
    overflow: hidden;
}
.fd-chat-pop.open { display: flex; }
.fd-chat-pop .fd-msg-stream { max-height: 320px; }
.fd-chat-pop .fd-conv-pane-head .close {
    border: 0; background: transparent; color: var(--fd-text-2);
    cursor: pointer; font-size: 18px; padding: 0 8px;
    margin-inline-start: auto;
}
@media (max-width: 768px) {
    .fd-chat-pop {
        inset-inline-end: 8px; inset-inline-start: 8px;
        width: auto; bottom: 70px;
    }
}
