/* ============================================
   NOTIFICATIONS STYLES - RTL FIXED
   ============================================ */

/* Notifications Wrapper */
.notifications-wrapper {
    position: relative;
}

/* Bell Button */
.notifications-bell {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    color: var(--text-color, #333);
    font-size: 1.2rem;
}

.notifications-bell:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.1));
    transform: scale(1.1);
}

.notifications-bell.has-notifications {
    animation: bellShake 0.5s ease-in-out;
}

@keyframes bellShake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(10deg); }
}

/* Badge */
.notifications-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(255, 71, 87, 0.4);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}

.notifications-badge.hidden {
    display: none;
}

.notifications-badge.pulse {
    animation: badgePulse 1s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Dropdown */
.notifications-dropdown {
    position: fixed;
    top: 60px;       /* distance from top of page */
    left: 10px;      /* align to left */
    right: auto;
    width: 420px;
    max-height: 600px;
    background: var(--card-bg, #fff);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    z-index: 1000;
    overflow: hidden;
}

.notifications-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Header */
.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #eee);
    background: linear-gradient(135deg, var(--primary-color, #667eea) 0%, var(--secondary-color, #764ba2) 100%);
    color: white;
}

.notifications-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* The header holds more than one control now (mark-all-read plus the link to
   the notification settings page), so they are grouped and space-between keeps
   the title on one side and the group on the other. */
.notifications-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mark-all-read-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    /* One of these is an <a>: without this it inherits the link underline and
       sits a couple of pixels off the button beside it. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

.mark-all-read-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Tabs */
.notifications-tabs {
    display: flex;
    padding: 10px 15px;
    gap: 10px;
    background: var(--bg-secondary, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #eee);
}

.notification-tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted, #666);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}

.notification-tab:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

.notification-tab.active {
    background: var(--primary-color, #667eea);
    color: var(--text-color);
}

.notification-message {
    color: var(--text-muted, #666);

}
/* Notifications List */
.notifications-list {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color, #667eea) transparent;
}

.notifications-list::-webkit-scrollbar {
    width: 6px;
}

.notifications-list::-webkit-scrollbar-track {
    background: transparent;
}

.notifications-list::-webkit-scrollbar-thumb {
    background: var(--primary-color, #667eea);
    border-radius: 3px;
}

/* Loading & Empty States */
.notifications-loading,
.notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted, #999);
}

.notifications-loading i,
.notifications-empty i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.notifications-empty span,
.notifications-loading span {
    font-size: 0.95rem;
}

/* ============================================
   NOTIFICATION ITEM - RTL FIXED
   ============================================ */

.notification-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #eee);
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    position: relative;
    text-align: start;
}

/* RTL: Reverse the flex direction */
[dir="rtl"] .notification-item {
    flex-direction: row-reverse;
}

.notification-item:hover {
    background: var(--hover-bg, rgba(102, 126, 234, 0.05));
}

.notification-item.unread {
    background: var(--unread-bg, rgba(102, 126, 234, 0.08));
}

/* Unread indicator - LTR */
.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--primary-color, #667eea);
    border-radius: 0 4px 4px 0;
}

/* Unread indicator - RTL */
[dir="rtl"] .notification-item.unread::before {
    left: auto;
    right: 0;
    border-radius: 4px 0 0 4px;
}

/* Notification Icon */
.notification-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-icon.subscription {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.notification-icon.warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.notification-icon.success {
    background: linear-gradient(135deg, #4caf50, #43a047);
    color: white;
}

.notification-icon.error {
    background: linear-gradient(135deg, #f44336, #e53935);
    color: white;
}

.notification-icon.info {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
}

/* Notification Content */
.notification-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    text-align: start;
}

/* RTL text alignment */
[dir="rtl"] .notification-content {
    text-align: right;
}

/* ============================================
   SUBSCRIPTION ALERT BANNER
   ============================================ */

.subscription-alert {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    animation: slideDown 0.5s ease;
    position: fixed;
    top: 10px;
    left: 10px; /* always left */
    right: auto;
    width: calc(100% - 20px);
    max-width: 500px;
    z-index: 10000;
}

.subscription-alert.expired {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

[dir="rtl"] .subscription-alert {
    flex-direction: row-reverse;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 10px;       /* align top */
    left: 10px;      /* always left */
    right: auto;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 450px;
    animation: toastSlideIn 0.4s ease;
    border-left: 4px solid var(--primary-color, #667eea);
}

.toast.success { border-color: #4caf50; }
.toast.warning { border-color: #ff9800; }
.toast.error { border-color: #f44336; }
.toast.info { border-color: #2196f3; }

/* LTR content alignment */
.toast-content {
    flex: 1;
    min-width: 0;
    text-align: start;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color, #333);
    margin-bottom: 4px;
    word-wrap: break-word;
    line-height: 1.4;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    line-height: 1.5;
    word-wrap: break-word;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted, #999);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--hover-bg, rgba(0, 0, 0, 0.1));
    color: var(--text-color, #333);
}
/* Dark Mode - Notifications */
[data-theme="dark"] .notification-item {
    background: var(--card-background, #252535); /* normal read notifications */
    color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .notification-item.unread {
    /*background: var(--unread-bg, rgba(102, 126, 234, 0.12)); !* unread notifications *!*/
    color: var(--text-primary, #e0e0e0);
}

/*.notification-item.unread {*/
/*    background: var(--unread-bg, rgba(102, 126, 234, 0.08));*/
/*}*/
[data-theme="dark"] .notifications-empty,
[data-theme="dark"] .notifications-loading {
    background: var(--card-background, #252535); /* same as notification card background */
    color: var(--text-muted, #aaa);              /* muted text in dark mode */
}

/* Icons inside empty/loading */
[data-theme="dark"] .notifications-empty i,
[data-theme="dark"] .notifications-loading i {
    color: rgba(255, 255, 255, 0.3); /* faded icon for dark mode */
}
/* Dark Mode - Toasts */
[data-theme="dark"] .toast-container {
    /* Optional: keep container transparent or inherit dark background */
    /* Usually we don’t need a background for the container itself */
}

[data-theme="dark"] .toast {
    background: var(--card-background, #252535); /* dark background for toast */
    color: var(--text-primary, #e0e0e0);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4); /* stronger shadow for dark mode */
}

[data-theme="dark"] .toast-title {
    color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .toast-message {
    color: var(--text-muted, #aaa);
}

/* Optional: toast-icon backgrounds for dark mode if needed */
[data-theme="dark"] .toast.success .toast-icon {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}
[data-theme="dark"] .toast.warning .toast-icon {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}
[data-theme="dark"] .toast.error .toast-icon {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}
[data-theme="dark"] .toast.info .toast-icon {
    background: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
}

/* Optional: close button for dark mode */
[data-theme="dark"] .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

/* Mark all as read button - light mode */
.notifications-header .mark-all-read-btn {
    background: rgba(0, 0, 0, 0.05); /* subtle contrast on light cards */
    color: var(--accent-color);      /* icon/text color visible */
}

/* Hover effect */
.notifications-header .mark-all-read-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}
[data-theme="dark"] .notifications-header .mark-all-read-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

[data-theme="dark"] .notifications-header .mark-all-read-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}
/* ============================================
   RESPONSIVE STYLES (Mobile Adaptations)
   ============================================ */

@media screen and (max-width: 576px) {

    /* 1. Adjust Dropdown Width & Positioning */
    .notifications-dropdown {
        width: calc(100% - 20px); /* Full width minus margins */
        left: 10px;
        right: 10px;
        top: 60px;
        max-height: 80vh; /* Prevent it from going off-screen vertically */
        transform-origin: top center;
    }

    /* Adjust list height so the dropdown doesn't get cut off */
    .notifications-list {
        max-height: 60vh;
    }

    /* 2. Adjust Tabs for small screens */
    .notifications-tabs {
        padding: 10px;
        overflow-x: auto; /* Allow scrolling if many tabs exist */
        white-space: nowrap;
    }

    .notification-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
        flex: 1;
        text-align: center;
    }

    /* 3. Adjust Notification Item Padding */
    .notification-item {
        padding: 12px 15px; /* Slightly tighter padding */
        gap: 10px;
    }

    .notification-icon {
        width: 40px;  /* Smaller icon */
        height: 40px;
        min-width: 40px;
        font-size: 1rem;
    }

    .notification-content h4 {
        font-size: 0.9rem; /* Prevent headline wrapping too early */
    }

    .notification-content p {
        font-size: 0.8rem;
    }

    /* 4. Responsive Toasts */
    .toast-container {
        width: 100%;
        left: 0;
        right: 0;
        padding: 0 10px; /* Add breathing room on sides */
        align-items: center; /* Center toasts */
    }

    .toast {
        min-width: 0; /* Remove fixed min-width */
        width: 100%;  /* Span full container width */
        max-width: 100%;
        margin-bottom: 10px;
    }

    /* 5. Subscription Alert */
    .subscription-alert {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        flex-direction: column; /* Stack text and actions if needed */
        text-align: center;
        gap: 10px;
    }

    /* RTL Specific Mobile Fixes */
    [dir="rtl"] .notifications-dropdown {
        left: 10px;
        right: 10px; /* Ensure equal spacing in RTL */
    }
}
