/* WooCommerce Book Fields - Single Product Layout Styles */

/* Hide duplicate price that appears from theme/WooCommerce before our custom layout */
body.wcb-custom-single-product .summary > p.price {
    display: none !important;
}

/* Apply only to pages with our custom class */
body.wcb-custom-single-product .wcb-single-product {
    clear: both;
    display: block;
    width: 100%;
    overflow: visible;
}

body.wcb-custom-single-product .wcb-product-layout {
    display: grid !important;
    grid-template-columns: 30% 67% !important;
    grid-gap: 3%;
    margin-bottom: 60px;
    max-width: 1200px;
    margin: 0 auto 60px auto;
    padding: 20px;
    clear: both;
    align-items: start;
}

/* Ensure the layout works within existing theme structure */
body.wcb-custom-single-product .product {
    max-width: none;
    overflow: visible;
    position: relative;
}

body.wcb-custom-single-product .summary {
    width: 100%;
}

/* Clear fix for any floated elements */
body.wcb-custom-single-product .wcb-product-layout::after {
    content: "";
    display: table;
    clear: both;
}

/* Make sure images container takes the right space */
body.wcb-custom-single-product .wcb-product-images {
    grid-column: 1;
    max-width: 100%;
    width: 100%;
}

body.wcb-custom-single-product .wcb-product-summary {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 100%;
}

/* Product Images Section */
.wcb-custom-single-product .wcb-product-images {
    position: relative;
    max-width: 100% !important;
    width: 100% !important;
}

.wcb-custom-single-product .wcb-product-images img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
}

.wcb-custom-single-product .wcb-product-images .woocommerce-product-gallery {
    margin: 0;
}

.wcb-custom-single-product .wcb-product-images .woocommerce-product-gallery__wrapper {
    margin: 0;
}

.wcb-custom-single-product .wcb-product-images .woocommerce-product-gallery__image {
    margin-bottom: 10px;
}

.wcb-custom-single-product .wcb-product-images .flex-viewport {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Product Summary Section (2/3) */
.wcb-custom-single-product .wcb-product-summary {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Product Title */
.wcb-custom-single-product .wcb-product-title {
    font-size: 2.2em;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 15px 0;
    color: #333;
}

/* Product Author */
.wcb-custom-single-product .wcb-product-author {
    font-size: 16px;
    color: #666;
    margin: 0 0 15px 0;
}

.wcb-custom-single-product .wcb-product-author strong {
    color: #333;
    font-weight: 600;
}

.wcb-custom-single-product .wcb-product-author span {
    color: #0073aa;
    font-style: italic;
}

/* Product Categories */
.wcb-custom-single-product .wcb-product-categories {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.wcb-custom-single-product .wcb-categories-label {
    font-weight: 600;
    color: #333;
}

.wcb-custom-single-product .wcb-product-categories a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wcb-custom-single-product .wcb-product-categories a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Product Excerpt */
.wcb-custom-single-product .wcb-product-excerpt {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
}

.wcb-custom-single-product .wcb-product-excerpt p {
    margin: 0 0 15px 0;
}

/* Price and Cart Wrapper */
.wcb-price-cart-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Product Price */
.wcb-price-cart-wrapper .wcb-product-price {
    margin: 0;
}

.wcb-price-cart-wrapper .wcb-product-price .price {
    font-size: 2em;
    font-weight: 700;
    color: #e74c3c;
    margin: 0;
}

.wcb-price-cart-wrapper .wcb-product-price .price del {
    color: #999;
    font-size: 0.75em;
    margin-right: 10px;
}

.wcb-price-cart-wrapper .wcb-product-price .price ins {
    text-decoration: none;
    color: #e74c3c;
}

/* Standalone price (for non-purchasable products) */
.wcb-custom-single-product .wcb-product-price {
    margin-bottom: 25px;
}

.wcb-custom-single-product .wcb-product-price .price {
    font-size: 1.8em;
    font-weight: 700;
    color: #333;
}

/* Book Details */
.wcb-book-details {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.wcb-book-details h3 {
    margin: 0 0 15px 0;
    font-size: 1.3em;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

.wcb-book-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.wcb-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.wcb-detail-item:last-child {
    border-bottom: none;
}

.wcb-detail-label {
    font-weight: 600;
    color: #333;
    min-width: 120px;
}

.wcb-detail-value {
    color: #555;
    text-align: right;
    flex: 1;
}

/* Add to Cart Section in Price-Cart Wrapper */
.wcb-price-cart-wrapper .wcb-add-to-cart-wrapper {
    flex: 1;
    margin: 0;
}

.wcb-price-cart-wrapper .cart {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcb-price-cart-wrapper .cart .quantity {
    margin: 0;
}

.wcb-price-cart-wrapper .cart .quantity input {
    width: 60px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.wcb-price-cart-wrapper .cart .single_add_to_cart_button {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.wcb-price-cart-wrapper .cart .single_add_to_cart_button:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

/* Learn More Section */
.wcb-learn-more {
    margin: 20px 0 0 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.wcb-learn-more-toggle {
    width: 100%;
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    transition: background 0.3s ease;
}

.wcb-learn-more-toggle:hover {
    background: #e9ecef;
}

.wcb-learn-more-toggle .wcb-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 14px;
}

.wcb-learn-more-toggle.active .wcb-toggle-icon {
    transform: rotate(180deg);
}

.wcb-learn-more-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wcb-learn-more-content.active {
    padding: 20px;
    max-height: 1000px;
}

.wcb-description-content {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
}

.wcb-description-content p {
    margin: 0 0 15px 0;
}

.wcb-description-content p:last-child {
    margin-bottom: 0;
}

/* Related Products Section */
.wcb-related-products-section {
    clear: both;
    display: block;
    width: 100%;
    margin: 60px auto 0 auto;
    padding: 40px 20px 20px 20px;
    border-top: 2px solid #e9ecef;
    max-width: 1200px;
}

.wcb-related-products-section h2 {
    font-size: 2em;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.wcb-related-products-wrapper {
    margin-bottom: 40px;
}

/* Header with title and controls */
.wcb-related-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.wcb-related-header h3 {
    font-size: 1.6em;
    margin: 0;
    color: #222;
    padding-left: 15px;
    border-left: 5px solid #0073aa;
    flex: 1;
}

/* Slider Controls */
.wcb-slider-controls {
    display: flex;
    gap: 10px;
}

.wcb-slider-btn {
    background: #fff;
    border: 2px solid #0073aa;
    color: #0073aa;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.3s ease;
    padding: 0;
}

.wcb-slider-btn:hover:not(:disabled) {
    background: #0073aa;
    color: white;
    transform: scale(1.1);
}

.wcb-slider-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.wcb-slider-btn span {
    line-height: 1;
    display: block;
}

/* Related Products Slider */
.wcb-related-products-slider {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 10px 0 20px 0;
    scrollbar-width: thin;
    scrollbar-color: #0073aa #f0f0f0;
}

.wcb-related-products-slider::-webkit-scrollbar {
    height: 8px;
}

.wcb-related-products-slider::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.wcb-related-products-slider::-webkit-scrollbar-thumb {
    background: #0073aa;
    border-radius: 10px;
}

.wcb-related-products-slider::-webkit-scrollbar-thumb:hover {
    background: #005a87;
}

/* Related Product Item */
.wcb-related-product-item {
    flex: 0 0 280px; /* Fixed width for slider */
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wcb-related-product-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-color: #0073aa;
}

.wcb-related-product-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wcb-related-product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.wcb-related-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wcb-related-product-item:hover .wcb-related-product-image img {
    transform: scale(1.05);
}

.wcb-related-product-info {
    padding: 15px;
}

.wcb-related-product-info h4 {
    margin: 0 0 12px 0;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.wcb-related-author,
.wcb-related-categories {
    margin: 0 0 8px 0;
    font-size: 12px;
    line-height: 1.4;
}

.wcb-meta-label {
    font-weight: 600;
    color: #555;
}

.wcb-meta-value {
    color: #0073aa;
}

.wcb-related-categories .wcb-meta-value {
    color: #666;
    font-style: italic;
}

.wcb-related-price {
    margin: 12px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 1.2em;
    font-weight: 700;
    color: #e74c3c;
}

/* Scroll Navigation Buttons */
.wcb-related-products-wrapper {
    position: relative;
}

.wcb-scroll-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.wcb-scroll-nav:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.wcb-scroll-nav.prev {
    left: -20px;
}

.wcb-scroll-nav.next {
    right: -20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    body.wcb-custom-single-product .wcb-product-layout {
        grid-template-columns: 30% 67% !important;
        grid-gap: 3%;
    }
    
    .wcb-related-header h3 {
        font-size: 1.4em;
    }
}

@media (max-width: 768px) {
    body.wcb-custom-single-product .wcb-product-layout {
        grid-template-columns: 1fr !important;
        grid-gap: 30px;
        padding: 15px;
        margin-bottom: 40px;
    }
    
    .wcb-custom-single-product .wcb-product-title {
        font-size: 2em;
    }
    
    .wcb-price-cart-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }
    
    .wcb-price-cart-wrapper .wcb-product-price {
        text-align: center;
    }
    
    .wcb-price-cart-wrapper .cart {
        flex-direction: column;
        gap: 10px;
    }
    
    .wcb-price-cart-wrapper .cart .single_add_to_cart_button {
        width: 100%;
    }
    
    .wcb-custom-single-product .wcb-product-price .price {
        font-size: 1.6em;
    }
    
    .wcb-book-details {
        padding: 15px;
    }
    
    .wcb-detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .wcb-detail-value {
        text-align: left;
    }
    
    .wcb-related-products-section {
        margin-top: 40px;
        padding: 30px 15px 20px 15px;
    }
    
    .wcb-related-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wcb-related-header h3 {
        font-size: 1.3em;
    }
    
    .wcb-slider-controls {
        align-self: flex-end;
    }
    
    .wcb-related-product-item {
        flex: 0 0 240px;
    }
    
    .wcb-related-product-image {
        height: 180px;
    }
}

@media (max-width: 480px) {
    body.wcb-custom-single-product .wcb-product-layout {
        margin-bottom: 30px;
    }
    
    .wcb-related-products-section {
        margin-top: 30px;
        padding: 20px 10px 10px 10px;
    }
    
    .wcb-custom-single-product .wcb-product-title {
        font-size: 1.6em;
    }
    
    .wcb-related-header h3 {
        font-size: 1.3em;
    }
    
    .wcb-related-product-image {
        height: 200px;
    }
}

/* Animation for loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wcb-related-product-item {
    animation: fadeInUp 0.6s ease forwards;
}

/* Stagger animation for related products */
.wcb-related-product-item:nth-child(1) { animation-delay: 0.1s; }
.wcb-related-product-item:nth-child(2) { animation-delay: 0.2s; }
.wcb-related-product-item:nth-child(3) { animation-delay: 0.3s; }
.wcb-related-product-item:nth-child(4) { animation-delay: 0.4s; }
.wcb-related-product-item:nth-child(5) { animation-delay: 0.5s; }
.wcb-related-product-item:nth-child(6) { animation-delay: 0.6s; }
.wcb-related-product-item:nth-child(7) { animation-delay: 0.7s; }
.wcb-related-product-item:nth-child(8) { animation-delay: 0.8s; }