﻿/* =============================================================================
   MATLA Real-Time Notifications CSS
   Animations for dashboard tiles, toasts, and notifications
   ============================================================================= */

/* =============================================================================
   TILE FLASH ANIMATIONS
   ============================================================================= */

.tile-flash-success {
    animation: flashSuccess 1s ease-in-out;
}

.tile-flash-warning {
    animation: flashWarning 1s ease-in-out;
}

.tile-flash-danger {
    animation: flashDanger 1s ease-in-out;
}

@keyframes flashSuccess {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }

    25% {
        box-shadow: 0 0 20px 10px rgba(76, 175, 80, 0.4);
    }

    50% {
        box-shadow: 0 0 30px 15px rgba(76, 175, 80, 0.2);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

@keyframes flashWarning {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0);
    }

    25% {
        box-shadow: 0 0 20px 10px rgba(255, 152, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 30px 15px rgba(255, 152, 0, 0.2);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0);
    }
}

@keyframes flashDanger {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }

    25% {
        box-shadow: 0 0 20px 10px rgba(244, 67, 54, 0.4);
    }

    50% {
        box-shadow: 0 0 30px 15px rgba(244, 67, 54, 0.2);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

/* Value updating animation */
.value-updating {
    animation: valueUpdate 0.5s ease-in-out;
}

@keyframes valueUpdate {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        color: #2196F3;
    }

    100% {
        transform: scale(1);
    }
}

/* =============================================================================
   NOTIFICATION BELL ANIMATION
   ============================================================================= */

.new-notification {
    animation: bellShake 0.5s ease-in-out 3;
}

@keyframes bellShake {
    0% {
        transform: rotate(0);
    }

    25% {
        transform: rotate(15deg);
    }

    50% {
        transform: rotate(-15deg);
    }

    75% {
        transform: rotate(10deg);
    }

    100% {
        transform: rotate(0);
    }
}

/* Notification badge pulse */
.notification-badge {
    position: relative;
}

    .notification-badge::after {
        content: '';
        position: absolute;
        top: -2px;
        right: -2px;
        width: 8px;
        height: 8px;
        background: #f44336;
        border-radius: 50%;
        animation: pulse 2s infinite;
    }

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* =============================================================================
   TOAST ANIMATIONS
   ============================================================================= */

.toast {
    animation: slideInRight 0.3s ease-out;
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Toast container positioning */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* =============================================================================
   ACTIVITY FEED
   ============================================================================= */

.activity-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

    .activity-item:hover {
        background-color: rgba(0, 0, 0, 0.02);
    }

    .activity-item.fade-in {
        animation: fadeInSlide 0.5s ease-out;
    }

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   CELEBRATION OVERLAY
   ============================================================================= */

.celebration-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    z-index: 10000;
    animation: celebrationPop 3s ease-out forwards;
    pointer-events: none;
}

@keyframes celebrationPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }

    30% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* =============================================================================
   BADGE & ACHIEVEMENT MODALS
   ============================================================================= */

.badge-icon-large,
.level-icon {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* Achievement modal gold shimmer */
.badge-icon-large i {
    animation: goldShimmer 2s infinite;
}

@keyframes goldShimmer {
    0% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }

    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
    }

    100% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
}

/* =============================================================================
   DASHBOARD CARD ENHANCEMENTS
   ============================================================================= */

.card[data-tile-type] {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    .card[data-tile-type]:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }

    /* Tooltip styling for tiles */
    .card[data-tile-type][data-bs-toggle="tooltip"] {
        cursor: help;
    }

    /* Focus state for accessibility */
    .card[data-tile-type]:focus {
        outline: 2px solid #2196F3;
        outline-offset: 2px;
    }

/* =============================================================================
   CONNECTION STATUS INDICATOR
   ============================================================================= */

#connectionStatus {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

    #connectionStatus.bg-success {
        animation: none;
    }

    #connectionStatus.bg-warning {
        animation: pulse 1.5s infinite;
    }

    #connectionStatus.bg-danger {
        animation: blink 1s infinite;
    }

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* =============================================================================
   LEADERBOARD ANIMATIONS
   ============================================================================= */

.leaderboard-item {
    transition: all 0.3s ease;
}

    .leaderboard-item.rank-change {
        animation: rankChange 0.5s ease-out;
    }

@keyframes rankChange {
    0% {
        background-color: rgba(76, 175, 80, 0.3);
    }

    100% {
        background-color: transparent;
    }
}

/* =============================================================================
   PROGRESS BAR ANIMATIONS
   ============================================================================= */

.progress-bar {
    transition: width 0.6s ease-in-out;
}

    .progress-bar.milestone-reached {
        animation: progressPulse 1s ease-in-out;
    }

@keyframes progressPulse {
    0% {
        box-shadow: 0 0 0 0 currentColor;
    }

    50% {
        box-shadow: 0 0 10px 5px currentColor;
    }

    100% {
        box-shadow: 0 0 0 0 currentColor;
    }
}

/* =============================================================================
   SOUND TOGGLE
   ============================================================================= */

.sound-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .sound-toggle-container label {
        margin: 0;
        font-size: 0.875rem;
        color: #666;
    }

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

@media (max-width: 768px) {
    .toast-container {
        bottom: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
    }

    .toast {
        width: 100%;
    }

    .celebration-overlay {
        font-size: 60px;
    }
}

/* =============================================================================
   REDUCED MOTION SUPPORT
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =============================================================================
   DARK MODE SUPPORT (if applicable)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    .activity-item:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .activity-item {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
}
