/**
 * Custom animations and transitions for Lectus reading system
 */

/* Smooth transitions for all interactive elements */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Badge hover effects */
.badge-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-hover:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Progress bar animations */
@keyframes progress-fill {
    from {
        width: 0;
    }
}

.progress-animate {
    animation: progress-fill 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Shimmer effect for loading states */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 50%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 1.5s infinite;
}

/* Toast notification animations */
@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slide-out-right {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-enter {
    animation: slide-in-right 0.3s ease-out forwards;
}

.toast-exit {
    animation: slide-out-right 0.3s ease-in forwards;
}

/* Modal animations */
@keyframes modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modal-scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-backdrop-enter {
    animation: modal-fade-in 0.2s ease-out forwards;
}

.modal-content-enter {
    animation: modal-scale-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Star rating hover effects */
.star-rating {
    transition: transform 0.1s ease;
}

.star-rating:hover {
    transform: scale(1.1);
}

.star-rating.filled {
    color: #facc15;
    fill: #facc15;
}

.star-rating.preview {
    color: #fde047;
    fill: #fde047;
}

/* Card hover effects */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Pulse animation for notifications */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Slide up animation for mobile bottom sheets */
@keyframes slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.slide-up {
    animation: slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Reading statistics number animation */
@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number {
    animation: count-up 0.5s ease-out forwards;
}

/* Timeline animation */
@keyframes timeline-grow {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.timeline-line {
    transform-origin: left center;
    animation: timeline-grow 1s ease-out forwards;
}

/* Focus ring styles */
.focus-ring:focus {
    outline: none;
    ring: 2px;
    ring-offset: 2px;
    ring-color: #3b82f6;
}

/* Smooth scrolling for horizontal containers */
.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Custom tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background-color: #1f2937;
    color: white;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0.5rem;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1f2937;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
}

/* Mobile tap highlight removal */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Improve text rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Utility classes for common animations */
.fade-in {
    animation: modal-fade-in 0.3s ease-out forwards;
}

.scale-in {
    animation: modal-scale-in 0.3s ease-out forwards;
}

.slide-in {
    animation: slide-in-right 0.3s ease-out forwards;
}

/* Prevent layout shift during loading */
.aspect-book {
    aspect-ratio: 2/3;
}

.min-h-book-card {
    min-height: 300px;
}
