/* ============================================================
   notifications.css — Notification bell, badge, dropdown panel,
                        tracked documents, unread notifications
   ============================================================ */

/* ── Design tokens (local) ───────────────────────────────── */
:root {
    --notif-accent: #88a09a;
    --notif-accent-light: rgba(136, 160, 154, 0.08);
    --notif-accent-border: rgba(136, 160, 154, 0.35);
    --notif-unread-dot: #88a09a;
}

/* ── Header bell button ──────────────────────────────────── */
.notification-bell-header {
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    position: relative;
    color: var(--text-secondary);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bell-header:hover {
    border-color: var(--notif-accent);
    color: var(--notif-accent);
    background: var(--notif-accent-light);
}

/* Bell icon on document cards */
.notification-bell {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    opacity: 0.35;
    transition: opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.notification-bell:hover {
    color: var(--notif-accent);
    opacity: 1;
}

.notification-bell.active {
    color: var(--notif-accent);
    opacity: 0.85;
}

/* ── Badge ───────────────────────────────────────────────── */
.notification-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    background: var(--notif-accent);
    color: white;
    font-size: 0.6rem;
    font-weight: 600;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    letter-spacing: 0.01em;
}

/* ── Notifications dropdown panel ────────────────────────── */
.notifications-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--card-bg);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow: hidden;
}

.notifications-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.notifications-mark-all {
    background: none;
    border: none;
    color: var(--notif-accent);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 4px;
    transition: opacity 0.15s ease;
    font-weight: 500;
}

.notifications-mark-all:hover {
    opacity: 0.7;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notifications-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.87rem;
}

/* ── Notification items (dropdown) ───────────────────────── */
.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle, #f0f0f0);
    cursor: pointer;
    transition: background 0.15s ease;
}

.notification-item:hover {
    background: var(--notif-accent-light);
}

.notification-item.unread {
    border-left: 2px solid var(--notif-accent);
    padding-left: calc(1rem - 2px);
}

.notification-item.read {
    opacity: 0.65;
}

.notification-title {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

.notification-message {
    font-size: 0.79rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    line-height: 1.35;
}

.notification-date {
    font-size: 0.73rem;
    color: var(--text-muted, #999);
}

/* ── Tracked documents section (overview) ────────────────── */
.tracked-documents-section {
    margin-bottom: 2rem;
}

.tracked-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.tracked-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.tracked-card {
    background: var(--card-bg);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.tracked-card:hover {
    border-color: var(--notif-accent-border);
    box-shadow: 0 2px 8px rgba(136, 160, 154, 0.12);
}

.tracked-card-title {
    font-weight: 500;
    font-size: 0.88rem;
    margin-bottom: 0.3rem;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tracked-card-meta {
    font-size: 0.76rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tracked-card-tunnus {
    font-weight: 500;
    color: var(--notif-accent);
}

/* Badge dot on tracked cards with updates */
.tracked-card-update-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--notif-accent);
    border: 2px solid var(--card-bg);
}

/* ── Unread notifications section (overview) ─────────────── */
.unread-notifications-section {
    margin-bottom: 2rem;
}

.unread-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.unread-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.unread-section-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.unread-show-all-btn {
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    font-weight: 500;
    border: 1px solid var(--border-default);
}

.unread-show-all-btn:hover {
    color: var(--notif-accent);
    border-color: var(--notif-accent-border);
}

.unread-mark-all-btn {
    background: none;
    border: none;
    color: var(--notif-accent);
    padding: 0.35rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    font-weight: 500;
}

.unread-mark-all-btn:hover {
    opacity: 0.7;
}

.unread-notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 2px;
}

.unread-notification-item {
    background: var(--card-bg);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}

.unread-notification-item:hover {
    border-color: var(--notif-accent-border);
    background: var(--notif-accent-light);
}

.unread-notification-item.read {
    opacity: 0.6;
}

/* Unread indicator — slim left accent line */
.unread-notification-item.unread {
    border-left: 2px solid var(--notif-accent);
    padding-left: calc(1.1rem - 1px);
}

/* Remove the absolute dot, accent border is enough */
.unread-notification-item.unread::before {
    display: none;
}

.unread-notification-content {
    flex: 1;
    min-width: 0;
}

.unread-notification-headline {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
    min-width: 0;
    flex-wrap: wrap;
}

.unread-notification-date-inline {
    font-size: 0.78rem;
    color: var(--text-muted, #999);
    white-space: nowrap;
    font-weight: 400;
}

.unread-notification-separator {
    font-size: 0.7rem;
    color: var(--border-default);
    line-height: 1;
}

.unread-notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
    min-width: 0;
    color: var(--text-primary);
}

.unread-notification-message {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
}

.unread-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.84rem;
    padding: 1.5rem 1rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .notifications-panel {
        width: calc(100vw - 2rem);
        right: -1rem;
    }

    .tracked-cards-grid {
        grid-template-columns: 1fr;
    }
}
