/* المعلن، مراسلة، إشعارات ومفضلة. Shared RTL surfaces, no external assets. */
[hidden] { display: none !important; }
.profile-editor, .inbox-page, .notifications-page { max-width: 860px; margin: 1.5rem auto 3rem; }
.profile-editor { max-width: 680px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.seller-profile { display: flex; align-items: flex-start; gap: 1.5rem; padding: clamp(1.25rem, 4vw, 2.5rem); background: linear-gradient(120deg, #fff 55%, #edf7f7); }
.seller-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #e1f0f1; color: var(--brand); font-size: 1.5rem; font-weight: 700; }
.seller-avatar.large { width: 84px; height: 84px; font-size: 2.4rem; border: 4px solid white; box-shadow: 0 0 0 1px var(--line); }
.seller-profile-copy { min-width: 0; flex: 1; }
.seller-profile h1 { margin: .25rem 0 1rem; overflow-wrap: anywhere; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.seller-profile .eyebrow { margin-top: 0; }
.seller-facts { display: flex; gap: .65rem 1.2rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.seller-bio { line-height: 1.9; overflow-wrap: anywhere; margin: 1.25rem 0; }
.seller-card { display: flex; align-items: center; gap: .85rem; padding: .6rem 0; }
.seller-card > span:last-child { min-width: 0; }
.seller-card strong, .seller-profile-link, .seller-card .eyebrow { display: block; overflow-wrap: anywhere; }
.seller-profile-link { font-size: .8rem; color: var(--brand); margin-top: .3rem; }
.seller-card .eyebrow { margin: 0 0 .2rem; font-weight: 400; }
.listing-views, .listing-stats { font-size: .8rem; color: var(--muted); }
.listing-stats { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .75rem 0; }
.listing-card { position: relative; min-width: 0; }
.card-body h3, .card-body .eyebrow { overflow-wrap: anywhere; }
.card-favorite { position: absolute; top: .7rem; inset-inline-end: .7rem; z-index: 2; }
.card-favorite .button { min-width: 58px; min-height: 44px; padding: .45rem .65rem; gap: .4rem; border-radius: 12px; background: #fff; border: 1px solid #d9e3e6; box-shadow: 0 2px 8px #102a3314; direction: ltr; }
.favorite-icon { width: 21px; height: 21px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.favorite-form button[aria-pressed="true"] .favorite-icon { fill: currentColor; }
.favorite-count { color: var(--ink); font-size: .8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.gallery-cover .card-favorite { top: auto; bottom: .75rem; inset-inline-end: auto; inset-inline-start: .75rem; }
.gallery-cover .card-favorite .favorite-status:not(:empty) { top: auto; bottom: 50px; inset-inline-end: auto; inset-inline-start: 0; }
.favorite-form button[aria-pressed="true"] { color: #aa304a; }
.favorite-status { display: block; font-size: .8rem; color: var(--muted); }
.card-favorite .favorite-status:not(:empty) { position: absolute; inset-inline-end: 0; top: 50px; width: 170px; border-radius: 8px; padding: .5rem; background: white; box-shadow: var(--shadow); color: var(--ink); }
.unread-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 20px; background: var(--brand); color: white; font-size: .7rem; font-weight: 700; line-height: 1; white-space: nowrap; }
.activity-bell { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; flex-shrink: 0; background: white; }
.activity-bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.activity-bell .unread-pill { position: absolute; top: -7px; inset-inline-end: -5px; border: 2px solid white; }
.activity-toast { position: fixed; z-index: 80; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 2rem); padding: 1rem 1.4rem; border-radius: 12px; background: var(--brand-dark); color: white; box-shadow: var(--shadow); text-align: center; }
.activity-toast:hover { color: white; }
.inbox-tabs { display: flex; gap: .5rem; margin: 0 0 1.3rem; }
.inbox-tabs a { padding: .65rem 1.1rem; border-radius: 30px; border: 1px solid var(--line); background: white; }
.inbox-tabs a[aria-current] { background: var(--brand); border-color: var(--brand); color: white; }
.conversation-list, .notification-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; min-width: 0; }
.conversation-card { min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 1rem; border: 1px solid var(--line); border-radius: 16px; padding: 1rem; background: white; }
.conversation-card:hover { border-color: var(--brand); }
.conversation-card.is-unread, .notification-card.is-unread { background: #f0f9f9; border-inline-start: 4px solid var(--brand); }
.conversation-photo { display: grid; place-items: center; width: 76px; height: 76px; flex: 0 0 auto; border-radius: 12px; overflow: hidden; background: #e8eff0; color: var(--brand); font-size: 1.8rem; }
.conversation-photo img { width: 100%; height: 100%; object-fit: cover; }
.conversation-copy { flex: 1; min-width: 0; }
.conversation-top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.conversation-top h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.conversation-top time, .notification-copy time { font-size: .73rem; color: var(--muted); flex-shrink: 0; }
.conversation-listing { font-size: .83rem; margin: .2rem 0; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-preview { margin: .3rem 0 0; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { max-width: 820px; }
.back-link { display: inline-block; padding: .5rem 0; margin-bottom: .6rem; color: var(--brand); }
.thread-heading { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; background: white; border: 1px solid var(--line); border-radius: 16px; }
.thread-heading > div { min-width: 0; }
.thread-heading h1 { font-size: 1.25rem; margin: 0; overflow-wrap: anywhere; }
.thread-heading p { font-size: .9rem; color: var(--brand); margin: .2rem 0 0; overflow-wrap: anywhere; }
.thread-safety { color: var(--muted); font-size: .8rem; line-height: 1.7; margin: 1rem .25rem; }
.thread .messages { display: flex; flex-direction: column; min-height: 220px; max-height: 52vh; max-height: 52dvh; overflow-y: auto; overscroll-behavior: contain; padding: 1rem .5rem; margin: 1rem 0; border-radius: 12px; background: #edf2f4; scrollbar-gutter: stable; }
.thread .bubble { align-self: flex-end; width: fit-content; min-width: 110px; max-width: 85%; padding: .75rem 1rem; overflow-wrap: anywhere; border-end-end-radius: 4px; }
.thread .bubble.mine { align-self: flex-start; border-end-start-radius: 4px; border-end-end-radius: 16px; }
.bubble strong { font-size: .8rem; }
.bubble p { white-space: pre-wrap; line-height: 1.8; }
.thread-empty { text-align: center; margin: auto; color: var(--muted); }
.thread-empty h2 { font-size: 1.2rem; }
.message-compose { border: 1px solid var(--line); padding: 1rem; background: white; border-radius: 16px; }
.message-compose textarea { resize: vertical; min-height: 88px; max-height: 240px; }
.message-compose .field { margin-bottom: .6rem; }
.compose-bottom { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.compose-bottom .muted { font-size: .8rem; }
#thread-status:empty { display: none; }
.notification-card { display: flex; align-items: flex-start; gap: 1rem; padding: 1.3rem; border: 1px solid var(--line); border-radius: 16px; background: white; }
.notification-symbol { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: #e1f0f1; color: var(--brand); font-size: 1.3rem; }
.notification-copy { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.notification-copy .eyebrow { margin: 0 0 .3rem; font-size: .75rem; }
.notification-copy h2 { font-size: 1.1rem; margin: .2rem 0; }
.notification-copy p { margin: .6rem 0; }
.notification-copy form { margin-top: .8rem; }
@media (max-width: 560px) {
  .header-inner { gap: .5rem; }
  .header-post { padding-inline: .7rem; font-size: .8rem; }
  .activity-bell { width: 40px; height: 40px; }
  .seller-profile { gap: 1rem; flex-direction: column; }
  .seller-avatar.large { width: 64px; height: 64px; font-size: 2rem; }
  .seller-facts { font-size: .8rem; }
  .conversation-card { gap: .7rem; padding: .85rem; }
  .conversation-photo { width: 56px; height: 64px; }
  .conversation-top { display: block; }
  .conversation-top time { display: block; margin-top: .15rem; }
  .conversation-top h2 { font-size: 1rem; }
  .notification-card { gap: .7rem; padding: 1rem; }
  .notification-symbol { width: 32px; height: 32px; }
  .notifications-page .page-heading { align-items: flex-start; gap: 1rem; flex-direction: column; }
  .thread .messages { max-height: 46vh; max-height: 46dvh; }
  .thread .bubble { max-width: 90%; }
  .thread-heading { padding: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .thread .messages { scroll-behavior: auto; }
}

@media (max-width: 360px) {
  .header-inner { gap: .35rem; }
  .brand-name { font-size: 1rem; }
  .brand-tagline { font-size: .6rem; }
  .header-post { padding-inline: .5rem; font-size: .75rem; }
  .activity-bell { width: 36px; }
  .site-menu > summary { width: 36px; }
}


/* Readable bell on both transparent and solid home headers. */
.site-header .activity-bell, .home-page .site-header .activity-bell { color: #16343f; background: #fff; }
.site-header .activity-bell:hover { color: #086c7b; background: #edf7f7; }
.notification-inbox-link { display: inline-block; color: var(--brand); font-weight: 700; }
.home-trending-head h2 { margin-bottom: .25rem; }
.trending-caption { color: var(--muted); font-size: .8rem; margin: 0 0 1rem; }
.home-trending-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.home-trending-head > a { color: var(--brand); font-size: .85rem; white-space: nowrap; }
.home-trending-rail { grid-auto-columns: minmax(200px, 23%); gap: 1rem; }
.home-trending-rail .card-image { aspect-ratio: 4 / 3; }
.home-trending-rail .card-image img { width: 100%; height: 100%; object-fit: cover; }
.home-trending-rail .card-body { padding: .85rem; }
.home-trending-rail h3 { font-size: 1rem; margin: .35rem 0; }
.home-trending-rail .price { font-size: 1.15rem; margin: .4rem 0 0; }
.home-trending-rail .eyebrow { font-size: .72rem; margin: 0; }
.listing-card h3 a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 560px) {
  .home-trending-rail { grid-auto-columns: minmax(170px, 55%); gap: .7rem; }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .listing-grid .card-body { padding: .7rem; }
  .listing-grid h3 { font-size: .9rem; margin-bottom: .45rem; }
  .listing-grid .eyebrow { font-size: .7rem; margin-bottom: .4rem; }
  .listing-grid .price { font-size: 1.1rem; }
  .listing-card .badge { font-size: .65rem; padding: .25rem .4rem; }
  .card-favorite { top: .4rem; inset-inline-end: .4rem; }
}

/* One-screen conversation: the log scrolls, the composer stays in reach. */
.chat-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.chat-page main.container { display: flex; flex: 1; min-height: 0; width: min(960px, 100%); padding: 0; }
.chat-page .footer { display: none; }
.chat-page .thread { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; max-width: none; margin: 0; background: #f0f5f5; position: relative; }
.chat-page .thread-heading { padding: .7rem 1rem; gap: .65rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; flex-shrink: 0; }
.chat-page .thread-heading h1 { font-size: 1rem; }
.chat-page .thread-heading p { font-size: .78rem; margin: .1rem 0 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-page .thread-heading > div:last-of-type { flex: 1; }
.chat-page .seller-avatar { width: 40px; height: 40px; font-size: 1.2rem; }
.chat-back { display: grid; place-items: center; width: 38px; height: 44px; font-size: 1.6rem; flex-shrink: 0; }
.chat-home { color: var(--brand); font-size: .7rem; white-space: nowrap; }
.chat-page .thread-safety { padding: .4rem 1rem; margin: 0; font-size: .7rem; background: #e7f0ef; }
.thread-safety summary { cursor: pointer; }
.thread-safety p { margin: .35rem 0; }
.chat-page .thread .messages { flex: 1; min-height: 0; max-height: none; padding: 1rem; margin: 0; border-radius: 0; background: transparent; gap: .5rem; scrollbar-gutter: auto; }
.chat-page .thread .bubble { min-width: 70px; max-width: 82%; padding: .5rem .75rem .3rem; margin: 0; border: 1px solid #dde7e8; box-shadow: 0 1px 2px #16343f08; border-radius: 15px 15px 15px 4px; }
.chat-page .thread .bubble.mine { border-color: #c8e4df; background: #def1eb; border-radius: 15px 15px 4px 15px; }
.chat-page .bubble p { line-height: 1.6; margin: 0 0 .2rem; white-space: normal; }
.chat-page .bubble time { display: block; font-size: .65rem; text-align: end; }
.chat-page .message-compose { padding: .6rem 1rem max(.6rem, env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); border-radius: 0; flex-shrink: 0; }
.compose-row { display: flex; align-items: flex-end; gap: .6rem; }
.chat-page .message-compose textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; padding: .55rem .8rem; border-radius: 22px; background: #f3f6f6; resize: none; font-size: 16px; line-height: 1.5; }
.compose-row button { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 1.4rem; }
.compose-row button:disabled { opacity: .6; }
.compose-hint { display: block; font-size: .65rem; color: var(--muted); padding: .2rem .75rem 0; min-height: 1.3em; }
.chat-page #thread-status { font-size: .75rem; margin: 0; padding: .2rem 1rem; background: #fff8e7; }
.chat-page #read-messages button { padding: .2rem .8rem; font-size: .65rem; min-height: 0; }
.chat-page #new-messages { position: absolute; bottom: 125px; align-self: center; box-shadow: var(--shadow); font-size: .8rem; min-height: 38px; z-index: 3; }
.chat-page .notice { margin: 0; padding: .5rem 1rem; font-size: .75rem; }
@media (max-width: 700px) {
  .chat-page > .site-header { display: none; }
  .chat-page .thread-heading { padding-top: max(.6rem, env(safe-area-inset-top)); }
}
.chat-page { height: var(--chat-height, 100dvh); }
