/* WP eBook Store Public CSS */

/* eBook product image styles */
.product-type-ebook .woocommerce-product-gallery__image {
    aspect-ratio: 1/1;
    display: block;
    position: relative;
    overflow: hidden;
}

.product-type-ebook .woocommerce-product-gallery__image img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Make sure WooCommerce buttons are visible */
.single-product div.product form.cart {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1em;
}

.single-product div.product form.cart .button {
    display: inline-block !important;
    margin-right: 0.5em;
    margin-bottom: 0.5em;
}

/* Style the preview button */
.wp-ebook-store-preview {
    margin-bottom: 1em;
}

#preview-ebook-button {
    background-color: #4CAF50;
    color: white;
}

/* Buy Now button styling */
.wp-ebook-buy-now-btn {
    background-color: #2196F3 !important;
    color: white !important;
    margin-left: 10px;
}

/* Modal styling */
.wp-ebook-store-modal {
    z-index: 999999 !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-ebook-store-modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wp-ebook-store-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wp-ebook-store-modal-header h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    padding: 0;
}

.wp-ebook-store-close {
    font-size: 24px;
    cursor: pointer;
    color: #777;
}

.wp-ebook-store-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.wp-ebook-store-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

/* PDF viewer enhancements */
#pdf-preview-container {
    min-height: 400px;
    border: 1px solid #ddd;
    margin-bottom: 1em;
    background-color: #f9f9f9;
    text-align: center;
    position: relative;
}

#pdf-viewer-container {
    min-height: 400px;
}

#pdf-preview-controls {
    margin: 15px 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

#pdf-page-info {
    display: inline-block;
    margin: 0 15px;
    font-size: 14px;
}

#pdf-prev, #pdf-next {
    min-width: 80px;
}

/* Error styling */
.pdf-error {
    color: #d32f2f;
    padding: 15px;
    background-color: #ffebee;
    border-radius: 4px;
    margin: 15px 0;
    text-align: left;
}

.pdf-error-help {
    margin-top: 10px;
    color: #555;
    font-size: 14px;
}

.pdf-error-help a {
    color: #0073aa;
    text-decoration: underline;
}

/* Loading indicator */
.pdf-loading {
    padding: 20px;
    text-align: center;
    color: #666;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 200px;
}

/* Buy now button in preview modal */
#ebook-buy-now {
    background-color: #2196F3;
    color: white;
    padding: 10px 20px;
}

/* Preview notice */
.preview-notice {
    font-style: italic;
    color: #666;
    margin-bottom: 10px;
}

/* Filter styles */
.wp-ebook-store-filter {
    background-color: #f9f9f9;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 5px;
    border: 1px solid #eee;
}

.ebook-filter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.filter-item select,
.filter-item input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.price-range .price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .wp-ebook-store-modal-content {
        width: 95%;
        margin: 0 auto;
    }
    
    .wp-ebook-store-modal-body {
        max-height: 50vh;
    }
}
