/* Custom styles for Lightning Habit Tracker - Black & Red Theme */

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.3s ease-in-out;
}

/* Background particles animation */
#particles {
    background:
        radial-gradient(circle at 20% 50%, rgba(220, 38, 38, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(220, 38, 38, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(220, 38, 38, 0.1) 0%, transparent 50%);
    animation: particlesFloat 8s ease-in-out infinite;
}

@keyframes particlesFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.6;
    }
}

/* Grid cell hover effects with red theme */
.grid-cell {
    cursor: pointer;
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.grid-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.6);
}

/* Enhanced completed cell animation */
.grid-cell.completed {
    animation: completeAnimation 0.6s ease-out;
}

@keyframes completeAnimation {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.3) rotate(-5deg);
    }
    50% {
        transform: scale(1.4) rotate(5deg);
    }
    75% {
        transform: scale(1.2) rotate(-2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Enhanced counter animation */
.counter-update {
    animation: counterPulse 0.8s ease-out;
}

@keyframes counterPulse {
    0% {
        transform: scale(1);
        color: #ffffff;
        text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    }
    50% {
        transform: scale(1.2);
        color: #fca5a5;
        text-shadow: 0 0 20px rgba(220, 38, 38, 0.8);
    }
    100% {
        transform: scale(1);
        color: #ffffff;
        text-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
    }
}

/* Red glow effect for habit name */
.glow-red {
    text-shadow: 0 0 10px rgba(220, 38, 38, 0.8);
}

/* Habit name editing styles with red theme */
#habitName:hover {
    background: linear-gradient(45deg, rgba(220, 38, 38, 0.3), rgba(239, 68, 68, 0.2));
    border-radius: 8px;
    padding: 4px 8px;
    text-shadow: 0 0 15px rgba(220, 38, 38, 0.7);
}

/* Confetti animation */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #dc2626;
    animation: confettiFall 3s linear forwards;
}

.confetti:nth-child(odd) {
    background: #ef4444;
}

.confetti:nth-child(3n) {
    background: #f87171;
}

.confetti:nth-child(4n) {
    background: #fca5a5;
    border-radius: 50%;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotateZ(720deg);
        opacity: 0;
    }
}

/* Pulse animation for borders */
.pulse-red {
    animation: pulseRed 2s ease-in-out infinite;
}

@keyframes pulseRed {
    0%, 100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 38, 38, 0.8), 0 0 30px rgba(220, 38, 38, 0.4);
    }
}

/* Loading animation for database initialization */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Custom scrollbar for mobile */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.5);
    border-radius: 2px;
}

/* Focus styles */
input:focus {
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3);
}

/* Mobile responsiveness adjustments */
@media (max-width: 480px) {
    .grid-cols-6 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}