/**
 * Notification System Styles
 * Comprehensive styling for notification UI components integrated into main interface
 * Requirements: 9.1, 9.2, 9.3, 9.4, 9.5
 */

/* Layout Header */
.layout-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header-left .site-title {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

.header-left .site-title a {
    color: var(--CS-aqua);
    text-decoration: none;
}

.header-center {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 8px 40px 8px 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--CS-aqua);
}

.search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
}

.search-btn:hover {
    color: #fff;
}

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

/* Notification Bell Icon and Badge */
.notification-bell-container {
    position: relative;
    display: inline-block;
}

.notification-bell {
    position: relative;
    display: inline-block;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

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

.notification-bell i,
.notification-bell wa-icon {
    font-size: 20px;
    color: #888;
    transition: color 0.2s ease;
}

.notification-bell.has-unread i,
.notification-bell.has-unread wa-icon {
    color: #fff;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1a1a1a;
    animation: pulse 2s infinite;
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 380px;
    max-height: 500px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: none;
    overflow: hidden;
    margin-top: 8px;
}

.notification-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

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

/* Notification Header */
.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    background: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.notification-actions {
    display: flex;
    gap: 10px;
}

.notification-action-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.notification-action-btn:hover {
    background-color: #444;
    color: #fff;
}

/* Notification List */
.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

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

.notification-list::-webkit-scrollbar-track {
    background: #333;
}

.notification-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Individual Notification Items */
.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid #444;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

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

.notification-item.unread {
    background-color: rgba(0, 123, 255, 0.1);
    border-left: 3px solid var(--CS-aqua);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background-color: var(--CS-aqua);
    border-radius: 50%;
}

/* Notification Avatar */
.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.notification-avatar.default {
    background-color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

/* Notification Content */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-message {
    font-size: 14px;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #888;
}

.notification-time {
    white-space: nowrap;
}

.notification-type {
    background-color: #444;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 500;
    color: #ccc;
}

.notification-type.mention {
    background-color: #ffc107;
    color: #000;
}

.notification-type.reply {
    background-color: #28a745;
    color: #fff;
}

.notification-type.like {
    background-color: #dc3545;
    color: #fff;
}

.notification-type.follow {
    background-color: #17a2b8;
    color: #fff;
}

.notification-type.share {
    background-color: #6f42c1;
    color: #fff;
}

/* Grouped Notifications */
.notification-item.grouped .notification-message {
    font-weight: 500;
}

.notification-group-count {
    background-color: var(--CS-aqua);
    color: #000;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
}

/* Empty State */
.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
}

.notification-empty i {
    font-size: 48px;
    color: #555;
    margin-bottom: 15px;
}

.notification-empty h4 {
    margin: 0 0 8px 0;
    color: #aaa;
    font-weight: 500;
}

.notification-empty p {
    margin: 0;
    font-size: 14px;
    color: #777;
}

/* Loading State */
.notification-loading {
    padding: 20px;
    text-align: center;
    color: #888;
}

.notification-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* User Menu */
.user-menu-container {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 20px;
    transition: background-color 0.2s ease;
}

.user-menu-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: #555;
}

.user-menu-trigger i {
    color: #888;
    font-size: 12px;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: none;
    overflow: hidden;
    margin-top: 8px;
}

.user-menu-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #fff;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.user-menu-item:hover {
    background-color: #333;
    color: #fff;
}

.user-menu-item i {
    width: 16px;
    color: #888;
}

.user-menu-divider {
    height: 1px;
    background: #444;
    margin: 4px 0;
}

/* Guest Actions */
.guest-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.header-btn {
    color: #fff;
    border-color: #444;
}

.header-btn:hover {
    background-color: #333;
    color: #fff;
}

.header-btn.primary {
    background-color: var(--CS-aqua);
    color: #000;
    border-color: var(--CS-aqua);
}

.header-btn.primary:hover {
    background-color: #00d4ff;
    color: #000;
}

/* Notification Settings Modal */
.notification-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.notification-settings-content {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #444;
}

.notification-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.notification-settings-header h2 {
    margin: 0;
    color: #fff;
    font-size: 20px;
}

.close-settings {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-settings:hover {
    background-color: #444;
    color: #fff;
}

/* Settings Form */
.notification-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #444;
}

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

.setting-info {
    flex: 1;
}

.setting-label {
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.setting-description {
    font-size: 13px;
    color: #888;
    line-height: 1.4;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #555;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.toggle-switch.active {
    background-color: var(--CS-aqua);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(26px);
}

/* Vote Milestones */
.milestone-settings {
    margin-top: 15px;
}

.milestone-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.milestone-tag {
    background-color: #444;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #fff;
    position: relative;
}

.milestone-tag .remove-milestone {
    margin-left: 6px;
    cursor: pointer;
    color: #ff6b6b;
    font-weight: bold;
}

.add-milestone {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.milestone-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 13px;
    background: #333;
    color: #fff;
}

.milestone-input:focus {
    outline: none;
    border-color: var(--CS-aqua);
}

.add-milestone-btn {
    padding: 6px 12px;
    background-color: var(--CS-aqua);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.add-milestone-btn:hover {
    background-color: #00d4ff;
}

/* Save Settings Button */
.save-settings-btn {
    width: 100%;
    padding: 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 25px;
    transition: background-color 0.2s ease;
}

.save-settings-btn:hover {
    background-color: #218838;
}

.save-settings-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* Adjust main layout for fixed header (index/about pages only) */
body.index-page .modern-layout-container,
body.about-page .modern-layout-container {
    padding-top: 60px; /* Account for fixed header */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .layout-header {
        height: 50px;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .header-center {
        display: none; /* Hide search on mobile */
    }
    
    .notification-dropdown {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        width: 100vw;
        max-width: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-height: 70vh;
    }
    
    .notification-item {
        padding: 12px 15px;
    }
    
    .notification-avatar {
        width: 35px;
        height: 35px;
    }
    
    .notification-message {
        font-size: 13px;
    }
    
    .notification-meta {
        font-size: 11px;
    }
    
    .notification-settings-content {
        width: 95%;
        padding: 20px;
        margin: 20px;
    }
    
    body.index-page .modern-layout-container,
    body.about-page .modern-layout-container {
        padding-top: 50px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .header-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ========================================
   Notifications Center View Styles
   For displaying notifications in the center column of link.php
   ======================================== */

/* Notifications View Header */
.notifications-view-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--wa-color-neutral-100, #1a1a1a);
    border-bottom: 1px solid var(--wa-color-neutral-200, #333);
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.notifications-view-header h3 {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--wa-color-neutral-950, #fff);
}

.notifications-view-header .back-to-feed-btn {
    flex-shrink: 0;
}

.notifications-view-header #markAllReadCenterBtn {
    flex-shrink: 0;
}

/* Notifications Filter Tabs */
.notifications-filters-center {
    background: var(--wa-color-neutral-100, #1a1a1a);
    padding: 12px 16px;
    border-bottom: 1px solid var(--wa-color-neutral-200, #333);
}

/* Segmented Control Style (matching feed-scope-tabs) */
.notification-scope-tabs {
    display: inline-flex;
    background: #252525;
    border-radius: 6px;
    padding: 0;
    gap: 0;
    border: 1px solid #555;
}

.notification-scope-tabs .notif-tab {
    --wa-button-font-size-small: 13px;
    border-radius: 0 !important;
    margin: 0;
    background: transparent;
    border: none;
    color: #ccc;
    transition: all 0.2s ease;
    border-right: 1px solid #555;
}

.notification-scope-tabs .notif-tab:last-child {
    border-right: none;
}

.notification-scope-tabs .notif-tab::part(base) {
    border-radius: 0 !important;
    border: none !important;
    background: transparent;
    padding: 8px 16px;
    margin: 0;
}

.notification-scope-tabs .notif-tab:first-child::part(base) {
    border-radius: 5px 0 0 5px;
}

.notification-scope-tabs .notif-tab:last-child::part(base) {
    border-radius: 0 5px 5px 0;
}

.notification-scope-tabs .notif-tab:hover {
    color: #fff;
}

.notification-scope-tabs .notif-tab:hover::part(base) {
    background: rgba(255, 255, 255, 0.1);
}

.notification-scope-tabs .notif-tab.active {
    color: #000;
}

.notification-scope-tabs .notif-tab.active::part(base) {
    background: #00fff6 !important;
    color: #000;
}

.notification-scope-tabs .notif-tab:first-child.active::part(base) {
    border-radius: 5px 0 0 5px !important;
}

.notification-scope-tabs .notif-tab:last-child.active::part(base) {
    border-radius: 0 5px 5px 0 !important;
}

.notification-scope-tabs .notif-tab.active wa-icon {
    color: #000;
}

/* Notifications List Container */
.notifications-center-list {
    background: var(--wa-color-neutral-50, #121212);
    min-height: 300px;
    border-radius: 0 0 8px 8px;
}

/* Individual Notification Items in Center View */
.notification-item-center {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--wa-color-neutral-200, #333);
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.notification-item-center:hover {
    background-color: var(--wa-color-neutral-100, #1a1a1a);
}

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

.notification-item-center.unread {
    background-color: rgba(0, 188, 212, 0.05);
    border-left: 3px solid var(--CS-aqua, #00bcd4);
}

.notification-item-center.unread:hover {
    background-color: rgba(0, 188, 212, 0.1);
}

/* Notification Type Icon */
.notification-type-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: var(--wa-color-neutral-200, #333);
    color: #fff;
}

.notification-type-icon.mention {
    background-color: #ffc107;
    color: #000;
}

.notification-type-icon.reply {
    background-color: #28a745;
}

.notification-type-icon.vote,
.notification-type-icon.upvote {
    background-color: #ff6b35;
}

.notification-type-icon.downvote {
    background-color: #dc3545;
}

.notification-type-icon.follow {
    background-color: #17a2b8;
}

.notification-type-icon.like {
    background-color: #dc3545;
}

/* Notification Avatar in Center View */
.notification-avatar-center {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Notification Content in Center View */
.notification-content-center {
    flex: 1;
    min-width: 0;
}

.notification-message-center {
    font-size: 15px;
    color: var(--wa-color-neutral-950, #fff);
    line-height: 1.5;
    margin-bottom: 8px;
}

.notification-meta-center {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--wa-color-neutral-500, #888);
}

.notification-type-badge {
    background-color: var(--wa-color-neutral-200, #444);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--wa-color-neutral-700, #ccc);
}

.notification-type-badge.mention {
    background-color: #ffc107;
    color: #000;
}

.notification-type-badge.reply {
    background-color: #28a745;
    color: #fff;
}

.notification-type-badge.vote,
.notification-type-badge.upvote {
    background-color: #ff6b35;
    color: #fff;
}

.notification-type-badge.downvote {
    background-color: #dc3545;
    color: #fff;
}

.notification-type-badge.follow {
    background-color: #17a2b8;
    color: #fff;
}

.notification-type-badge.like {
    background-color: #dc3545;
    color: #fff;
}

.notification-time-center {
    white-space: nowrap;
}

/* Unread Indicator Dot */
.notification-unread-dot {
    width: 10px;
    height: 10px;
    background-color: var(--CS-aqua, #00bcd4);
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
}

/* Empty State for Center View */
.notification-empty-center {
    padding: 60px 20px;
    text-align: center;
    color: var(--wa-color-neutral-500, #888);
}

.notification-empty-center wa-icon {
    font-size: 64px;
    color: var(--wa-color-neutral-300, #555);
    margin-bottom: 20px;
    display: block;
}

.notification-empty-center h4 {
    margin: 0 0 12px 0;
    color: var(--wa-color-neutral-700, #aaa);
    font-weight: 500;
    font-size: 18px;
}

.notification-empty-center p {
    margin: 0;
    font-size: 14px;
    color: var(--wa-color-neutral-500, #777);
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Loading State in Center View */
.notifications-center-list .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--wa-color-neutral-500, #888);
}

/* Feed Sentinel for Infinite Scroll */
.feed-sentinel {
    display: flex;
    justify-content: center;
    align-items: center;
}

.feed-sentinel .sentinel-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: var(--wa-color-neutral-500, #888);
}

/* Responsive Styles for Center View */
@media (max-width: 768px) {
    .notifications-view-header {
        padding: 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .notifications-view-header h3 {
        font-size: 16px;
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }

    .notifications-view-header .back-to-feed-btn,
    .notifications-view-header #markAllReadCenterBtn {
        flex: 1;
    }

    .notification-scope-tabs .notif-tab {
        --wa-button-font-size-small: 12px;
    }

    .notification-scope-tabs .notif-tab::part(base) {
        padding: 6px 10px;
    }

    .notification-item-center {
        padding: 12px;
        gap: 8px;
    }

    .notification-type-icon {
        width: 28px;
        height: 28px;
    }

    .notification-avatar-center {
        width: 40px;
        height: 40px;
    }

    .notification-message-center {
        font-size: 14px;
    }

    .notification-meta-center {
        font-size: 12px;
        gap: 8px;
    }

    .notification-empty-center {
        padding: 40px 16px;
    }

    .notification-empty-center wa-icon {
        font-size: 48px;
    }

    .notification-empty-center h4 {
        font-size: 16px;
    }

    .notification-empty-center p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .notifications-filters-center {
        padding: 8px 8px;
    }

    .notification-scope-tabs {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
    }

    .notification-scope-tabs .notif-tab {
        flex: 1;
        --wa-button-font-size-small: 11px;
    }

    .notification-scope-tabs .notif-tab::part(base) {
        padding: 6px 4px;
        justify-content: center;
    }

    /* Hide icons on small screens to save space */
    .notification-scope-tabs .notif-tab wa-icon {
        display: none;
    }
}

/* ==========================================================================
   Notification Post Preview
   ========================================================================== */

.notification-post-preview {
    margin-top: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid rgba(102, 126, 234, 0.5);
    border-radius: 0 4px 4px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}