/* Custom CSS for Advanced Book Store */

/* Smooth scrolling and animations */
* {
    scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Floating animations for hero section */
@keyframes float-slow {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes float-medium {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(-3deg);
    }
}

@keyframes float-fast {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

.animate-float-slow {
    animation: float-slow 6s ease-in-out infinite;
}

.animate-float-medium {
    animation: float-medium 4s ease-in-out infinite;
}

.animate-float-fast {
    animation: float-fast 3s ease-in-out infinite;
}

/* Hero section enhancements */
.hero-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

/* Progress bar animation */
@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--progress-width);
    }
}

.progress-bar {
    animation: progressFill 2s ease-out forwards;
}

/* Typewriter cursor animation */
@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

#typewriter-cursor {
    animation: blink 1s infinite;
}

/* Live Date/Time Display */
.rolling-digit {
    display: inline-block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.rolling-digit.flip {
    animation: digitFlip 0.6s ease-in-out;
}

@keyframes digitFlip {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }
    50% {
        transform: rotateY(90deg);
        opacity: 0.3;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

.time-separator {
    display: inline-block;
    animation: timePulse 2s ease-in-out infinite;
}

@keyframes timePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

#live-time {
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
    background: linear-gradient(45deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#live-date {
    font-family: 'Arial', sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced live clock container */
.live-clock-container {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.live-clock-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Infinite Horizontal Carousel */
#infinite-carousel {
    animation: scroll-infinite 45s linear infinite;
    will-change: transform;
}

#infinite-carousel:hover {
    animation-play-state: paused;
}

@keyframes scroll-infinite {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Book cards in infinite carousel */
.infinite-book-card {
    flex: none;
    width: 280px;
    height: 400px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.dark .infinite-book-card {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.infinite-book-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.infinite-book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.infinite-book-card:hover::before {
    opacity: 1;
}

.infinite-book-cover {
    width: 100%;
    height: 240px;
    overflow: hidden;
    position: relative;
}

.infinite-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.infinite-book-card:hover .infinite-book-cover img {
    transform: scale(1.1);
}

.infinite-book-info {
    padding: 20px;
    position: relative;
    z-index: 2;
}

.infinite-book-title {
    font-size: 16px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .infinite-book-title {
    color: #f9fafb;
}

.infinite-book-author {
    font-size: 14px;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 12px;
}

.infinite-book-genre {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

.infinite-book-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6b7280;
}

.dark .infinite-book-stats {
    color: #9ca3af;
}

/* Carousel paused state */
.carousel-paused #infinite-carousel {
    animation-play-state: paused;
}

/* Loading shimmer effect */
.book-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.dark .book-shimmer {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Responsive carousel */
@media (max-width: 768px) {
    .infinite-book-card {
        width: 240px;
        height: 360px;
    }
    
    .infinite-book-cover {
        height: 200px;
    }
    
    .infinite-book-info {
        padding: 16px;
    }
    
    #infinite-carousel {
        animation-duration: 40s;
    }
}

/* Enhanced card hover effects */
.book-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.book-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

/* Custom shadow for featured books */
.shadow-3xl {
    box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.25);
}

/* Mobile menu animation */
#mobile-menu {
    transition: all 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu:not(.hidden) {
    max-height: 500px;
}

/* Contact form focus styles */
.contact-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Enhanced button hover effects */
.btn-hover-lift {
    transition: all 0.2s ease-in-out;
}

.btn-hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-10px);
    }
    70% {
        transform: translateY(-5px);
    }
    90% {
        transform: translateY(-2px);
    }
}

/* Book card animations */
.book-card {
    animation: fadeInUp 0.5s ease-out;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.book-card:hover {
    transform: translateY(-8px) rotateX(5deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.book-card.list-view {
    animation: slideInRight 0.4s ease-out;
}

/* Book cover image effects */
.book-cover {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.book-card:hover .book-cover::before {
    transform: translateX(100%);
}

.book-cover img {
    transition: all 0.3s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.1);
}

/* Placeholder book cover */
.book-cover-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Button effects */
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Heart animation for reading list */
.heart-btn {
    transition: all 0.3s ease;
}

.heart-btn.active {
    animation: pulse 0.6s ease-in-out;
    color: #ef4444 !important;
}

.heart-btn:hover {
    transform: scale(1.1);
}

/* Search input effects */
.search-input-container {
    position: relative;
}

.search-input-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.search-input-container:focus-within::after {
    width: 100%;
}

/* Filter tag animations */
.filter-tag {
    animation: fadeInScale 0.3s ease-out;
    transition: all 0.2s ease;
}

.filter-tag:hover {
    transform: scale(1.05);
}

/* Modal animations */
.modal-enter {
    animation: fadeInScale 0.3s ease-out;
}

.modal-backdrop {
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

/* Toast notifications */
.toast {
    animation: slideInRight 0.4s ease-out;
    transition: all 0.3s ease;
}

.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination styles */
.page-number {
    transition: all 0.2s ease;
}

.page-number:hover {
    transform: scale(1.1);
}

.page-number.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

/* Genre badge styles */
.genre-badge {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    transition: all 0.2s ease;
}

.genre-badge:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    transform: translateY(-1px);
}

/* View toggle buttons */
.view-toggle-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

/* Responsive grid layouts */
.books-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.books-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Dark mode transitions */
.dark-mode-transition {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

/* Book details modal styling */
.book-details-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

/* Reading list item animations */
.reading-list-item {
    animation: fadeInUp 0.3s ease-out;
    transition: all 0.3s ease;
}

.reading-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Stats counter animation */
.stat-counter {
    animation: bounce 0.8s ease-in-out;
}

/* Hover effects for interactive elements */
.interactive-hover {
    transition: all 0.2s ease;
}

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

/* Form input focus effects */
.form-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    border-color: #6366f1;
}

/* Custom gradient backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mobile responsiveness improvements */
@media (max-width: 640px) {
    .book-card:hover {
        transform: translateY(-4px);
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .book-card {
        border: 2px solid;
    }
    
    .btn-primary {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
}

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

/* Focus indicators for accessibility */
.focus-visible:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Custom properties for theming */
:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
}

/* Advanced grid animations */
.staggered-animation > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.staggered-animation > *:nth-child(1) { animation-delay: 0.1s; }
.staggered-animation > *:nth-child(2) { animation-delay: 0.2s; }
.staggered-animation > *:nth-child(3) { animation-delay: 0.3s; }
.staggered-animation > *:nth-child(4) { animation-delay: 0.4s; }
.staggered-animation > *:nth-child(5) { animation-delay: 0.5s; }
.staggered-animation > *:nth-child(n+6) { animation-delay: 0.6s; }

/* Roman Analog Clock Styles */
.roman-clock-container {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.roman-clock-container:hover {
    backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.roman-clock {
    position: relative;
    width: 120px;
    height: 120px;
}

.clock-face {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hour-marker {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 2px;
    height: 15px;
    background: rgba(0, 0, 0, 0.7);
    transform-origin: 1px 55px;
    border-radius: 1px;
}

.roman-numeral {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.8);
    font-family: 'Times New Roman', serif;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: 0 100%;
    border-radius: 2px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hour-hand {
    width: 3px;
    height: 35px;
    background: linear-gradient(to top, #2c3e50, #34495e);
    margin-left: -1.5px;
    z-index: 3;
}

.minute-hand {
    width: 2px;
    height: 45px;
    background: linear-gradient(to top, #34495e, #4a6741);
    margin-left: -1px;
    z-index: 2;
}

.second-hand {
    width: 1px;
    height: 50px;
    background: linear-gradient(to top, #e74c3c, #c0392b);
    margin-left: -0.5px;
    z-index: 4;
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.clock-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #2c3e50 0%, #34495e 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.clock-date {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 12px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-family: 'Arial', sans-serif;
}

/* Responsive adjustments for Roman clock */
@media (max-width: 768px) {
    .roman-clock-container {
        display: none !important;
    }
    
    .clock-date {
        display: none !important;
    }
}

.mobile-clock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.mobile-clock .clock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mobile-clock .clock-value {
    font-size: 20px;
    font-weight: 700;
    color: transparent;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    min-width: 28px;
    text-align: center;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
}

.mobile-clock .clock-value.flip {
    animation: digitFlip 0.6s ease-in-out;
}

.mobile-clock .clock-label {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mobile-clock .clock-separator {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 2px;
    animation: timePulse 2s ease-in-out infinite;
}

.mobile-date {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    letter-spacing: 0.5px;
}