/* Lightning Habit Tracker Custom Styles */

/* Custom animations for enhanced user experience */
@keyframes bounceIn {
    0% { 
        transform: scale(0.3); 
        opacity: 0; 
    }
    50% { 
        transform: scale(1.05); 
    }
    70% { 
        transform: scale(0.9); 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

@keyframes pulseSpring {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.05);
    }
}

@keyframes confetti {
    0% { 
        transform: translate(0, 0) rotateZ(0deg) scale(1); 
        opacity: 1; 
    }
    100% { 
        transform: translate(var(--translate-x), var(--translate-y)) rotateZ(720deg) scale(0); 
        opacity: 0; 
    }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Animation utility classes */
.animate-bounce-in {
    animation: bounceIn 0.3s ease-out;
}

.animate-pulse-spring {
    animation: pulseSpring 0.5s ease-in-out;
}

.confetti-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: confetti 1s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Enhanced grid cell hover effects */
.grid-cell {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.grid-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.grid-cell.completed {
    background: linear-gradient(135deg, #fb7185, #ec4899);
    color: white;
    box-shadow: 0 2px 8px rgba(251, 113, 133, 0.3);
}

.grid-cell.completed::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    opacity: 0.7;
}

.grid-cell.today {
    ring: 2px solid #3b82f6;
    ring-offset: 1px;
}

.grid-cell.future {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Counter enhancements */
.counter-container {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.counter-number {
    background: linear-gradient(135deg, #fb7185, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(251, 113, 133, 0.1);
}

/* Modal enhancements */
.habit-modal {
    backdrop-filter: blur(4px);
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Input field enhancements */
.habit-input {
    transition: all 0.2s ease;
    border: 2px solid #e2e8f0;
}

.habit-input:focus {
    border-color: #fb7185;
    box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.1);
    outline: none;
}

/* Button enhancements */
.btn-primary {
    background: linear-gradient(135deg, #fb7185, #ec4899);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(251, 113, 133, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ec4899, #db2777);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(251, 113, 133, 0.3);
}

.btn-secondary {
    transition: all 0.2s ease;
    color: #64748b;
}

.btn-secondary:hover {
    color: #334155;
    background-color: #f1f5f9;
}

/* Header enhancements */
.app-title {
    background: linear-gradient(135deg, #1e293b, #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(30, 41, 59, 0.1);
}

.habit-name {
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* App container */
.app-container {
    max-width: 28rem;
    margin: 0 auto;
    padding: 1rem;
}

/* Grid container */
.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Responsive design */
@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem;
    }
    
    .days-grid {
        gap: 0.375rem;
    }
    
    .grid-cell {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.75rem;
    }
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.grid-cell:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.habit-input:focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Success feedback */
.success-feedback {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #fb7185, #ec4899);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(251, 113, 133, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.success-feedback.show {
    transform: translateX(0);
}