/**
 * User Notifications (Bell Icon + Dropdown)
 */

/* Bell Container - pushes to right side of header */
.notification-bell-container {
    position: relative;
    margin-left: auto;
}

/* Notification Bell Button */
.notification-bell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    transition: background 0.2s ease, color 0.3s ease;
    gap: 2px;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-bell svg {
    width: 20px;
    height: 20px;
}

/* Breathing animation for new notifications */
@keyframes bell-breathing {
    0%, 100% {
        color: #ff6b6b;
        filter: drop-shadow(0 0 2px rgba(255, 107, 107, 0.5));
    }
    50% {
        color: #dc3545;
        filter: drop-shadow(0 0 8px rgba(220, 53, 69, 0.8));
    }
}

.notification-bell--has-new {
    animation: bell-breathing 1.5s ease-in-out infinite;
}

.notification-bell--has-new svg {
    color: inherit;
}

/* Badge for unread count - now below the bell */
.notification-bell__badge {
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background: #dc3545;
    color: white;
    font-size: 9px;
    font-weight: 700;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notification-bell__badge:empty,
.notification-bell__badge[data-count="0"] {
    display: none;
}

/* Dropdown Container */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

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

/* Dropdown Header */
.notification-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.notification-dropdown__title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.notification-dropdown__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-dropdown__mark-read {
    background: none;
    border: none;
    color: #368BC1;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.notification-dropdown__mark-read:hover {
    background: #e8f4fc;
}

.notification-dropdown__mark-read:disabled {
    color: #adb5bd;
    cursor: not-allowed;
}

.notification-dropdown__settings-btn {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.notification-dropdown__settings-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Notification List */
.notification-dropdown__list {
    flex: 1;
    max-height: 360px;
    overflow-y: auto;
    border-radius: 0 0 12px 12px;
}

/* Individual Notification Item */
.notification-item {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item--unread {
    background: #f0f7fc;
}

.notification-item--unread:hover {
    background: #e8f4fc;
}

/* Notification Header (always visible) */
.notification-item__header {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    align-items: center;
}

/* Notification Icon */
.notification-item__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
}

/* Icon color variants by notification type */
.notification-item__icon--question {
    background: #e8f4fc;
    color: #368BC1;
}

.notification-item__icon--forum {
    background: #d4edda;
    color: #155724;
}

.notification-item__icon--mention {
    background: #fff3cd;
    color: #856404;
}

.notification-item__icon--reply {
    background: #cce5ff;
    color: #004085;
}

.notification-item__icon svg {
    width: 18px;
    height: 18px;
}

/* Notification Summary */
.notification-item__summary {
    flex: 1;
    min-width: 0;
}

/* Type label (Question Discussion, Forum Reply, etc.) */
.notification-item__type-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 0.125rem;
}

.notification-item__title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #212529;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.notification-item__time {
    font-size: 0.75rem;
    color: #adb5bd;
}

/* Delete Button */
.notification-item__delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #adb5bd;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s ease;
}

.notification-item:hover .notification-item__delete {
    opacity: 1;
}

.notification-item__delete:hover {
    background: #fee2e2;
    color: #dc3545;
}

.notification-item__delete svg {
    width: 16px;
    height: 16px;
}

/* Expanded Content (hidden by default) */
.notification-item__expanded {
    display: none;
    padding: 0 1.25rem 1rem 1.25rem;
    margin-left: 3rem;
    flex-direction: column;
    gap: 0.75rem;
}

.notification-item--expanded .notification-item__expanded {
    display: flex;
}

.notification-item--expanded {
    background: #f8f9fa;
}

.notification-item--expanded.notification-item--unread {
    background: #e8f4fc;
}

/* Full Message */
.notification-item__full-message {
    background: white;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border-left: 3px solid #368BC1;
}

.notification-item__full-message p {
    margin: 0;
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.5;
    font-style: italic;
}

/* View in Question Button */
.notification-item__view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #368BC1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
    align-self: flex-start;
}

.notification-item__view-btn:hover {
    background: #2d7aa8;
    color: white;
}

.notification-item__view-btn svg {
    flex-shrink: 0;
}

/* Empty State */
.notification-dropdown__empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #6c757d;
}

.notification-dropdown__empty svg {
    width: 48px;
    height: 48px;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.notification-dropdown__empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Loading State */
.notification-dropdown__loading {
    padding: 2rem;
    text-align: center;
    color: #6c757d;
}

/* View All Link */
.notification-dropdown__footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    background: #f8f9fa;
}

.notification-dropdown__view-all {
    color: #368BC1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.notification-dropdown__view-all:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        width: 100%;
        max-height: calc(100vh - 60px);
        border-radius: 0;
    }

    .notification-bell__badge {
        top: 2px;
        right: 2px;
    }
}

/* ========================================
   Notification Settings Modal Override
   ======================================== */

#notification-settings-modal.modal-overlay {
    z-index: 99999;
}

/* ========================================
   Notification Settings (inside modal)
   ======================================== */

.notification-settings__description {
    margin: 0 0 1.5rem 0;
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Settings Table */
.notification-settings__table {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.notification-settings__table-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.notification-settings__row {
    display: flex;
    border-bottom: 1px solid #f1f3f5;
}

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

.notification-settings__cell {
    padding: 1rem;
    display: flex;
    align-items: center;
}

.notification-settings__cell--type {
    flex: 1;
    gap: 0.75rem;
}

.notification-settings__cell--toggle {
    width: 80px;
    justify-content: center;
}

.notification-settings__type-icon {
    font-size: 1.25rem;
}

.notification-settings__type-label {
    font-size: 0.9rem;
    color: #212529;
}

/* Toggle Switch */
.notification-settings__toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.notification-settings__toggle-track {
    display: block;
    width: 44px;
    height: 24px;
    background: #dee2e6;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s ease;
}

.notification-settings__toggle--active .notification-settings__toggle-track {
    background: #368BC1;
}

.notification-settings__toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.notification-settings__toggle--active .notification-settings__toggle-thumb {
    transform: translateX(20px);
}

/* Mobile Responsive for Settings */
@media (max-width: 768px) {
    .notification-settings__cell--toggle {
        width: 60px;
    }

    .notification-settings__toggle-track {
        width: 40px;
        height: 22px;
    }

    .notification-settings__toggle-thumb {
        width: 18px;
        height: 18px;
    }

    .notification-settings__toggle--active .notification-settings__toggle-thumb {
        transform: translateX(18px);
    }
}

/* ========================================
   DARK MODE STYLES
   ======================================== */

/* Manual dark mode */
html.dark-mode .notification-dropdown {
    background: #1a1d23;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

html.dark-mode .notification-dropdown__header {
    background: #22262e;
    border-bottom-color: #363c47;
}

html.dark-mode .notification-dropdown__title {
    color: #f3f4f6;
}

html.dark-mode .notification-dropdown__mark-read {
    color: #60a5fa;
}

html.dark-mode .notification-dropdown__mark-read:hover {
    background: #1e3a5f;
}

html.dark-mode .notification-dropdown__mark-read:disabled {
    color: #4b5563;
}

html.dark-mode .notification-dropdown__settings-btn {
    color: #9ca3af;
}

html.dark-mode .notification-dropdown__settings-btn:hover {
    background: #363c47;
    color: #f3f4f6;
}

html.dark-mode .notification-item {
    border-bottom-color: #2a2f38;
}

html.dark-mode .notification-item:hover {
    background: #22262e;
}

html.dark-mode .notification-item--unread {
    background: #1e293b;
}

html.dark-mode .notification-item--unread:hover {
    background: #1e3a5f;
}

html.dark-mode .notification-item--expanded {
    background: #22262e;
}

html.dark-mode .notification-item--expanded.notification-item--unread {
    background: #1e3a5f;
}

html.dark-mode .notification-item__icon {
    background: #363c47;
}

html.dark-mode .notification-item__icon--question {
    background: #1e3a5f;
    color: #60a5fa;
}

html.dark-mode .notification-item__icon--forum {
    background: #1a2e1a;
    color: #4ade80;
}

html.dark-mode .notification-item__icon--mention {
    background: #422006;
    color: #fbbf24;
}

html.dark-mode .notification-item__icon--reply {
    background: #1e3a8a;
    color: #93c5fd;
}

html.dark-mode .notification-item__type-label {
    color: #9ca3af;
}

html.dark-mode .notification-item__title {
    color: #f3f4f6;
}

html.dark-mode .notification-item__time {
    color: #6b7280;
}

html.dark-mode .notification-item__delete {
    color: #6b7280;
}

html.dark-mode .notification-item__delete:hover {
    background: #450a0a;
    color: #f87171;
}

html.dark-mode .notification-item__full-message {
    background: #1a1d23;
    border-left-color: #60a5fa;
}

html.dark-mode .notification-item__full-message p {
    color: #d1d5db;
}

html.dark-mode .notification-dropdown__empty {
    color: #9ca3af;
}

html.dark-mode .notification-dropdown__empty svg {
    color: #4b5563;
}

html.dark-mode .notification-dropdown__loading {
    color: #9ca3af;
}

html.dark-mode .notification-dropdown__footer {
    background: #22262e;
    border-top-color: #363c47;
}

html.dark-mode .notification-dropdown__view-all {
    color: #60a5fa;
}

/* Notification Settings - Dark Mode */
html.dark-mode .notification-settings__description {
    color: #9ca3af;
}

html.dark-mode .notification-settings__table {
    border-color: #363c47;
}

html.dark-mode .notification-settings__table-header {
    background: #22262e;
    border-bottom-color: #363c47;
    color: #9ca3af;
}

html.dark-mode .notification-settings__row {
    border-bottom-color: #2a2f38;
}

html.dark-mode .notification-settings__type-label {
    color: #f3f4f6;
}

html.dark-mode .notification-settings__toggle-track {
    background: #4b5563;
}

html.dark-mode .notification-settings__toggle--active .notification-settings__toggle-track {
    background: #3b82f6;
}

/* Auto dark mode */
@media (prefers-color-scheme: dark) {
    html.dark-mode-auto .notification-dropdown {
        background: #1a1d23;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }

    html.dark-mode-auto .notification-dropdown__header {
        background: #22262e;
        border-bottom-color: #363c47;
    }

    html.dark-mode-auto .notification-dropdown__title {
        color: #f3f4f6;
    }

    html.dark-mode-auto .notification-dropdown__mark-read {
        color: #60a5fa;
    }

    html.dark-mode-auto .notification-dropdown__mark-read:hover {
        background: #1e3a5f;
    }

    html.dark-mode-auto .notification-dropdown__mark-read:disabled {
        color: #4b5563;
    }

    html.dark-mode-auto .notification-dropdown__settings-btn {
        color: #9ca3af;
    }

    html.dark-mode-auto .notification-dropdown__settings-btn:hover {
        background: #363c47;
        color: #f3f4f6;
    }

    html.dark-mode-auto .notification-item {
        border-bottom-color: #2a2f38;
    }

    html.dark-mode-auto .notification-item:hover {
        background: #22262e;
    }

    html.dark-mode-auto .notification-item--unread {
        background: #1e293b;
    }

    html.dark-mode-auto .notification-item--unread:hover {
        background: #1e3a5f;
    }

    html.dark-mode-auto .notification-item--expanded {
        background: #22262e;
    }

    html.dark-mode-auto .notification-item--expanded.notification-item--unread {
        background: #1e3a5f;
    }

    html.dark-mode-auto .notification-item__icon {
        background: #363c47;
    }

    html.dark-mode-auto .notification-item__icon--question {
        background: #1e3a5f;
        color: #60a5fa;
    }

    html.dark-mode-auto .notification-item__icon--forum {
        background: #1a2e1a;
        color: #4ade80;
    }

    html.dark-mode-auto .notification-item__icon--mention {
        background: #422006;
        color: #fbbf24;
    }

    html.dark-mode-auto .notification-item__icon--reply {
        background: #1e3a8a;
        color: #93c5fd;
    }

    html.dark-mode-auto .notification-item__type-label {
        color: #9ca3af;
    }

    html.dark-mode-auto .notification-item__title {
        color: #f3f4f6;
    }

    html.dark-mode-auto .notification-item__time {
        color: #6b7280;
    }

    html.dark-mode-auto .notification-item__delete {
        color: #6b7280;
    }

    html.dark-mode-auto .notification-item__delete:hover {
        background: #450a0a;
        color: #f87171;
    }

    html.dark-mode-auto .notification-item__full-message {
        background: #1a1d23;
        border-left-color: #60a5fa;
    }

    html.dark-mode-auto .notification-item__full-message p {
        color: #d1d5db;
    }

    html.dark-mode-auto .notification-dropdown__empty {
        color: #9ca3af;
    }

    html.dark-mode-auto .notification-dropdown__empty svg {
        color: #4b5563;
    }

    html.dark-mode-auto .notification-dropdown__loading {
        color: #9ca3af;
    }

    html.dark-mode-auto .notification-dropdown__footer {
        background: #22262e;
        border-top-color: #363c47;
    }

    html.dark-mode-auto .notification-dropdown__view-all {
        color: #60a5fa;
    }

    /* Notification Settings - Auto Dark Mode */
    html.dark-mode-auto .notification-settings__description {
        color: #9ca3af;
    }

    html.dark-mode-auto .notification-settings__table {
        border-color: #363c47;
    }

    html.dark-mode-auto .notification-settings__table-header {
        background: #22262e;
        border-bottom-color: #363c47;
        color: #9ca3af;
    }

    html.dark-mode-auto .notification-settings__row {
        border-bottom-color: #2a2f38;
    }

    html.dark-mode-auto .notification-settings__type-label {
        color: #f3f4f6;
    }

    html.dark-mode-auto .notification-settings__toggle-track {
        background: #4b5563;
    }

    html.dark-mode-auto .notification-settings__toggle--active .notification-settings__toggle-track {
        background: #3b82f6;
    }
}
