/*
 * Frontend Stylesheet
 *
 * This stylesheet is for the public-facing side of the plugin.
 */

/* --- General & Reusable Styles --- */
.book-cover-wrapper {
    position: relative;
    display: block; /* Use block for better consistency */
    cursor: pointer;
    overflow: hidden; /* Ensure text doesn't spill out */
}

.book-cover-wrapper img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease; /* For hover effect */
}

.book-overlay-text {
    position: absolute;
    bottom: 0; /* Align to bottom */
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.9em;
    text-align: center;
    padding: 8px 5px;
    opacity: 0;
    transform: translateY(100%); /* Initially hide below */
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-sizing: border-box; /* Include padding in width */
}

.book-cover-wrapper:hover .book-overlay-text {
    opacity: 1;
    transform: translateY(0); /* Slide up on hover */
}

.book-cover-wrapper:hover img {
    transform: scale(1.05); /* Slight zoom effect on hover */
}

/* --- Short Description & Read More --- */
.bookstore-short-description-wrapper .bookstore-short-description,
.bookstore-short-description-wrapper .bookstore-short-description p {
    text-align: justify !important; /* টেক্সট জাস্টিফাই নিশ্চিত করা হলো */
}

.bookstore-short-description {
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

.bookstore-read-more-toggle-btn {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-weight: bold;
    color: #c82121; /* অথবা আপনার থিমের প্রাইমারি কালার */
    display: inline;
    white-space: nowrap;   /* বাটনের লেখা যেন পরের লাইনে না যায় */
}

.bookstore-read-more-toggle-btn:hover {
    text-decoration: underline;
}

/* Inline Read More/Less buttons */
.bookstore-custom-short-description p {
    display: inline; /* This is key to making the link stay on the same line */
}

.bookstore-read-more-btn,
.bookstore-read-less-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-weight: bold;
    color: #c82121;
    text-decoration: none;
    cursor: pointer;
    display: inline !important; 
    box-shadow: none !important;
}

.bookstore-read-more-btn:hover,
.bookstore-read-less-btn:hover {
    text-decoration: underline;
}

/* --- PDF Popup & Image Click --- */

/* Image Click Text specific styling */
.bookstore-pdf-image-click-text {
    text-align: center;
    font-size: 0.9em;
    color: #555; /* Adjust color for visibility against background */
    margin-top: 5px;
    margin-bottom: 5px;
    cursor: default;
}

.woocommerce-product-gallery {
    margin-bottom: 10px;
}
.bookstore-product-image-pdf-trigger-wrapper {
    display: block;
    cursor: pointer;
    position: relative;
}
.bookstore-product-image-pdf-trigger-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* PDF Popup Modal Styles */
.bookstore-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.7);
    padding: 10px;
    box-sizing: border-box;
}

.bookstore-modal.modal-is-visible {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.bookstore-modal-content {
    background-color: #fefefe;
    padding: 0;
    border: 1px solid #888;
    width: 100%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#bookstore-pdf-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #525659;
}
.pdf-canvas-container {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    text-align: center;
    padding: 0 5px;
    box-sizing: border-box;
}

#bookstore-pdf-viewer canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border: 1px solid #333;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.pdf-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.bookstore-modal-close {
    color: #ffffff;
    background-color: #333333;
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    padding: 4px 9px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 999;
}
.bookstore-modal-close:hover,
.bookstore-modal-close:focus {
    background-color: #ff0000;
    text-decoration: none;
}

/* --- Taxonomy Display (Summary & Table) --- */
.bookstore-taxonomies-summary .taxonomy-item {
    margin-bottom: 5px;
    font-size: 0.9em;
}
.bookstore-taxonomies-summary .taxonomy-label {
    margin-right: 5px;
}
.bookstore-taxonomies-summary .taxonomy-terms a {
    text-decoration: none;
}
.bookstore-taxonomies-summary .taxonomy-terms a:hover {
    text-decoration: underline;
}

.bookstore-taxonomy-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95em;
    border: 1px solid #eee;
}
.bookstore-taxonomy-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}
.bookstore-taxonomy-table tr:last-child td {
    border-bottom: none;
}
.bookstore-taxonomy-table .taxonomy-label {
    width: 30%;
}
.bookstore-taxonomy-table .taxonomy-terms a {
    text-decoration: none;
}
.bookstore-taxonomy-table .taxonomy-terms a:hover {
    text-decoration: underline;
}

/* 'By Writer' Taxonomy in Title */
.single-product .product_title .bookstore-by-writer {
    font-size: 0.55em !important;
    font-weight: normal !important;
    display: inline-block !important;
    vertical-align: baseline !important;
    text-transform: none !important;
    margin-left: 5px !important;
}

.single-product .product_title .bookstore-by-writer a {
    color: inherit !important;
    text-decoration: none !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

.single-product .product_title .bookstore-by-writer a:hover {
    text-decoration: underline !important;
}

/* --- WooCommerce Tweaks --- */
/* Force-hide default short description */
.woocommerce-product-details__short-description {
    display: none !important;
}

/* Ensure our custom description is visible */
.bookstore-custom-short-description {
    display: block !important;
    margin-top: 1em;
    margin-bottom: 1em;
}

/* --- Custom Reviews Accordion --- */
.bookstore-review-toggle-wrapper {
    margin-bottom: 2em;
}

.bookstore-reviews-title {
    font-size: 24px;
    margin-bottom: 15px;
}

a.bookstore-open-review-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #d83131;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.3s;
}

a.bookstore-open-review-form:hover {
    color: #333;
}

a.bookstore-open-review-form .dashicons {
    font-size: 20px;
}

/* Hide default WooCommerce review title/link */
#reviews #reply-title,
.woocommerce-review-link {
    display: none !important;
}

#review_form_wrapper {
    margin-top: 2em;
    border-top: 1px solid #e0e0e0;
    padding-top: 2em;
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
    .bookstore-modal-content {
        height: 75vh;
        max-height: 75vh;
        width: 95%;
    }
}