@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --secondary-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f3f4f6;
    --success-color: #10b981;
    --error-color: #ef4444;
}

body {
    font-family: 'Poppins', sans-serif;
    scroll-behavior: smooth;
}

/* Header Styles */
header {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.95);
}

#searchInput {
    transition: all 0.3s ease;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
}

#searchInput:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    border-color: var(--primary-light);
}

/* Horizontal Scrollable Books */
.books-scroll-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 20px;
    position: relative;
    scroll-behavior: smooth;
    scroll-padding: 0 50px;
}

.books-scroll-wrapper {
    display: inline-flex;
    gap: 20px;
    padding: 10px 20px;
}

/* Scroll indicators */
.scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2;
    color: var(--primary-color);
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s;
    border: 1px solid #e5e7eb;
}

.scroll-indicator:hover {
    background-color: var(--primary-light);
    color: white;
    transform: translateY(-50%) scale(1.05);
}

.books-scroll-container:hover .scroll-indicator {
    opacity: 1;
}

.scroll-indicator.left-0 {
    left: 15px;
}

.scroll-indicator.right-0 {
    right: 15px;
}

/* Book Card Styles */
.book-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    width: 180px;
    flex-shrink: 0;
    position: relative;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.book-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.book-image-container {
    position: relative;
    width: 100%;
    padding-top: 145%;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
}

.book-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.book-card:hover .book-image {
    transform: scale(1.08);
}

.pdf-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--error-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.book-details {
    padding: 16px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.book-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.book-price::before {
    content: '₹';
    font-size: 0.9em;
}

.download-btn {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* Modal Styles */
#downloadModal {
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

#downloadModal:not(.hidden) .modal-content {
    transform: translateY(0);
}

.download-count {
    position: absolute;
    top: 40px;
    right: 12px;
    background-color: var(--success-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

i.fas,
i.fab {
    font-family: 'Font Awesome 6 Free' !important;
    display: inline-block;
}

.books-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 20px;
    scrollbar-width: none;
    /* Firefox */
}

.books-row::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* Loading spinner */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Success Message */
.payment-success {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.payment-success i {
    color: var(--success-color);
}

/* Responsive Adjustments */
@media (min-width: 640px) {
    .book-card {
        width: 200px;
    }

    .book-title {
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .book-card {
        width: 220px;
    }

    header {
        padding: 1.2rem 2.5rem;
    }

    .books-scroll-wrapper {
        gap: 25px;
        padding: 15px 25px;
    }
}

@media (min-width: 1024px) {
    .book-card {
        width: 240px;
    }

    .scroll-indicator {
        width: 45px;
        height: 45px;
    }
}

/* Smooth transitions for all interactive elements */
button,
a,
input,
.book-card {
    transition: all 0.3s ease;
}

/* Focus states for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Better scrollbar for non-webkit browsers */
.books-scroll-container {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) #f1f1f1;
}

@media (max-width: 768px) {
    .books-row {
        gap: 12px;
    }

    .book-card {
        min-width: 160px;
    }
}