/**
 * WebSocket Floating Notifications CSS
 * Minimal floating window system for websocket status updates
 * Replaces large toastr notifications with compact, unobtrusive windows
 */

/* ==========================================================================
   Floating Notification Container
   ========================================================================== */

.ws-notification-container {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 280px;
    z-index: 9998;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ws-notification-container > * {
    pointer-events: all;
}

/* ==========================================================================
   Individual Floating Notification Windows
   ========================================================================== */

.ws-float-notify {
    position: relative;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border-left: 4px solid #3B82F6;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    max-height: 80px;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ws-float-notify:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-2px);
}

/* ==========================================================================
   Priority-Based Styling
   ========================================================================== */

.ws-float-notify.critical {
    background: #FEF2F2;
    border-left-color: #EF4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.ws-float-notify.high {
    background: #FFF7ED;
    border-left-color: #F59E0B;
    border-color: rgba(245, 158, 11, 0.2);
}

.ws-float-notify.medium {
    background: #EFF6FF;
    border-left-color: #3B82F6;
    border-color: rgba(59, 130, 246, 0.2);
}

.ws-float-notify.low {
    background: #F9FAFB;
    border-left-color: #6B7280;
    border-color: rgba(107, 114, 128, 0.2);
}

.ws-float-notify.success {
    background: #F0FDF4;
    border-left-color: #10B981;
    border-color: rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   Notification Content Layout
   ========================================================================== */

.ws-notify-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.ws-notify-title {
    font-weight: 600;
    font-size: 13px;
    color: #111827;
    flex: 1;
    line-height: 1.3;
}

.ws-notify-close {
    cursor: pointer;
    color: #9CA3AF;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    margin-left: 8px;
    border-radius: 2px;
    transition: color 0.2s ease;
}

.ws-notify-close:hover {
    color: #374151;
    background-color: rgba(0, 0, 0, 0.05);
}

.ws-notify-message {
    font-size: 12px;
    color: #6B7280;
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ==========================================================================
   Progress Bar for Auto-Dismiss
   ========================================================================== */

.ws-notify-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: currentColor;
    opacity: 0.3;
    border-radius: 0 0 6px 6px;
    transition: width linear;
}

.ws-float-notify.critical .ws-notify-progress {
    background-color: #EF4444;
}

.ws-float-notify.high .ws-notify-progress {
    background-color: #F59E0B;
}

.ws-float-notify.medium .ws-notify-progress {
    background-color: #3B82F6;
}

.ws-float-notify.low .ws-notify-progress {
    background-color: #6B7280;
}

.ws-float-notify.success .ws-notify-progress {
    background-color: #10B981;
}

/* ==========================================================================
   WebSocket Status Indicator (Bottom-Right Dot)
   ========================================================================== */

.ws-status-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.ws-status-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ws-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: pulse-dot 2s infinite;
    transition: all 0.3s ease;
}

.ws-status-dot.connected {
    background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.ws-status-dot.reconnecting {
    background: #F59E0B;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
    animation: pulse-dot 1s infinite;
}

.ws-status-dot.disconnected {
    background: #6B7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2);
    animation: none;
}

.ws-status-dot.error {
    background: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
    animation: shake-dot 0.5s ease-in-out;
}

/* ==========================================================================
   Notification Count Badge
   ========================================================================== */

.ws-notify-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Hide count when zero */
.ws-notify-count[data-count="0"] {
    display: none;
}

/* ==========================================================================
   Compact Mode for Multiple Notifications
   ========================================================================== */

.ws-float-notify.compact {
    max-height: 60px;
    padding: 8px 10px;
}

.ws-float-notify.compact .ws-notify-title {
    font-size: 12px;
}

.ws-float-notify.compact .ws-notify-message {
    font-size: 11px;
    max-height: 28px;
    -webkit-line-clamp: 1;
}

/* ==========================================================================
   Status Tooltip
   ========================================================================== */

.ws-status-tooltip {
    position: absolute;
    bottom: 50px;
    right: 0;
    background: #374151;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 10000;
}

.ws-status-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 12px;
    border: 5px solid transparent;
    border-top-color: #374151;
}

.ws-status-indicator:hover .ws-status-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
        max-height: 80px;
        margin-bottom: 10px;
        padding: 10px 12px;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding: 0 12px;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        max-height: 80px;
        margin-bottom: 10px;
        padding: 10px 12px;
    }
    to {
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding: 0 12px;
    }
}

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

@keyframes shake-dot {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

@keyframes bounce-in {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==========================================================================
   Icon Styles for Different Notification Types
   ========================================================================== */

.ws-notify-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: top;
    margin-top: -1px;
}

.ws-notify-icon.alert {
    color: #EF4444;
}

.ws-notify-icon.warning {
    color: #F59E0B;
}

.ws-notify-icon.info {
    color: #3B82F6;
}

.ws-notify-icon.success {
    color: #10B981;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .ws-notification-container {
        right: 10px;
        top: 60px;
        width: 260px;
    }

    .ws-float-notify {
        font-size: 11px;
        padding: 8px 10px;
        max-height: 70px;
    }

    .ws-notify-title {
        font-size: 12px;
    }

    .ws-notify-message {
        font-size: 11px;
    }

    .ws-status-indicator {
        bottom: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
    }

    .ws-status-dot {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .ws-notification-container {
        right: 5px;
        top: 55px;
        width: 240px;
    }

    .ws-float-notify {
        margin-bottom: 8px;
        max-height: 60px;
    }

    .ws-status-indicator {
        bottom: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }

    .ws-status-dot {
        width: 8px;
        height: 8px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.ws-float-notify:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

.ws-status-indicator:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ws-float-notify {
        border-width: 2px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .ws-status-indicator {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ws-float-notify {
        animation: none;
        transition: none;
    }

    .ws-status-dot {
        animation: none;
    }

    .ws-status-indicator {
        transition: none;
    }

    .ws-status-indicator:hover {
        transform: none;
    }
}