#app-notifications {
    position: relative;
}

#app-notifications .notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
    pointer-events: none;
}

/* --- Toolbar --- */

.notification-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-toolbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-unreads-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin: 0;
    vertical-align: middle;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 20px;
    transition: background-color 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #7c5cbf;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* --- Full page grid styles --- */

.notification-row {
    cursor: default;
}

.notification-clickable {
    cursor: pointer;
}

#datatables_manage-notifications {
    table-layout: fixed;
}

table.dataTable.table-condensed > tbody td.notification-cell {
    height: auto !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
}

.notification-message {
    min-width: 0;
}

.notification-title-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.notification-body-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.notification-body-text {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-message.expanded .notification-body-text {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: unset;
    white-space: normal;
    word-break: break-word;
}

.notification-expand-text {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: #888;
    line-height: 18px;
}

.notification-expand-text:hover,
.notification-expand-text:focus {
    color: #333;
    outline: none;
}

.notification-expand-text:focus {
    text-decoration: underline;
}

/* Unread rows: purple background */
tr.notification-row.notification-unread > td {
    font-weight: 600 !important;
    background-color: #f0eafa !important;
    color: #333 !important;
}

tr.notification-row.notification-unread:nth-child(odd) > td {
    background-color: #e6dbf5 !important;
}

/* Read rows: lighter text */
tr.notification-row.notification-read > td {
    color: #888 !important;
}

/* Selected rows: clear our backgrounds, let DataTables blue apply */
tr.notification-row.selected > td,
tr.notification-row.selected:nth-child(odd) > td {
    background-color: unset !important;
    color: #fff !important;
}

tr.notification-row.selected > td .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

tr.notification-row.selected > td .notification-dot {
    background-color: #fff !important;
}

tr.notification-row.selected > td .notification-expand-text {
    color: #fff !important;
}

/* Purple dot before title in Notification column for unread rows */
tr.notification-row.notification-unread .notification-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #7c5cbf;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

tr.notification-row.notification-read .notification-dot {
    display: none;
}

/* Icon-only action buttons */
.notification-actions a {
    color: #666;
    font-size: 15px;
    padding: 2px 6px;
    border-radius: 3px;
    transition: color 0.15s, background-color 0.15s;
}

.notification-actions a:hover {
    color: #333;
    background-color: #eee;
    text-decoration: none;
}

.notification-actions .notification-delete:hover {
    color: #d9534f;
    background-color: #fdf0ef;
}

/* --- Notification Dropdown (inside Bootstrap dropdown-menu) --- */

#app-notifications .dropdown-menu {
    width: 350px;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification-dropdown-container {
    list-style: none;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.notification-dropdown-header strong {
    font-size: 14px;
    color: #333;
}

.notification-dropdown-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notification-dropdown-unreads-label {
    font-size: 12px;
    color: #888;
}

/* Small toggle variant for dropdown */
.toggle-switch-sm {
    width: 28px;
    height: 16px;
}

.toggle-switch-sm .toggle-slider:before {
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
}

.toggle-switch-sm input:checked + .toggle-slider:before {
    transform: translateX(12px);
}

.notification-dropdown-mark-all-read {
    font-size: 12px;
    color: #337ab7;
    text-decoration: none;
}

.notification-dropdown-mark-all-read:hover {
    text-decoration: underline;
}

.notification-dropdown-body {
    overflow-y: auto;
    max-height: 320px;
}

.notification-dropdown-item {
    display: flex;
    flex-direction: row;
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.15s;
}

.notification-dropdown-item:last-child {
    border-bottom: none;
}

.notification-dropdown-item:hover {
    background-color: #f5f5f5;
}

.notification-dropdown-item.notification-unread {
    background-color: #f0f7ff;
}

.notification-dropdown-item.notification-unread:hover {
    background-color: #e3effa;
}

.notification-dropdown-item.notification-unread .notification-dropdown-title {
    font-weight: 600;
}

.notification-dropdown-item.notification-read {
    opacity: 0.75;
}

.notification-dropdown-icon {
    width: 30px;
    text-align: center;
    flex-shrink: 0;
    padding-top: 2px;
    color: #666;
    font-size: 14px;
}

.notification-dropdown-content {
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.notification-dropdown-title {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-dropdown-text {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.notification-dropdown-time {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

.notification-dropdown-footer {
    padding: 10px 15px;
    text-align: center;
    border-top: 1px solid #eee;
}

.notification-dropdown-footer a {
    font-size: 13px;
    color: #337ab7;
    text-decoration: none;
}

.notification-dropdown-footer a:hover {
    text-decoration: underline;
}

.notification-dropdown-empty {
    padding: 30px 15px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* --- Notification Preferences --- */

.notification-pref-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.notification-pref-row:last-child {
    border-bottom: none;
}

.notification-pref-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 30px;
}

.notification-pref-info strong {
    font-size: 14px;
}

.notification-pref-info .text-muted {
    font-size: 12px;
    margin-top: 2px;
}

.notification-pref-icon {
    font-size: 18px;
    color: #888;
    flex-shrink: 0;
}
