/* ===== MODERN NOTIFICATION SYSTEM ===== */

div#notifier {
    position: fixed;
    bottom: 20px;
    inset-inline-end: 20px;
    z-index: 1221;
    display: flex;
    flex-direction: column-reverse;
    max-height: calc(100vh - 80px);
    padding: 0;
    pointer-events: none; /* Allow clicks through container */
}

/* Left position (default for RTL) */
div#notifier.notifier-position-right {
    inset-inline-end: auto;
    inset-inline-start: 110px;
}

/* Right position */
div#notifier.notifier-position-left {
    inset-inline-start: auto;
    inset-inline-end: 20px;
}

/* ===== BASE NOTIFICATION ITEM ===== */
.notifier-item {
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    
    opacity: 0;
    transform: translateX(100%) scale(0.95);
    transition: all 0.6s cubic-bezier(0, 0.09, 0.26, 1.32);
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

/* RTL direction adjustments */
body.dir-rtl .notifier-item {
    transform: translateX(-10px) scale(0.95);
}

/* Active state animation - default (left position) */
.notifier-item.active {
    opacity: 1;
    transform: translateX(0) scale(1);
    animation: slideInLeft 0.6s cubic-bezier(0, 0.15, 0, 1) forwards;
}

/* Right position animation */
div#notifier.notifier-position-right .notifier-item.active {
    animation: slideInRight 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

body.dir-rtl .notifier-item.active {
    animation: slideInLeft 0.6s cubic-bezier(0, 0.15, 0, 1) forwards;
}

body.dir-rtl div#notifier.notifier-position-right .notifier-item.active {
    animation: slideInRight 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Hover effects */
.notifier-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* ===== NOTIFICATION ICONS ===== */
.notifier-icon {
    flex: 0 0 48px;
    height: 48px;
    margin-inline-end: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 22px;
    position: relative;
    background: #f8f9fa;
}

/* Avatar image styling */
.notifier-icon img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Fallback for missing avatars - broader browser support */
.notifier-icon:not(:has(img)),
.notifier-icon:empty {
    background: linear-gradient(135deg, #070353, #1da29e);
    color: white;
    box-shadow: 0 2px 8px rgba(7, 3, 83, 0.3);
}

/* Alternative fallback for older browsers */
.notifier-icon.no-avatar {
    background: linear-gradient(135deg, #070353, #1da29e);
    color: white;
    box-shadow: 0 2px 8px rgba(7, 3, 83, 0.3);
}

body.dir-rtl .notifier-icon.no-avatar {
    background: linear-gradient(225deg, #070353, #1da29e);
}

/* ===== MESSAGE CONTENT ===== */
.notifier-msg {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: #2d3748;
    margin-inline-end: 40px;
    text-wrap: balance;
}

.notifier-content {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.3;
    display: none;
}

/* ===== CLOSE BUTTON ===== */
.notifier-item-close {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.notifier-item-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    /* opacity: 1; */
    transform: scale(1.1);
}

/* ===== NOTIFICATION TYPES ===== */

/* Success Notifications */
.notifier-item.success {
    border-inline-start: 4px solid #10b981;
    background: linear-gradient(135deg, white, #f0fdf4);
}

.notifier-item.success .notifier-icon:not(:has(img)) {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

/* Info Notifications */
.notifier-item.info {
    border-inline-start: 4px solid #3b82f6;
    background: linear-gradient(135deg, white, #eff6ff);
}

.notifier-item.info .notifier-icon:not(:has(img)) {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* Warning Notifications */
.notifier-item.warning {
    border-inline-start: 4px solid #f59e0b;
    background: linear-gradient(135deg, white, #fffbeb);
}

.notifier-item.warning .notifier-icon:not(:has(img)) {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* Copy Notifications */
.notifier-item.copy {
    border-inline-start: 4px solid #6366f1;
    background: linear-gradient(135deg, white, #f0f9ff);
}

.notifier-item.copy .notifier-icon:not(:has(img)) {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

/* ===== ERROR NOTIFICATIONS (SPECIAL DESIGN) ===== */
.notifier-item.error {
    position: fixed;
    top: 50%;
    inset-inline-start: 50%;
    transform: translate(50%, -50%) scale(0.9);
    opacity: 0;
    min-width: 420px;
    max-width: 650px;
    width: auto;
    margin: 0;
    padding: 28px 32px;
    background: linear-gradient(135deg, #fef2f2, white, #fef7f7);
    border: 2px solid #f87171;
    border-radius: 20px;
    box-shadow: 
        0 32px 64px rgba(239, 68, 68, 0.2),
        0 16px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(239, 68, 68, 0.15);
    z-index: 9999;
    backdrop-filter: blur(16px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Add a subtle pulse effect */
    animation: errorGlow 2s ease-in-out infinite alternate;
}

.notifier-item.error.active {
    opacity: 1;
    transform: translate(50%, -50%) scale(1);
    animation: errorPulse 0.6s ease-out;
}

.notifier-item.error .notifier-icon {
    flex: 0 0 56px;
    height: 56px;
    margin-inline-end: 20px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.notifier-item.error .notifier-msg {
    font-size: 16px;
    font-weight: 600;
    color: #991b1b;
    margin-inline-end: 50px;
    line-height: 1.5;
}

.notifier-item.error .notifier-item-close {
    width: 32px;
    height: 32px;
    top: 16px;
    inset-inline-end: 16px;
    font-size: 16px;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.notifier-item.error .notifier-item-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

/* Error backdrop */
.notifier-item.error::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.1), rgba(0, 0, 0, 0.4));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(8px);
}

.notifier-item.error.active::before {
    opacity: 1;
}

/* ===== USER NOTIFICATIONS WITH AVATARS ===== */
.notifier-item.notification {
    background: linear-gradient(135deg, white, #f8fafc);
    border-inline-start: 4px solid #070353;
    min-width: 380px;
    max-width: 450px;
    padding: 18px 22px;
}

.notifier-item.notification .notifier-icon {
    flex: 0 0 52px;
    height: 52px;
    margin-inline-end: 16px;
    background: transparent;
}

.notifier-item.notification .notifier-icon img {
    width: 52px;
    height: 52px;
    border: 3px solid rgba(7, 3, 83, 0.1);
}

.notifier-item.notification .notifier-msg {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
}

/* Client logo for notifications */
.notifier-client-logo {
    position: absolute;
    bottom: 8px;
    inset-inline-end: 16px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    background: white;
}

.notifier-client-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

/* Notification type icon (background) */
.notifier-notif-icon {
    position: absolute;
    bottom: 3px;
    inset-inline-start: -1px;
    font-size: 30px;
    color: rgba(7, 3, 83, 0.08);
    top: 0;
    transform: rotate(-15deg);
    margin: auto;
    display: table;
}

body.dir-rtl .notifier-notif-icon {
    transform: rotate(15deg);
}

/* ===== SPECIAL NOTIFICATION TYPES ===== */
.notifier-item[data-notif-type-id="task_edit"],
.notifier-item[data-notif-type-id="brief_edit"] {
    border-inline-start-color: #fbbf24;
    background: linear-gradient(135deg, white, #fefce8);
    box-shadow: 
        0 8px 32px rgba(251, 191, 36, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(251, 191, 36, 0.1);
}

.notifier-item[data-notif-type-id="task_nudge"] {
    border-inline-start-color: #ef4444;
    background: linear-gradient(135deg, #fff5f5, #fef2f2);
    box-shadow:
        0 8px 32px rgba(239, 68, 68, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(239, 68, 68, 0.15);
    animation: nudgePulse 1.5s ease-in-out 1;
}

.notifier-item[data-notif-type-id="task_nudge"] .notifier-notif-icon {
    color: rgba(239, 68, 68, 0.15);
}

.notifier-item[data-notif-type-id="task_nudge"] .notifier-msg {
    color: #991b1b;
}

@keyframes nudgePulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(239, 68, 68, 0.18), 0 2px 8px rgba(0,0,0,0.1), 0 0 0 1px rgba(239, 68, 68, 0.15); }
    50% { box-shadow: 0 8px 32px rgba(239, 68, 68, 0.35), 0 2px 12px rgba(0,0,0,0.15), 0 0 0 2px rgba(239, 68, 68, 0.3); }
}

.notifier-item.notif-type--comment {
    border-inline-end-color: #8b5cf6;
    background: linear-gradient(135deg, white, #faf5ff);
}

/* ===== ANIMATIONS ===== */
@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-10px) scale(1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes errorPulse {
    0% {
        transform: translate(50%, -50%) scale(0.9);
    }
    50% {
        transform: translate(50%, -50%) scale(1.05);
    }
    100% {
        transform: translate(50%, -50%) scale(1);
    }
}

@keyframes coolNotificationEntrance {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    50% {
        opacity: 0.8;
        transform: translateX(20px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes errorGlow {
    0% {
        box-shadow: 
            0 32px 64px rgba(239, 68, 68, 0.2),
            0 16px 32px rgba(0, 0, 0, 0.1),
            0 0 0 1px rgba(239, 68, 68, 0.15);
    }
    100% {
        box-shadow: 
            0 36px 72px rgba(239, 68, 68, 0.25),
            0 18px 36px rgba(0, 0, 0, 0.12),
            0 0 0 1px rgba(239, 68, 68, 0.2),
            0 0 20px rgba(239, 68, 68, 0.1);
    }
}
.notifier-item {
    display: none;
}

.notifier-item:nth-child(-n+7) {
    display: flex;
}
/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 767px) {
    div#notifier {
        bottom: 10px;
        inset-inline-end: 10px;
        inset-inline-start: 10px;
    }
    
    div#notifier.notifier-position-left {
        inset-inline-end: 10px;
        inset-inline-start: 10px;
    }
    
    div#notifier.notifier-position-right {
        inset-inline-end: 10px;
        inset-inline-start: 10px;
    }
    
    .notifier-item {
        min-width: auto;
        max-width: none;
        width: 100%;
        margin-bottom: 8px;
        padding: 14px 16px;
    }
    
    .notifier-item.error {
        min-width: auto;
        max-width: calc(100vw - 20px);
        inset-inline-start: 10px;
        inset-inline-end: 10px;
        transform: translateY(-50%) scale(0.9);
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .notifier-item.error.active {
        transform: translateY(-50%) scale(1);
    }
    
    .notifier-item.error .notifier-icon {
        flex: 0 0 48px;
        height: 48px;
        font-size: 24px;
    }
    
    .notifier-item.error .notifier-msg {
        font-size: 15px;
        margin-inline-end: 40px;
    }
    
    .notifier-item.notification {
        min-width: auto;
        padding: 16px 18px;
    }
    
    .notifier-icon {
        flex: 0 0 40px;
        height: 40px;
        margin-inline-end: 12px;
    }
    
    .notifier-icon img {
        width: 40px;
        height: 40px;
    }
    
    .notifier-msg {
        font-size: 13px;
        margin-inline-end: 30px;
    }
}
 
/* ===== ACCESSIBILITY ===== */
.notifier-item:focus {
    outline: 2px solid #070353;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .notifier-item,
    .notifier-item.active {
        animation: none;
        transition: opacity 0.3s ease;
    }
}

/* ===== NOTIFICATIONS POPUP STYLES ===== */

/* Popup content container - specific to notifications popups */
.popup.task-popup .popup-content {
    padding: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Empty state */
.notifs-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.notifs-empty-state .not-found-error {
    text-align: center;
}

/* Notifications list container */
.notifs-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

/* Notification item row */
.notif-item-row {
    display: flex;
    width: 100%;
    align-items: stretch;
    border-bottom: 1px solid rgb(255 255 255 / 8%);
    transition: background-color 0.2s ease;
    position: relative;
}

.notif-item-row:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.notif-item-row:last-child {
    border-bottom: none;
}

/* Notification item - unread (light aqua background) */
.notif-item[data-was-read="0"] {
    background-color: rgba(5, 223, 215, 0.12);
    transition: background-color 0.2s ease;
}

body.dir-rtl .notif-item[data-was-read="0"] {
    border-inline-end: none;
    border-inline-start: 6px solid #05dfd7;
}

.notif-item[data-was-read="0"]:hover {
    background-color: rgba(5, 223, 215, 0.18);
}

/* Notification item - read */
.notif-item[data-was-read="1"] {
    background-color: transparent;
    border-inline-start: 6px solid transparent;
}

body.dir-rtl .notif-item[data-was-read="1"] {
    border-inline-end: none;
    border-inline-start: 6px solid transparent;
}

/* Main notification item container */
.notif-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    cursor: pointer;
    padding: 7px 10px;
    gap: 12px;
    position: relative;
    flex: 1;
    padding-inline-end: 50px;
}

/* Notification avatar image */
.notif-image {
    flex: 0 0 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-image img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Notification inner content */
.notif-inner {
    flex: 1;
    min-width: 0;
    padding: 0;
    position: relative;
}

/* Notification title */
.notif-title {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.5;
    margin: 4px;
    text-wrap: auto;
    /* display: flex; */
    flex-direction: column;
    gap: 4px;
}

.notif-item[data-was-read="0"] .notif-title {
    color: #000000;
    font-weight: 600;
}

.notif-item[data-was-read="1"] .notif-title {
    color: #666666;
    font-weight: 400;
}

/* Notification time */
.notif-time {
    font-size: 11px;
    font-weight: 400;
    color: #888888;
    margin-inline-end: auto;
}

.notif-item[data-was-read="0"] .notif-time {
    color: #666666;
}

/* Notification content */
.notif-content {
    font-size: 12px;
    color: #555555;
    font-weight: 400;
    line-height: 1.4;
    margin-top: 6px;
    display: none;
}

.notif-item[data-was-read="0"] .notif-content {
    color: #444444;
}

/* Client logo */
.notif-client-logo {
    flex: 0 0 36px;
    height: 36px;
    margin-inline-start: 8px;
    align-self: center;
}

.notif-client-logo img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 4px;
}

/* Notification action icons */
.notif-icons {
    flex: 0 0 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    color: #999999;
    position: absolute;
    z-index: 3;
    bottom: 0;
    top: 0;
    inset-inline-end:  10px;
}

.notif-icons > div {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: #999999;
}
.notif-icons > div:hover {
    background-color: rgba(5, 223, 215, 0.15);
    color: #05dfd7;
}

.notif-item[data-was-read="1"] .notif-icon-mark-as-read {
    display: none;
}

/* Entity name styling */
.notif-title span.ent {
    cursor: pointer;
}

.notif-title a {
    color: inherit;
    text-decoration: underline;
}

.notif-item span.ent span {
    text-decoration: underline;
}

.notif-item span.ent span.free-text {
    text-decoration: none;
    font-size: 12px;
    font-style: italic;
    display: block;
}

.notif-item span.ent span.free-text:before,
.notif-item span.ent span.free-text:after {
    content: '"';
}

/* ===== POPUP FOOTER STYLING ===== */
.popup-footer {
    position: sticky;
    bottom: 0;
    background: #ffffff;
    border-top: 1px solid rgba(7, 3, 83, 0.08);
    padding: 16px 20px;
    margin-top: auto;
    z-index: 10;
}

.popup-footer .form-row {
    margin: 0;
}

.popup-footer .button {
    min-width: 140px;
}

.popup[data-notif-id="notifs"] .popup-content {max-height: calc(100vh - 123px);}

.popup[data-notif-id="notifs"] .popup-inner.product-description {
    height: 100vh;
    overflow: hidden;
}

/* ===== NOTIFICATION FILTERS (TABS STYLE) ===== */
.notifs-filters {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    gap: 0;
    padding: 0 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgb(0 0 0 / 8%);
    background-color: transparent;
}

.notif-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: #030507;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.3;
    /* margin-bottom: 7px; */
    position: relative;
}

.notif-filter-btn:hover {
    color: #030507;
    opacity: 0.8;
}

.notif-filter-btn.active {
    color: #030507;
}

.notif-filter-btn.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #05dfd7;
}

.notif-filter-btn .filter-label {
    font-size: 13px;
    font-weight: 300;
    font-family: 'Open Sans';
    color: inherit;
}

.notif-filter-btn .filter-count {
    font-size: 10px;
    font-weight: 500;
    color: inherit;
    opacity: 0.7;
}

.notif-filter-btn.active .filter-count {
    opacity: 1;
}

/* ===== NOTIFICATION SETTINGS LINK ===== */
.notif-settings-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-start: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-inline-start: 10px;
    padding-inline-end: 0;
    color: #030507;
    text-decoration: none;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.notif-settings-link:hover {
    opacity: 1;
    color: #030507;
}

.notif-settings-link i {
    font-size: 14px;
}