/* The notification bell, on every page: the dropdown under it and the
   Notifications window behind its "Read all" link.
   JS: js/common-modals/notifications-panel.js */

.icon-btn { position: relative; }

.notifications-count {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9999px;
    background: var(--error);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}

.notifications-count.inline {
    position: static;
    margin-left: auto;
}

/* ---------------------------------------------- the dropdown under the bell */
/* Positioned by the JS against the bell that was clicked, because the bell is
   in a different place on a phone, a profile page and the homepage. */
.notifications-dropdown {
    position: fixed;
    width: min(360px, calc(100vw - 16px));
    max-height: min(520px, calc(100vh - 100px));
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    /* Above the profile dropdown (20001, css/root/profile-dropdown.css) and
       below the auth modal (99999). */
    z-index: 20050;
}

.notifications-dropdown-header,
.notifications-dropdown-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
}

.notifications-dropdown-header { border-bottom: 1px solid var(--border-color); }
.notifications-dropdown-footer { border-top: 1px solid var(--border-color); }

.notifications-dropdown-header strong { font-size: 0.95rem; }

.notifications-dropdown-header button,
.notifications-dropdown-footer button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.notifications-dropdown-footer button {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
}

.notifications-dropdown-list {
    flex: 1;
    /* A flex item will not shrink below its content without this, so the list
       would grow past the panel and be clipped rather than scroll. */
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.notifications-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.8rem 1rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: inherit;
    cursor: pointer;
}

.notifications-item:hover { background: var(--hover-bg); }

.notifications-item.unread { background: rgba(var(--primary-rgb), 0.08); }

.notifications-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.notifications-item.unread .notifications-item-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.notifications-item-message {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.notifications-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.notifications-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ------------------------------------------------- the Notifications window */
/* Roles down the side: one inbox, but a tutor who is also a parent has two
   lives in it. Account-wide notices show under every role. */
.notifications-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 20060;
    background: rgba(0, 0, 0, 0.55);
    padding: 24px 16px;
    overflow-y: auto;
}

body.notifications-modal-open { overflow: hidden; }

.notifications-modal {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.notifications-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.notifications-modal-head h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.notifications-modal-head-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#notifications-modal-read-all {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.notifications-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--hover-bg);
    color: var(--text-primary);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.notifications-modal-body {
    display: flex;
    min-height: 0;
    flex: 1;
}

.notifications-modal-roles {
    width: 210px;
    flex-shrink: 0;
    padding: 0.85rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow-y: auto;
}

.notifications-role {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.notifications-role:hover { background: var(--hover-bg); }

.notifications-role.active {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary-color);
}

.notifications-role-count {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 9999px;
    background: var(--error);
    color: var(--white);
    font-size: 0.7rem;
    line-height: 20px;
    text-align: center;
}

.notifications-modal-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.notifications-modal-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem 1rem 0;
    flex-wrap: wrap;
}

.notifications-tab {
    padding: 0.5rem 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: 9999px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.notifications-tab:hover { border-color: var(--primary-color); color: var(--primary-color); }

.notifications-tab.active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
}

.notifications-modal-list {
    flex: 1;
    /* min-height, not a floor of 220px: a floor is exactly what stops a flex
       item shrinking, and the list would then push past the window. */
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.85rem 0;
}

/* Requested courses / schools: what you asked Astegni for, and whether it has
   been passed on. */
.notifications-request {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.notifications-request-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.notifications-request-sub,
.notifications-request-note,
.notifications-request-time {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.notifications-request-time { font-size: 0.72rem; }

.notifications-badge {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.notifications-badge.ok { background: rgba(16, 185, 129, 0.14); color: #059669; }
.notifications-badge.warn { background: rgba(245, 158, 11, 0.18); color: #b45309; }

.notifications-ask-row { padding: 0 1rem 0.85rem; }
.notifications-empty-action { margin-top: 0.9rem; }

.notifications-ask {
    padding: 0.55rem 1rem;
    border: 2px solid var(--primary-color);
    border-radius: 9999px;
    background: none;
    color: var(--primary-color);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.notifications-ask:hover { background: rgba(var(--primary-rgb), 0.1); }

/* Off find-tutors the same control is an <a> to it, so it needs to sit and read
   like the button. */
a.notifications-ask {
    display: inline-block;
    text-decoration: none;
}

.notifications-retry {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* On a phone the roles read as a row above the list, not a column beside it. */
@media (max-width: 720px) {
    .notifications-modal-body { flex-direction: column; }

    .notifications-modal-roles {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .notifications-role { width: auto; white-space: nowrap; }
}
