/**
 * Notification Panel Styles
 * Styles for the dashboard notification bell panel
 * Designed to expand smoothly from user-info-container
 */

/* Notification Panel Container - Expands from user-info-container */
.notification-panel {
    position: fixed;
    width: 360px; /* Will be overridden by JS to match container */
    max-height: 450px;
    background: rgba(247, 8, 128, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(247, 8, 128, 0.2);
    border-radius: var(--border-radius-xl);
    /* Match user-info-container box-shadow for visual continuity */
    box-shadow: 
        0 0 0 1px rgba(247, 8, 128, 0.1),
        0 2px 10px rgba(247, 8, 128, 0.15),
        0 4px 16px rgba(255, 133, 82, 0.1),
        0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 10000;
    display: none;
    overflow: hidden;
    /* Smooth slide-down expand animation */
    animation: expandFromContainer 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top center;
}

/* Removed arrow - panel expands from container directly */
.notification-panel::before {
    display: none;
}

@keyframes expandFromContainer {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

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

/* Panel Header - Matches gradient theme but with transparency */
.notification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(247, 8, 128, 0.95) 0%, rgba(255, 133, 82, 0.95) 100%);
    backdrop-filter: blur(10px);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-role-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
}

.panel-role-icon i {
    font-size: 22px;
    color: white;
}

.panel-header-text {
    display: flex;
    flex-direction: column;
}

.panel-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.panel-role-label {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
}

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

.live-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    opacity: 0.7;
}

.live-indicator.connected {
    opacity: 1;
    background: rgba(45, 206, 137, 0.3);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

.live-indicator.connected .live-dot {
    background: #2dce89;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.close-panel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-panel-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.close-panel-btn i {
    font-size: 18px;
}

/* Panel Actions Bar */
.notification-panel-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(247, 8, 128, 0.1);
}

.panel-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(247, 8, 128, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.panel-action-btn:hover {
    background: var(--primary-color, #f70880);
    color: white;
    border-color: var(--primary-color, #f70880);
}

.panel-action-btn i {
    font-size: 16px;
}

.panel-action-btn span {
    font-weight: 500;
}

/* Panel Body */
.notification-panel-body {
    max-height: 350px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

/* Scrollbar styling */
.notification-panel-body::-webkit-scrollbar {
    width: 6px;
}

.notification-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.notification-panel-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.notification-panel-body::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Panel Footer - Hidden */
.notification-panel-footer {
    display: none !important;
}

/* Empty State */
.empty-notifications {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: #8898aa;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    margin: 4px;
}

.empty-notifications i {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
    color: var(--primary-color, #f70880);
}

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

/* Notification Item — column stack so expanded message is never beside the badge */
.notification-panel .notification-item,
.notification-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(247, 8, 128, 0.15);
    border-left: 4px solid #11cdef;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-width: 0;
}

.notification-item:last-child {
    margin-bottom: 0;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 16px rgba(247, 8, 128, 0.15);
    transform: translateY(-2px);
    border: 1px solid rgba(247, 8, 128, 0.25);
}

/* Priority Colors */
.notification-item.priority-urgent {
    border-left-color: #f5365c;
    background: linear-gradient(90deg, rgba(245, 54, 92, 0.08), rgba(255, 255, 255, 0.7));
}

.notification-item.priority-high {
    border-left-color: #fb6340;
    background: linear-gradient(90deg, rgba(251, 99, 64, 0.08), rgba(255, 255, 255, 0.7));
}

.notification-item.priority-medium {
    border-left-color: #11cdef;
    background: linear-gradient(90deg, rgba(17, 205, 239, 0.08), rgba(255, 255, 255, 0.7));
}

.notification-item.priority-low {
    border-left-color: #2dce89;
    background: linear-gradient(90deg, rgba(45, 206, 137, 0.08), rgba(255, 255, 255, 0.7));
}

/* Notification Item Header (Expandable) */
.notification-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    width: 100%;
    min-width: 0;
}

.notification-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #e3f2fd;
    color: #11cdef;
}

.notification-icon-wrapper.priority-urgent {
    background: rgba(245, 54, 92, 0.12);
    color: #f5365c;
}

.notification-icon-wrapper.priority-high {
    background: rgba(251, 99, 64, 0.12);
    color: #fb6340;
}

.notification-icon-wrapper.priority-medium {
    background: rgba(17, 205, 239, 0.12);
    color: #11cdef;
}

.notification-icon-wrapper.priority-low {
    background: rgba(45, 206, 137, 0.12);
    color: #2dce89;
}

.notification-icon-wrapper i {
    font-size: 20px;
}

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

.notification-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: #32325d;
    line-height: 1.3;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-expand-icon {
    color: #8898aa;
    transition: transform 0.2s;
}

.notification-item[data-expanded="true"] .notification-expand-icon {
    transform: rotate(180deg);
}

.notification-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.notification-type-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f0f2f5;
    color: #5c6570;
    flex: 0 0 auto;
    display: inline-block;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: 0.02em;
}
.notification-type-badge.notif-type--general { background: #eef1f4; color: #5c6570; }
.notification-type-badge.notif-type--urgent { background: #fde8ec; color: #c62828; }
.notification-type-badge.notif-type--event { background: #e8f1fb; color: #1565c0; }
.notification-type-badge.notif-type--maintenance { background: #fff3e0; color: #c45a20; }
.notification-type-badge.notif-type--wishes { background: #e8f5e9; color: #2e7d32; }
.notification-type-badge.notif-type--update { background: #f3e8ff; color: #6a1b9a; }
.notification-type-badge.notif-type--info { background: #e0f7fa; color: #00838f; }
.notification-type-badge.notif-type--reminder { background: #fff8e1; color: #f9a825; }
.notification-type-badge.notif-type--cancelled { background: #ffebee; color: #b71c1c; }
.notification-type-badge.notif-type--demo { background: #f3e5f5; color: #7b1fa2; }
.notification-type-badge.notif-type--reply { background: #ede7f6; color: #5b45b5; }
.notification-type-badge.notif-type--reschedule { background: #e8eaf6; color: #3949ab; }

.notification-item[data-expanded="true"] .notification-type-badge {
    display: none;
}

.notification-target {
    display: flex;
    align-items: center;
    color: #adb5bd;
}

.notification-target i {
    font-size: 14px;
}

.notification-time {
    font-size: 11px;
    color: #adb5bd;
}

/* Expandable Body — full width under the header, never a side column */
.notification-body-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    margin-top: 0;
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    box-sizing: border-box;
}

.notification-item[data-expanded="true"] .notification-body-expandable {
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.notification-message {
    font-size: 13px;
    color: #525f7f;
    line-height: 1.6;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color, #f70880);
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Old Header - Keep for compatibility */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.notification-priority {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f6f9fc;
    color: #8898aa;
}

.priority-urgent .notification-priority {
    background: #f5365c;
    color: white;
}

.priority-high .notification-priority {
    background: #fb6340;
    color: white;
}

.priority-medium .notification-priority {
    background: #11cdef;
    color: white;
}

.priority-low .notification-priority {
    background: #2dce89;
    color: white;
}

/* Notification Body */
.notification-body {
    font-size: 13px;
    color: #525f7f;
    line-height: 1.5;
    margin-bottom: 8px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notification Footer */
.notification-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.notification-time {
    font-size: 11px;
    color: #8898aa;
}

.mark-read-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, var(--primary-color, #f70880), var(--accent-color, #ff8552));
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mark-read-btn i {
    font-size: 16px;
}

.mark-read-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(247, 8, 128, 0.3);
}

/* Notification Badge on Bell Icon */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #f5365c, #f70880);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 6px rgba(245, 54, 92, 0.4);
    z-index: 100;
}

/* Badge highlight animation when new notification arrives */
.notification-badge.badge-highlight {
    animation: badgePulse 0.4s ease-in-out 5 !important;
    box-shadow: 0 0 15px 5px rgba(245, 54, 92, 0.8) !important;
    transform-origin: center;
}

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

/* Bell button highlight animation */
.user-action-btn.notification-highlight {
    animation: bellShake 0.4s ease-in-out 5 !important;
}

.user-action-btn.notification-highlight i {
    color: var(--primary-color, #f70880) !important;
    animation: bellGlow 0.4s ease-in-out 5;
}

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

@keyframes bellGlow {
    0%, 100% { text-shadow: none; }
    50% { text-shadow: 0 0 10px var(--primary-color, #f70880); }
}

/* New notification item highlight */
.notification-item.new-notification {
    animation: newNotificationFlash 0.5s ease-in-out 3;
    background: linear-gradient(135deg, rgba(247, 8, 128, 0.15), rgba(255, 133, 82, 0.1)) !important;
    border-left: 3px solid var(--primary-color, #f70880) !important;
}

@keyframes newNotificationFlash {
    0%, 100% { 
        background: linear-gradient(135deg, rgba(247, 8, 128, 0.15), rgba(255, 133, 82, 0.1));
    }
    50% { 
        background: linear-gradient(135deg, rgba(247, 8, 128, 0.3), rgba(255, 133, 82, 0.2));
    }
}

/* User Action Button */
.user-action-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    overflow: visible;
    opacity: 1;
}

.user-action-btn:hover {
    background: rgba(247, 8, 128, 0.08);
}

.user-action-btn i {
    color: var(--primary-color, #f70880);
    font-size: 22px;
    opacity: 1;
    position: relative;
    z-index: 1;
}

/* Prevent MDC ripple layer from washing out the bell icon */
.user-action-btn.mdc-icon-button::before,
.user-action-btn.mdc-icon-button::after,
.user-action-btn .mdc-icon-button__ripple,
.user-action-btn .mdc-icon-button__ripple::before,
.user-action-btn .mdc-icon-button__ripple::after {
    display: none !important;
    opacity: 0 !important;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .notification-panel {
        position: fixed;
        width: calc(100% - 32px);
        right: 16px;
        left: 16px;
        top: 70px;
        max-height: 70vh;
    }
    
    .notification-panel::before {
        display: none;
    }
}

/* Real-time notification indicator */
.notification-panel-header .live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    margin-left: 8px;
}

.notification-panel-header .live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* New notification flash animation */
.notification-item.new-notification {
    animation: flashNew 0.5s ease-out;
}

@keyframes flashNew {
    0% { background: rgba(247, 8, 128, 0.3); }
    100% { background: rgba(255, 255, 255, 0.7); }
}

/* WebSocket connection status indicator */
.ws-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #8898aa;
    padding: 5px 12px;
    background: #f6f9fc;
    border-radius: 20px;
}

.ws-status-indicator .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #8898aa;
}

.ws-status-indicator.connected {
    color: #2dce89;
    background: rgba(45, 206, 137, 0.1);
}

.ws-status-indicator.connected .status-dot {
    background: #2dce89;
    animation: pulse 2s infinite;
}

.ws-status-indicator.disconnected {
    color: #f5365c;
    background: rgba(245, 54, 92, 0.1);
}

.ws-status-indicator.disconnected .status-dot {
    background: #f5365c;
}

/* Hide live indicator and status text in notification panel */
.notification-panel .live-indicator {
    display: none !important;
}

.notification-panel .status-text {
    display: none !important;
}
