/* Brochure Card Updates */
.brochure-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.brochure-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    border-color: rgba(236, 94, 42, 0.3);
}

/* Rectangular standard document preview */
.brochure-icon-wrapper {
    width: 100%;
    height: 280px;
    /* A4 aspect ratio approximation */
    background: #f8f9fa;
    border-radius: 8px;
    /* Slightly squared for doc look */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

/* Page effect */
.brochure-icon-wrapper::before {
    content: '';
    position: absolute;
    width: 70%;
    height: 80%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease;
}

.brochure-card:hover .brochure-icon-wrapper::before {
    transform: translate(-50%, -50%) scale(1.03);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.brochure-icon-wrapper i {
    font-size: 3rem;
    color: #ec5e2a;
    z-index: 2;
    opacity: 0.9;
    transition: opacity 0.3s;
}

/* Loading State */
.brochure-icon-wrapper.loading i {
    opacity: 0.2;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-5px);
    }
}

/* Hide fallback effects if canvas present */
.brochure-icon-wrapper.has-canvas i,
.brochure-icon-wrapper.has-canvas::before {
    display: none !important;
}

/* Add support for image thumbnails */
.brochure-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 5;
    position: relative;
    display: block;
}

/* Hide fallback effects if image/canvas present */
.brochure-icon-wrapper.has-canvas i,
.brochure-icon-wrapper.has-canvas::before,
.brochure-icon-wrapper img+i,
/* If img exists, hide i */
.brochure-icon-wrapper img~i,
.brochure-icon-wrapper:has(img)::before {
    display: none !important;
}

.brochure-card:hover .brochure-icon-wrapper {
    background: #fff5f2;
    /* Subtle orange tint */
}

/* Typography alignment */
.brochure-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 44px;
    /* Fix height for 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 5px;
}

.brochure-info p {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 20px;
}

/* Buttons */
.brochure-actions {
    margin-top: auto;
}

.btn-brochure {
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 10px;
}

.btn-view {
    background: #fff;
    border: 1px solid #eee;
    color: #333;
}

.btn-view:hover {
    background: #f9f9f9;
    border-color: #ec5e2a;
    color: #ec5e2a;
}

.btn-download {
    background: #ec5e2a;
    color: #fff;
    box-shadow: 0 4px 10px rgba(236, 94, 42, 0.2);
}

.btn-download:hover {
    background: #d44d1e;
    box-shadow: 0 6px 15px rgba(236, 94, 42, 0.3);
}

/* PDF Overlay */
.pdf-modal {
    display: none;
    /* Hidden by default, toggled to flex by JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

/* PDF Modal Wrapper */
.pdf-modal-wrapper {
    position: relative;
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Popup Modal - Half Size */
.pdf-modal-content {
    width: 60vw;
    height: 90vh;
    max-width: 1000px;
    background: #fff;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

#pdf-preview-frame {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

.close-modal {
    position: absolute;
    top: -20px;
    right: -20px;
    z-index: 10002;
    color: #fff;
    background: #ec5e2a;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #fff;
    /* White border for contrast */
}

.close-modal:hover {
    background: #fff;
    color: #ec5e2a;
    transform: scale(1.1);
}

/* Responsive modal sizing */
@media screen and (max-width: 1024px) {
    .pdf-modal-content {
        width: 80vw;
    }
}

@media screen and (max-width: 768px) {
    .pdf-modal-content {
        width: 90vw;
        height: 80vh;
    }

    /* Mobile: Move button slightly inside or on edge to avoid clipping */
    .close-modal {
        top: -10px;
        right: 0px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* New Category Styling */
.category-section {
    margin-bottom: 60px;
}

.category-title {
    font-size: 1.8rem;
    color: #333;
    font-weight: 700;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ec5e2a;
    display: inline-block;
    padding-right: 20px;
}


/* Responsive */
@media screen and (max-width: 1024px) {
    .pdf-modal-content {
        width: 70vw;
    }
}

@media screen and (max-width: 768px) {
    .pdf-modal-content {
        width: 95vw;
        height: 80vh;
    }

    .close-modal {
        top: -40px;
        right: 0;
    }

    .category-title {
        font-size: 1.5rem;
    }
}