/* ===========================================
   Notifications Page
   Full notification list with filters,
   pagination, and preferences sidebar.
   =========================================== */

.notifications-page {
    width: 100%;
    padding: var(--space-4) var(--space-4);
}

/* ---- Toolbar: search + filters + actions ---- */

.notifications-page__toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.notifications-page__search {
    flex: 1;
    min-width: 180px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-1) var(--space-2);
    font-size: 13px;
    color: var(--color-text);
    outline: none;
    transition: border-color 0.12s ease;
}

.notifications-page__search::placeholder {
    color: var(--color-text-muted);
}

.notifications-page__search:focus {
    border-color: var(--color-accent);
}

.notifications-page__mark-all {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-1) var(--space-2);
    cursor: pointer;
    font-size: 13px;
    color: var(--color-accent);
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.notifications-page__mark-all:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

/* ---- Filters ---- */

.notifications-page__filter-group {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
}

.notifications-page__filter-btn {
    background: none;
    border: none;
    padding: var(--space-1) var(--space-2);
    font-size: 13px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.notifications-page__filter-btn:hover {
    background: var(--color-surface-hover);
}

.notifications-page__filter-btn--active {
    background: var(--color-accent);
    color: #fff;
}

.notifications-page__filter-btn--active:hover {
    background: var(--color-accent);
    color: #fff;
}

.notifications-page__category-select {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-1) var(--space-2);
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    outline: none;
    transition: border-color 0.12s ease;
}

.notifications-page__category-select:focus {
    border-color: var(--color-accent);
}

/* ---- Two-column body ---- */

.notifications-page__body {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
}

.notifications-page__main {
    flex: 3;
    min-width: 0;
}

/* ---- Notification list ---- */

.notifications-page__list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 400px;
}

/* ---- Notification card ---- */

.notifications-page__card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    min-height: 80px;
    cursor: pointer;
    transition: background 0.12s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    text-align: left;
    /* Read items: slightly darker background */
    background: var(--color-surface-hover);
}

.notifications-page__card:hover {
    background: color-mix(in srgb, var(--color-surface-hover) 97%, var(--color-text) 3%);
}

/* Unread card — accent background */
.notifications-page__card--unread {
    background: var(--color-accent);
    padding-right: calc(var(--space-3) + 18px);
}

.notifications-page__card--unread:hover {
    background: var(--color-accent-hover);
}

/* Red unread dot */
.notifications-page__card--unread::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--color-danger, #ef4444);
    border-radius: 50%;
}

/* Unread: icon colors on accent background */
.notifications-page__card--unread .notifications-page__card-icon {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Unread: text colors on accent background */
.notifications-page__card--unread .notifications-page__card-actor {
    color: #fff;
}

.notifications-page__card--unread .notifications-page__card-time {
    color: rgba(255, 255, 255, 0.7);
}

.notifications-page__card--unread .notifications-page__card-title {
    color: rgba(255, 255, 255, 0.65);
    opacity: 1;
}

.notifications-page__card--unread .notifications-page__card-message {
    color: rgba(255, 255, 255, 0.85);
}

/* Category icon */
.notifications-page__card-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--color-surface-hover);
    color: var(--color-accent);
    font-size: 13px;
    margin-top: 2px;
}

/* Content area */
.notifications-page__card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

/* Top row: actor name + timestamp */
.notifications-page__card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.notifications-page__card-actor {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notifications-page__card-time {
    font-size: 10.5px;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Action description */
.notifications-page__card-title {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--color-text-muted);
    opacity: 0.6;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Comment preview */
.notifications-page__card-message {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Empty state ---- */

.notifications-page__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6) var(--space-3);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    background: var(--color-surface-elevated);
    flex: 1;
}

.notifications-page__empty-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
    opacity: 0.5;
}

/* ---- Loading state ---- */

.notifications-page__loading {
    padding: var(--space-6) var(--space-3);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    background: var(--color-surface-elevated);
    flex: 1;
}

/* ---- Load more ---- */

.notifications-page__load-more-wrap {
    display: flex;
    justify-content: center;
    padding: var(--space-3) 0;
}

.notifications-page__load-more {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: var(--space-1) var(--space-3);
    font-size: 13px;
    color: var(--color-accent);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.notifications-page__load-more:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

/* ---- Preferences sidebar ---- */

.notifications-page__sidebar {
    flex: 1;
    min-width: 200px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface-elevated);
    padding: var(--space-3);
    position: sticky;
    top: calc(var(--topbar-height) + var(--space-3));
}

.notifications-page__sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.notifications-page__sidebar-header i {
    color: var(--color-text-muted);
    font-size: 12px;
}

.notifications-page__pref-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-3) 0;
    line-height: 1.4;
}

.notifications-page__pref-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* Preference item — toggle switch */

.notifications-page__pref-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-1) var(--space-1);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.notifications-page__pref-item:hover {
    background: var(--color-surface-hover);
}

.notifications-page__pref-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12.5px;
    color: var(--color-text);
}

.notifications-page__pref-icon {
    width: 16px;
    text-align: center;
    color: var(--color-accent);
    font-size: 11px;
}

/* Hide native checkbox, show custom switch */
.notifications-page__pref-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.notifications-page__pref-switch {
    position: relative;
    width: 34px;
    height: 18px;
    background: var(--color-border-strong, #555);
    border-radius: 10px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.notifications-page__pref-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.notifications-page__pref-checkbox:checked + .notifications-page__pref-switch {
    background: var(--color-accent);
}

.notifications-page__pref-checkbox:checked + .notifications-page__pref-switch::after {
    transform: translateX(16px);
}

/* Preference section grouping */
.notifications-page__pref-section {
    margin-bottom: var(--space-3);
}

.notifications-page__pref-section-title {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0 0 var(--space-1) 0;
    margin-bottom: var(--space-1);
    border-bottom: 1px solid var(--color-border);
}

/* ===========================================
   Mobile responsive layout
   =========================================== */
@media (max-width: 768px) {

    .notifications-page {
        padding: var(--space-3) var(--space-2);
    }

    /* Toolbar: stack vertically */
    .notifications-page__toolbar {
        flex-direction: column;
        gap: var(--space-2);
    }

    .notifications-page__search {
        width: 100%;
        min-height: var(--touch-target-min);
    }

    .notifications-page__mark-all {
        width: 100%;
        justify-content: center;
        min-height: var(--touch-target-min);
    }

    .notifications-page__filter-group {
        width: 100%;
    }

    .notifications-page__filter-btn {
        flex: 1;
        text-align: center;
        min-height: var(--touch-target-min);
    }

    .notifications-page__category-select {
        width: 100%;
        min-height: var(--touch-target-min);
    }

    /* Body: stack vertically on mobile */
    .notifications-page__body {
        flex-direction: column;
    }

    /* List */
    .notifications-page__list {
        border-radius: 8px;
        min-height: 200px;
    }

    /* Cards: full-width, compact text */
    .notifications-page__card {
        padding: var(--space-2) var(--space-3);
        min-height: var(--touch-target-min);
    }

    .notifications-page__card-actor {
        font-size: 13.5px;
    }

    .notifications-page__card-title {
        font-size: 11px;
    }

    .notifications-page__card-message {
        font-size: 12.5px;
    }

    .notifications-page__card-time {
        font-size: 10px;
    }

    /* Load more: full-width */
    .notifications-page__load-more-wrap {
        padding: var(--space-2) 0;
    }

    .notifications-page__load-more {
        width: 100%;
        min-height: var(--touch-target-min);
    }

    /* Sidebar: full-width on mobile */
    .notifications-page__sidebar {
        width: 100%;
        position: static;
        min-width: unset;
    }

    /* Preferences: touch-friendly */
    .notifications-page__pref-item {
        min-height: var(--touch-target-min);
        padding: var(--space-2);
    }

    .notifications-page__pref-switch {
        width: 44px;
        height: 24px;
        border-radius: 14px;
    }

    .notifications-page__pref-switch::after {
        width: 20px;
        height: 20px;
    }

    .notifications-page__pref-checkbox:checked + .notifications-page__pref-switch::after {
        transform: translateX(20px);
    }
}
