/*
 * Copyright (c) 2024–2026 Pyracor Engineering Inc. (Qikspace)
 * All rights reserved. CONFIDENTIAL AND PROPRIETARY — NOT FOR DISTRIBUTION.
 * SPDX-License-Identifier: LicenseRef-Qikspace-Proprietary
 *
 * Activity bell + slide-out drawer (Timeline / Feed / Notifications).
 */

/* ---- navbar bell -------------------------------------------------------- */
.feed-bell {
    position: relative;
    display: inline-block;
}
.feed-bell__icon {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    opacity: 0.9;
    transition: opacity 0.15s ease;
}
.feed-bell > a:hover .feed-bell__icon { opacity: 1; }
.feed-bell__badge {
    position: absolute;
    top: 2px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e0245e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* An explicit `display` above overrides the `hidden` attribute's default
   `display:none`, so restore it: no badge when the count is zero. */
.feed-bell__badge[hidden],
.feed-tab__badge[hidden] { display: none; }

/* ---- overlay + popover panel -------------------------------------------- */
/* Transparent backdrop: it only captures outside clicks to close the popover,
   without dimming the page (a notification popover, not a modal drawer). */
.feed-drawer-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1040;
}
/* A floating popover anchored under the top navbar at the right, not a
   full-height drawer. Rounded, soft-shadowed, content-height up to a cap. */
.feed-drawer {
    position: fixed;
    top: 58px;
    right: 12px;
    width: 400px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 74px);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;                 /* clip children to the rounded corners */
    transform-origin: top right;
    animation: feedPopIn 0.16s ease-out;
}
@keyframes feedPopIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* `display:flex` above outranks the UA `[hidden] { display:none }`, so these
   explicit, higher-specificity rules are what actually hide the panel/overlay
   when the `hidden` attribute is set (without them the X/overlay can't close it). */
.feed-drawer[hidden],
.feed-drawer-overlay[hidden] {
    display: none;
}
/* On phones, use a near-full-width sheet just under the navbar. */
@media (max-width: 480px) {
    .feed-drawer {
        top: 54px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 66px);
    }
}

.feed-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #eef0f2;
}
.feed-drawer__title { margin: 0; font-size: 17px; font-weight: 700; }
.feed-drawer__close {
    border: 0;
    background: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

/* ---- tab bar ------------------------------------------------------------ */
.feed-tabs {
    display: flex;
    border-bottom: 1px solid #e6e6e6;
}
.feed-tab {
    flex: 1;
    padding: 12px 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
}
.feed-tab.active {
    color: #0f161a;
    border-bottom-color: #1da1f2;
}
.feed-tab__badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e0245e;
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    vertical-align: middle;
}

/* ---- body + cells ------------------------------------------------------- */
.feed-drawer__body {
    flex: 1;
    overflow-y: auto;
}
.feed-empty {
    padding: 32px 16px;
    text-align: center;
    color: #8899a6;
}

/* ---- transient action-error banner (dismissed on next interaction) ------ */
.feed-action-error {
    margin: 8px 12px;
    padding: 10px 14px;
    border: 1px solid #e0245e;
    border-radius: 8px;
    background: #fdecef;
    color: #c0143c;
    font-size: 13px;
    font-weight: 600;
}

/* ---- loading spinner (initial tab load + scroll load-more) -------------- */
.feed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 16px;
    color: #8899a6;
}
/* Smaller, in-line variant appended at the bottom while paging older cells. */
.feed-loading--more {
    flex-direction: row;
    gap: 8px;
    padding: 16px;
}
.feed-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(29, 161, 242, 0.25);
    border-top-color: #1da1f2;
    border-radius: 50%;
    animation: feedSpin 0.7s linear infinite;
}
.feed-loading--more .feed-spinner { width: 18px; height: 18px; border-width: 2px; }
.feed-loading__label { font-size: 13px; font-weight: 600; }
@keyframes feedSpin {
    to { transform: rotate(360deg); }
}
.feed-cell {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.feed-cell--unread { background: #f5fbff; }
.feed-cell__icon {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1da1f2;
}
.feed-cell__icon img { width: 32px; height: 32px; border-radius: 4px; object-fit: contain; }
.feed-cell__body { flex: 1; min-width: 0; }
.feed-cell__title {
    display: block;
    font-weight: 600;
    color: #0f161a;
    text-decoration: none;
}
.feed-cell__title:hover { text-decoration: underline; }
.feed-cell__subtitle {
    margin: 2px 0 0;
    color: #536471;
    font-size: 13px;
}
.feed-cell__time {
    display: block;
    margin-top: 4px;
    color: #8899a6;
    font-size: 12px;
}

/* ---- action buttons (up to three per notification) ---------------------- */
.feed-cell__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.feed-action {
    padding: 6px 14px;
    border: 1px solid #1da1f2;
    border-radius: 16px;
    background: #fff;
    color: #1da1f2;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.feed-action:disabled { opacity: 0.5; cursor: default; }
.feed-action--primary { background: #1da1f2; color: #fff; }
.feed-action--danger { border-color: #e0245e; color: #e0245e; }

/* ---- "use the Android app" dialog (replicated items) -------------------- */
.feed-dialog-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1060;
    padding: 16px;
}
.feed-dialog-overlay[hidden] { display: none; }
.feed-dialog {
    max-width: 320px;
    width: 100%;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    padding: 20px;
    text-align: center;
}
.feed-dialog__body {
    margin: 0 0 16px;
    color: #0f161a;
    font-size: 15px;
    line-height: 1.4;
}
.feed-dialog__actions { display: flex; justify-content: center; }
.feed-dialog__ok {
    padding: 8px 24px;
    border: 0;
    border-radius: 18px;
    background: #1da1f2;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ---- standalone /homepage/feed page ------------------------------------- */
.feed-page { max-width: 640px; margin: 0 auto; }
.feed-page__title { margin: 16px 0; }

/* ---- dark scheme -------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .feed-drawer {
        background: #0f161a;
        border-color: #22303c;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
    }
    .feed-drawer__header { border-bottom-color: #22303c; }
    .feed-tabs,
    .feed-cell { border-color: #22303c; }
    .feed-drawer__title,
    .feed-tab.active,
    .feed-cell__title { color: #e7e9ea; }
    .feed-cell--unread { background: #14202b; }
    .feed-action { background: transparent; }
    .feed-spinner { border-color: rgba(29, 161, 242, 0.3); border-top-color: #1da1f2; }
    .feed-dialog { background: #0f161a; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }
    .feed-dialog__body { color: #e7e9ea; }
    .feed-action-error { background: #2a1119; border-color: #e0245e; color: #f5859e; }
}
