/* =====================================================================
   COMPREHENSIVE NOTIFICATION BADGE STYLES
   Beautiful, modern, and highly functional notification badges
   ===================================================================== */

/* ===== CSS VARIABLES ===== */
:root {
    --badge-primary: linear-gradient(135deg, #dc3545 0%, #e74c3c 50%, #c0392b 100%);
    --badge-success: linear-gradient(135deg, #28a745 0%, #20c997 50%, #17a2b8 100%);
    --badge-warning: linear-gradient(135deg, #ffc107 0%, #ffb300 50%, #ff8f00 100%);
    --badge-info: linear-gradient(135deg, #007bff 0%, #0056b3 50%, #004085 100%);
    --badge-purple: linear-gradient(135deg, #6f42c1 0%, #7b1fa2 50%, #4a148c 100%);
    --badge-dark: linear-gradient(135deg, #343a40 0%, #495057 50%, #212529 100%);
    
    --badge-shadow-primary: rgba(220, 53, 69, 0.4);
    --badge-shadow-success: rgba(40, 167, 69, 0.4);
    --badge-shadow-warning: rgba(255, 193, 7, 0.4);
    --badge-shadow-info: rgba(0, 123, 255, 0.4);
    --badge-shadow-purple: rgba(111, 66, 193, 0.4);
    --badge-shadow-dark: rgba(52, 58, 64, 0.4);
    
    --badge-border: rgba(255, 255, 255, 0.9);
    --badge-text: #ffffff;
    --badge-size: 20px;
    --badge-font-size: 0.65rem;
    --badge-animation-duration: 0.3s;
    --badge-animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== BASE NOTIFICATION BADGE STYLES ===== */
.notification-badge {
    background: var(--badge-primary);
    color: var(--badge-text);
    border-radius: 50%;
    padding: 3px 7px;
    font-size: var(--badge-font-size);
    font-weight: 700;
    margin-left: 8px;
    min-width: var(--badge-size);
    height: var(--badge-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px var(--badge-shadow-primary);
    border: 2px solid var(--badge-border);
    transition: all var(--badge-animation-duration) var(--badge-animation-easing);
    position: relative;
    z-index: 10;
    animation: badgeAppear 0.5s ease-out;
    user-select: none;
    cursor: default;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== BADGE STATES & INTERACTIONS ===== */

/* Hover Effect */
.notification-badge:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 15px var(--badge-shadow-primary);
    background: linear-gradient(135deg, #e74c3c 0%, #dc3545 50%, #b71c1c 100%);
}

/* Active/Pressed State */
.notification-badge:active {
    transform: scale(0.95);
    transition-duration: 0.1s;
}

/* Focus State for Accessibility */
.notification-badge:focus-visible {
    outline: 2px solid var(--badge-border);
    outline-offset: 2px;
}

/* ===== BADGE VARIATIONS ===== */

/* Success/Approved Notifications */
.notification-badge.approved,
.notification-badge.success {
    background: var(--badge-success);
    box-shadow: 0 2px 8px var(--badge-shadow-success);
}

.notification-badge.approved:hover,
.notification-badge.success:hover {
    box-shadow: 0 4px 15px var(--badge-shadow-success);
    background: linear-gradient(135deg, #20c997 0%, #28a745 50%, #155724 100%);
}

/* Warning/Pending Notifications */
.notification-badge.pending,
.notification-badge.warning {
    background: var(--badge-warning);
    box-shadow: 0 2px 8px var(--badge-shadow-warning);
    color: #212529; /* Dark text for better contrast on yellow */
}

.notification-badge.pending:hover,
.notification-badge.warning:hover {
    box-shadow: 0 4px 15px var(--badge-shadow-warning);
    background: linear-gradient(135deg, #ffb300 0%, #ffc107 50%, #e0a800 100%);
}

/* Info/Total Notifications */
.notification-badge.total,
.notification-badge.info {
    background: var(--badge-info);
    box-shadow: 0 2px 8px var(--badge-shadow-info);
}

.notification-badge.total:hover,
.notification-badge.info:hover {
    box-shadow: 0 4px 15px var(--badge-shadow-info);
    background: linear-gradient(135deg, #0056b3 0%, #007bff 50%, #004085 100%);
}

/* Released/Purple Notifications */
.notification-badge.released,
.notification-badge.purple {
    background: var(--badge-purple);
    box-shadow: 0 2px 8px var(--badge-shadow-purple);
}

.notification-badge.released:hover,
.notification-badge.purple:hover {
    box-shadow: 0 4px 15px var(--badge-shadow-purple);
    background: linear-gradient(135deg, #7b1fa2 0%, #6f42c1 50%, #4a148c 100%);
}

/* Dark/Neutral Notifications */
.notification-badge.dark,
.notification-badge.neutral {
    background: var(--badge-dark);
    box-shadow: 0 2px 8px var(--badge-shadow-dark);
}

.notification-badge.dark:hover,
.notification-badge.neutral:hover {
    box-shadow: 0 4px 15px var(--badge-shadow-dark);
    background: linear-gradient(135deg, #495057 0%, #343a40 50%, #212529 100%);
}

/* ===== BADGE SIZES ===== */

/* Small Badge */
.notification-badge.badge-sm {
    min-width: 16px;
    height: 16px;
    font-size: 0.55rem;
    padding: 2px 5px;
}

/* Large Badge */
.notification-badge.badge-lg {
    min-width: 24px;
    height: 24px;
    font-size: 0.75rem;
    padding: 4px 8px;
}

/* Extra Large Badge */
.notification-badge.badge-xl {
    min-width: 28px;
    height: 28px;
    font-size: 0.85rem;
    padding: 5px 10px;
}

/* ===== BADGE ANIMATIONS ===== */

/* Appear Animation */
@keyframes badgeAppear {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(180deg);
    }
    50% {
        transform: scale(1.2) rotate(90deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Pulse Animation for New Notifications */
.notification-badge.pulse {
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px var(--badge-shadow-primary);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 15px var(--badge-shadow-primary);
    }
}

/* Glow Animation for High Priority */
.notification-badge.glow,
.notification-badge.high-priority {
    animation: badgeGlow 1.5s ease-in-out infinite alternate;
}

@keyframes badgeGlow {
    from {
        box-shadow: 0 2px 12px var(--badge-shadow-primary);
    }
    to {
        box-shadow: 0 4px 20px var(--badge-shadow-primary);
    }
}

/* Shake Animation for Urgent Notifications */
.notification-badge.shake,
.notification-badge.urgent {
    animation: badgeShake 0.5s ease-in-out;
}

@keyframes badgeShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Update Animation */
.notification-badge.updating {
    animation: badgeUpdate 0.6s ease-in-out;
}

@keyframes badgeUpdate {
    0% { transform: scale(1); }
    25% { transform: scale(1.3) rotateY(90deg); }
    75% { transform: scale(1.3) rotateY(-90deg); }
    100% { transform: scale(1) rotateY(0deg); }
}

/* Disappear Animation */
.notification-badge.hiding {
    animation: badgeDisappear 0.4s ease-in forwards;
}

@keyframes badgeDisappear {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
        display: none;
    }
}

/* ===== SIDEBAR-SPECIFIC STYLES ===== */

/* Sidebar Badge Positioning */
.sidebar a {
    position: relative;
}

.sidebar .notification-badge {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    z-index: 15;
    border: 2px solid var(--badge-border);
    margin-left: 0; /* Override default margin for sidebar */
}

/* Sidebar Collapsed State - Enhanced for better visibility */
.sidebar.collapsed .notification-badge {
    position: absolute !important;
    right: 5px !important;
    top: 50% !important;
    transform: translateY(-50%) scale(0.85) !important;
    min-width: 16px !important;
    height: 16px !important;
    font-size: 0.55rem !important;
    padding: 2px 4px !important;
    z-index: 9999 !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-left: 0 !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
}

/* Ensure sidebar text is hidden but badges remain visible */
.sidebar.collapsed a span:not(.notification-badge) {
    display: none !important;
}

/* Force notification badges to stay visible in collapsed state */
.sidebar.collapsed a .notification-badge {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
}

/* Enhanced positioning for collapsed sidebar links */
.sidebar.collapsed a {
    position: relative !important;
    justify-content: center !important;
}

/* Enhanced Sidebar Link Hover Effects */
.sidebar a:hover .notification-badge {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 3px 12px var(--badge-shadow-primary);
}

/* ===== UTILITY CLASSES ===== */

/* Hide Empty Badges */
.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none !important;
}

/* Show Badge */
.notification-badge.show {
    display: inline-flex !important;
}

/* Clickable Badge */
.notification-badge.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-badge.clickable:hover {
    transform: scale(1.2);
}

/* Badge with Dot (for minimal display) */
.notification-badge.dot {
    min-width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet and Mobile Adjustments */
@media (max-width: 768px) {
    .notification-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.6rem;
        padding: 2px 5px;
    }
    
    .sidebar .notification-badge {
        right: 10px;
    }
    
    .sidebar.collapsed .notification-badge {
        right: 3px;
    }
    
    /* Smaller badges for mobile */
    .notification-badge.badge-lg {
        min-width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .notification-badge {
        min-width: 16px;
        height: 16px;
        font-size: 0.55rem;
        padding: 1px 4px;
    }
    
    .notification-badge.badge-lg {
        min-width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
}

/* ===== ACCESSIBILITY & USER PREFERENCES ===== */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .notification-badge {
        border-width: 3px;
        border-color: white;
        font-weight: 900;
        box-shadow: none;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .notification-badge,
    .notification-badge:hover,
    .notification-badge.pulse,
    .notification-badge.glow,
    .notification-badge.shake {
        animation: none;
        transition: none;
    }
    
    .notification-badge:hover {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --badge-border: rgba(255, 255, 255, 0.8);
        --badge-text: #ffffff;
    }
    
    .notification-badge.pending,
    .notification-badge.warning {
        color: #000000; /* Keep dark text on yellow in dark mode */
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .notification-badge {
        background: #333 !important;
        color: white !important;
        box-shadow: none !important;
        border: 1px solid #333 !important;
    }
}

/* ===== BADGE POSITIONING HELPERS ===== */

/* Top Right Positioning */
.badge-top-right {
    position: absolute;
    top: -8px;
    right: -8px;
    transform: none;
}

/* Top Left Positioning */
.badge-top-left {
    position: absolute;
    top: -8px;
    left: -8px;
    transform: none;
}

/* Bottom Right Positioning */
.badge-bottom-right {
    position: absolute;
    bottom: -8px;
    right: -8px;
    transform: none;
}

/* Bottom Left Positioning */
.badge-bottom-left {
    position: absolute;
    bottom: -8px;
    left: -8px;
    transform: none;
}

/* ===== SPECIAL EFFECTS ===== */

/* Badge with gradient border */
.notification-badge.gradient-border {
    border: 2px solid;
    border-image: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4) 1;
    border-radius: 50%;
}

/* Badge with shadow trail effect */
.notification-badge.shadow-trail {
    box-shadow: 
        0 2px 8px var(--badge-shadow-primary),
        0 4px 16px rgba(220, 53, 69, 0.2),
        0 8px 32px rgba(220, 53, 69, 0.1);
}

/* Badge with inner glow */
.notification-badge.inner-glow {
    box-shadow: 
        inset 0 1px 3px rgba(255, 255, 255, 0.3),
        0 2px 8px var(--badge-shadow-primary);
}
