/**
 * Modern Design CSS for Hilol eBook
 * Bootstrap 5 based styling for book cards, author cards, and hero sections
 */

/* ===================================
   General Styles
   =================================== */
:root {
    --primary-color: #1a5f4a;
    --secondary-color: #2d8a6a;
    --success-color: #28a745;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --border-radius: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
    --container-max-width: 1400px;
    --container-padding: 20px;
}
.std-radius {
    border-radius: var(--border-radius) !important;
}
/* ===================================
   Standard Container - Matches Header
   =================================== */
.hl-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
}

/* Responsive container padding */
@media (max-width: 768px) {
    :root {
        --container-padding: 16px;
    }
}

@media (max-width: 576px) {
    :root {
        --container-padding: 12px;
    }
}

/* ===================================
   Content Section Wrapper
   =================================== */
.hl-content-section {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
    .hl-content-section {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .hl-content-section {
        padding: 16px;
    }
}

/* ===================================
   Hero Section
   =================================== */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-section .qr-code-container {
    transition: var(--transition);
}

.hero-section .qr-code-container:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hero-section .btn-light:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===================================
   Section Titles
   =================================== */
.section-title {
    color: var(--text-dark);
    font-weight: 600;
    position: relative;
    padding-bottom: 8px;
}

/* ===================================
   Book Cards
   =================================== */
.book-section {
    margin-bottom: 3rem;
}

.book-card {
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: #fff;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg) !important;
}

.book-cover-container {
    position: relative;
    width: 100%;
    padding-top: 145%; /* 223/322 aspect ratio for book covers */
    overflow: hidden;
    background: #f8f9fa;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.book-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.book-title {
    font-size: 0.95rem;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.book-card:hover .book-title {
    color: var(--primary-color) !important;
}

.book-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.book-price {
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    color: var(--success-color) !important;
}

/* Cart Button */
.addToCart {
    transition: var(--transition);
    border: none;
}

.addToCart:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.addToCart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Badge styles */
.badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-weight: 600;
}

.badge-sm {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
}

/* ===================================
   Author Cards
   =================================== */
.author-section {
    background: #ffffff;
    margin-bottom: 3rem;
}

.author-card {
    border-radius: var(--border-radius);
    transition: var(--transition);
    background: #fff;
}

.author-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg) !important;
}

.author-image-container img {
    transition: var(--transition);
}

.author-card:hover .author-image-container img {
    transform: scale(1.1);
}

.author-name {
    font-size: 1rem;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.author-card:hover .author-name {
    color: var(--primary-color) !important;
}

.author-position {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===================================
   Horizontal Scroll Containers
   =================================== */
.book-scroll-container,
.author-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
}

.book-scroll-container::-webkit-scrollbar,
.author-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.book-scroll-container::-webkit-scrollbar-track,
.author-scroll-container::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 10px;
}

.book-scroll-container::-webkit-scrollbar-thumb,
.author-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.book-scroll-container::-webkit-scrollbar-thumb:hover,
.author-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Hide scrollbar for Firefox */
.book-scroll-container,
.author-scroll-container {
    scrollbar-width: thin;
}

/* ===================================
   Carousel Banner Styling
   =================================== */
.carousel-banner {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.carousel-banner .carousel-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.carousel-banner .carousel-indicators {
    margin-bottom: 0.5rem;
}

.carousel-banner .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.5;
}

.carousel-banner .carousel-indicators .active {
    opacity: 1;
}

/* ===================================
   Responsive Adjustments
   =================================== */
@media (max-width: 768px) {
    .hero-section {
        min-height: 300px !important;
    }

    .hero-section .display-5 {
        font-size: 1.75rem;
    }

    .hero-section .lead {
        font-size: 1rem;
    }

    .book-title,
    .author-name {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    .book-scroll-container > div,
    .author-scroll-container > div {
        min-width: 150px;
    }

    .hero-section .qr-code-container {
        display: none;
    }
}

/* ===================================
   Animation Utilities
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ===================================
   Button Enhancements
   =================================== */
.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-2px);
}

/* ===================================
   Loading States
   =================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* ===================================
   Grid Layout Improvements
   =================================== */
.row.g-3 {
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.row.g-3 > * {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

/* ===================================
   Alert Styling
   =================================== */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

/* ===================================
   Custom Utilities
   =================================== */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.rounded-3 {
    border-radius: var(--border-radius) !important;
}

.shadow-custom {
    box-shadow: var(--shadow-md) !important;
}

/* ===================================
   Category Filter Tags
   =================================== */
.category-filters-sticky {
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 20px 24px;
    margin: -24px -24px 24px -24px;
    z-index: 10;
    border-radius: var(--border-radius) var(--border-radius) 0 0; /* Match parent's top border-radius */
}

.category-filters-wrapper {
    display: flex;
    align-items: center;
    gap: 30px;
}

.category-scroll-container {
    display: flex;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    overflow-y: visible;
    flex: 1;
    padding-top: 10px;
    margin-top: -10px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    -webkit-overflow-scrolling: touch;
}

.category-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.category-scroll-container::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

.category-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.category-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.category-filters-wrapper .dropdown {
    flex-shrink: 0;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #f8f9fa;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: pointer;
}

.category-tag:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.category-tag.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.category-tag.active:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.category-tag i {
    font-size: 16px;
}

/* Sort Dropdown Styling */
.category-tag.dropdown-toggle::after {
    margin-left: 6px;
}

.dropdown-menu {
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 8px;
    margin-top: 8px;
}

.dropdown-item {
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: #6b7280;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.dropdown-item.active {
    background: var(--primary-color);
    color: #ffffff;
}

@media (max-width: 768px) {
    .category-filters-sticky {
        padding: 16px 20px;
        margin: -24px -20px 20px -20px;
    }

    .category-filters-wrapper {
        gap: 12px;
    }

    .category-tag {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .category-filters-sticky {
        padding: 12px 16px;
        margin: -24px -16px 16px -16px;
    }

    .category-filters-wrapper {
        gap: 10px;
    }

    .category-scroll-container {
        gap: 8px;
    }

    .category-tag {
        padding: 6px 14px;
        font-size: 12px;
    }
}

/* ===================================
   Pagination Styling
   =================================== */
.pagination {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination li {
    display: inline-block;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.pagination .active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.pagination .disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===================================
   App Download Section
   =================================== */
.app-download-section {
    background-image: url('../images/download_ebook_app.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 16px;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.app-download-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.app-download-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.5rem;
}

/* App Store Buttons */
.app-store-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.app-store-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: #000000;
    color: #ffffff;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.app-store-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    background: #1a1a1a;
}

.app-store-btn i {
    font-size: 2rem;
    color: #ffffff;
}

.app-store-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.app-store-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    color: #b0b0b0;
    font-weight: 500;
}

.app-store-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

/* QR Code Card */
.qr-code-card {
    background: rgba(0, 166, 81, 0.3);
    border-radius: 12px;
    padding: 14px 18px;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
}

.qr-code-image-wrapper {
    flex-shrink: 0;
}

.qr-code-img {
    width: 80px;
    height: 80px;
    display: block;
    border-radius: 8px;
    background: #ffffff;
    padding: 4px;
}

.qr-code-text {
    flex: 1;
}

.qr-code-text h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    line-height: 1.4;
}

/* Responsive adjustments for app download section */
@media (max-width: 768px) {
    .app-download-section {
        padding: 30px 24px;
    }

    .app-download-title {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .app-store-buttons {
        gap: 0.75rem;
    }

    .qr-code-card {
        padding: 12px 16px;
        gap: 0.875rem;
        max-width: 100%;
    }

    .qr-code-img {
        width: 70px;
        height: 70px;
    }

    .qr-code-text h3 {
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .app-download-section {
        padding: 24px 20px;
    }

    .app-download-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .app-store-buttons {
        flex-direction: column;
        gap: 0.625rem;
    }

    .app-store-btn {
        justify-content: center;
        width: 100%;
        padding: 0.625rem 1.25rem;
    }

    .app-store-btn i {
        font-size: 1.75rem;
    }

    .app-store-name {
        font-size: 0.875rem;
    }

    .qr-code-card {
        flex-direction: column;
        text-align: center;
        padding: 16px;
        gap: 0.875rem;
    }

    .qr-code-img {
        width: 90px;
        height: 90px;
    }

    .qr-code-text h3 {
        font-size: 0.9rem;
    }
}

/* ===================================
   Platform Download Section
   =================================== */
.platform-icon-wrapper {
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
}

.platform-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    .hero-section,
    .carousel-banner,
    .btn,
    .app-download-section,
    .platform-download-section {
        display: none !important;
    }

    .book-card,
    .author-card {
        break-inside: avoid;
    }
}
