/**
 * Swarakarsa WebSocket Frontend Styles
 * 
 * Minimal styling for WebSocket notifications and status indicators
 * 
 * @package SwarakarsaWebSocket
 */

/* ===========================================
   NOTIFICATION CONTAINER
   =========================================== */

.swarakarsa-websocket-notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
    pointer-events: none;
}

/* ===========================================
   NOTIFICATION ITEMS
   =========================================== */

.websocket-notification {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
    pointer-events: auto;
    overflow: hidden;
}

.websocket-notification.notification-show {
    opacity: 1;
    transform: translateX(0);
}

/* ===========================================
   NOTIFICATION CONTENT
   =========================================== */

.notification-content {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

.notification-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-text {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: #1a202c;
    margin-bottom: 4px;
    line-height: 1.3;
}

.notification-message {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
    word-wrap: break-word;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #a0aec0;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s ease;
}

.notification-close:hover {
    color: #718096;
}

.notification-action {
    margin-top: 8px;
    padding: 6px 12px;
    background: #3182ce;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-action:hover {
    background: #2c5aa0;
}

/* ===========================================
   NOTIFICATION TYPES
   =========================================== */

.websocket-notification.swara_consumed {
    border-left: 4px solid #ed8936;
}

.websocket-notification.swara_purchased {
    border-left: 4px solid #38a169;
}

.websocket-notification.swara_purchased .notification-content {
    background: linear-gradient(90deg, rgba(56, 161, 105, 0.05) 0%, transparent 100%);
}

.websocket-notification.swara_bonus {
    border-left: 4px solid #d69e2e;
    background: linear-gradient(135deg, rgba(214, 158, 46, 0.05) 0%, transparent 100%);
}

.websocket-notification.bonus-notification .notification-content {
    background: linear-gradient(135deg, #fef5e7 0%, #fff 100%);
}

.websocket-notification.low_balance_warning {
    border-left: 4px solid #e53e3e;
    background: #fef5f5;
}

.websocket-notification.warning-notification .notification-title {
    color: #c53030;
}

.websocket-notification.admin_broadcast {
    border-left: 4px solid #3182ce;
    background: linear-gradient(135deg, #ebf8ff 0%, #fff 100%);
}

.websocket-notification.admin-broadcast .notification-title {
    color: #2c5aa0;
}

.websocket-notification.maintenance-notification {
    border-left: 4px solid #718096;
    background: #f7fafc;
}

/* ===========================================
   CONNECTION STATUS INDICATORS
   =========================================== */

.websocket-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.websocket-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.websocket-status.ws-connected {
    color: #38a169;
    background: rgba(56, 161, 105, 0.1);
}

.websocket-status.ws-connected::before {
    background: #38a169;
    animation: pulse 2s infinite;
}

.websocket-status.ws-disconnected {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
}

.websocket-status.ws-disconnected::before {
    background: #e53e3e;
}

.websocket-status.ws-connecting,
.websocket-status.ws-reconnecting {
    color: #d69e2e;
    background: rgba(214, 158, 46, 0.1);
}

.websocket-status.ws-connecting::before,
.websocket-status.ws-reconnecting::before {
    background: #d69e2e;
    animation: blink 1s infinite;
}

/* ===========================================
   BALANCE DISPLAY UPDATES
   =========================================== */

.swara-balance-display,
.user-balance,
[data-swara-balance] {
    transition: all 0.3s ease;
}

.swara-balance-display.balance-updated,
.user-balance.balance-updated,
[data-swara-balance].balance-updated {
    transform: scale(1.05);
    color: #38a169;
    font-weight: 600;
}

/* ===========================================
   ANIMATIONS
   =========================================== */

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 161, 105, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(56, 161, 105, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 161, 105, 0);
    }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

@media (max-width: 768px) {
    .swarakarsa-websocket-notifications {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .websocket-notification {
        margin-bottom: 8px;
    }
    
    .notification-content {
        padding: 14px;
    }
    
    .notification-title {
        font-size: 13px;
    }
    
    .notification-message {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .notification-content {
        padding: 12px;
        gap: 10px;
    }
    
    .notification-icon {
        font-size: 18px;
    }
    
    .notification-action {
        width: 100%;
        margin-top: 10px;
    }
}

/* ===========================================
   HIGH CONTRAST MODE SUPPORT
   =========================================== */

@media (prefers-contrast: high) {
    .websocket-notification {
        border-width: 2px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .notification-title {
        font-weight: 700;
    }
    
    .websocket-status {
        border: 1px solid currentColor;
    }
}

/* ===========================================
   REDUCED MOTION SUPPORT
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .websocket-notification,
    .swara-balance-display,
    .user-balance,
    [data-swara-balance],
    .notification-action,
    .notification-close {
        transition: none;
    }
    
    .websocket-status.ws-connected::before,
    .websocket-status.ws-connecting::before,
    .websocket-status.ws-reconnecting::before {
        animation: none;
    }
}

/* ===========================================
   DARK MODE SUPPORT
   =========================================== */

@media (prefers-color-scheme: dark) {
    .websocket-notification {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .notification-title {
        color: #f7fafc;
    }
    
    .notification-message {
        color: #cbd5e0;
    }
    
    .notification-close {
        color: #718096;
    }
    
    .notification-close:hover {
        color: #a0aec0;
    }
    
    .websocket-notification.swara_purchased {
        background: #1a2e1a;
    }
    
    .websocket-notification.swara_bonus {
        background: #2d2016;
    }
    
    .websocket-notification.low_balance_warning {
        background: #2d1b1b;
    }
    
    .websocket-notification.admin_broadcast {
        background: #1a2332;
    }
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */

.websocket-hidden {
    display: none !important;
}

.websocket-loading {
    opacity: 0.6;
    pointer-events: none;
}

.websocket-pulse {
    animation: pulse 2s infinite;
}

.websocket-blink {
    animation: blink 1s infinite;
}

/* ===========================================
   INTEGRATION WITH EXISTING THEMES
   =========================================== */

/* Override for themes with existing notification systems */
.swarakarsa-websocket-notifications .websocket-notification {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-sizing: border-box;
}

/* Ensure notifications appear above theme elements */
.swarakarsa-websocket-notifications {
    z-index: 999999;
}

/* Fix for themes with aggressive CSS resets */
.websocket-notification * {
    box-sizing: border-box;
}

.websocket-notification button {
    font-family: inherit;
}