/* Amazon-style Product Page Layout for CourseBox */
/* Optimized for performance and loading */

/* CSS Custom Properties for consistent theming */
:root {
    --cbx-primary-color: #2563eb;
    --cbx-primary-hover: #1d4ed8;
    --cbx-success-color: #059669;
    --cbx-warning-color: #f59e0b;
    --cbx-error-color: #dc2626;
    --cbx-gray-50: #f9fafb;
    --cbx-gray-100: #f3f4f6;
    --cbx-gray-200: #e5e7eb;
    --cbx-gray-300: #d1d5db;
    --cbx-gray-400: #9ca3af;
    --cbx-gray-500: #6b7280;
    --cbx-gray-600: #4b5563;
    --cbx-gray-700: #374151;
    --cbx-gray-900: #111827;
    --cbx-border-radius: 8px;
    --cbx-border-radius-lg: 12px;
    --cbx-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --cbx-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --cbx-shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --cbx-transition: all 0.2s ease;
}

/* Main Layout Container */
.cbx-product-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    contain: layout style;
}

/* Main Content Area (Left Column) */
.cbx-main-content {
    min-width: 0; /* Prevent grid overflow */
}

.cbx-main-content-inner {
    width: 100%;
}

/* Product Header */
.cbx-product-header {
    margin-bottom: 24px;
}

.cbx-product-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 12px 0;
    color: #111;
}

.cbx-product-rating {
    margin-bottom: 16px;
}

/* Simple Course Cover Image */
.cbx-product-images {
    margin-bottom: 32px;
}

.cbx-course-cover {
    width: 100%;
}

/* Cover Image Container */
.cbx-cover-image-container {
    position: relative;
    background: var(--cbx-gray-50);
    border-radius: var(--cbx-border-radius-lg);
    overflow: hidden;
    box-shadow: var(--cbx-shadow-lg);
    /* Remove fixed aspect-ratio to let image determine size */
}

.cbx-cover-image {
    width: 100%;
    height: auto; /* Let image maintain its natural aspect ratio */
    display: block;
    transition: opacity 0.2s ease;
    opacity: 1; /* Show image immediately */
    border-radius: var(--cbx-border-radius-lg);
}

/* Remove the loading animation that was causing conflicts */

@keyframes cbx-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* No Images Placeholder */
.cbx-no-images {
    margin-bottom: 32px;
}

.cbx-placeholder-image {
    aspect-ratio: 16/10;
    background: var(--cbx-gray-100);
    border: 2px dashed var(--cbx-gray-300);
    border-radius: var(--cbx-border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cbx-placeholder-text {
    color: var(--cbx-gray-500);
    font-size: 1rem;
    font-weight: 500;
}

/* Image error state */
.cbx-cover-image-container.cbx-image-error {
    background: var(--cbx-gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cbx-cover-image-container.cbx-image-error::after {
    content: "Immagine non disponibile";
    color: var(--cbx-gray-500);
    font-size: 1rem;
    font-weight: 500;
}

/* Sidebar (Right Column) */
.cbx-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
    contain: layout style;
}

.cbx-sidebar-inner {
    background: #fff;
    border: 1px solid var(--cbx-gray-200);
    border-radius: var(--cbx-border-radius-lg);
    padding: 24px;
    box-shadow: var(--cbx-shadow);
}

.cbx-sidebar-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cbx-gray-100);
}

.cbx-sidebar-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cbx-sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--cbx-gray-900);
}

/* Pricing Section */
.cbx-pricing-section .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
}

/* Sidebar Session Picker */
.cbx-sidebar-picker {
    border: none;
    padding: 0;
    margin: 0;
}

.cbx-sidebar-sessions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cbx-sidebar-radio {
    display: block;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.cbx-sidebar-radio:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cbx-sidebar-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cbx-sidebar-radio input[type="radio"]:checked + .cbx-session-content {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)
}

.cbx-sidebar-radio input[type="radio"]:checked {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cbx-sidebar-radio.cbx-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f9fafb;
}

.cbx-sidebar-radio.cbx-early-bird-session {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
}

.cbx-session-content {
    display: block;
    width: 100%;
}

.cbx-session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.cbx-session-date {
    font-weight: 600;
    color: #111;
    font-size: 0.95rem;
    line-height: 1.3;
    flex: 1;
}

.cbx-session-badges {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.cbx-session-badges .cbx-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    white-space: nowrap;
}

.cbx-session-price {
    display: block;
    margin: 6px 0;
    font-weight: 600;
}

.cbx-session-price .cbx-price {
    font-size: 1rem;
    color: #111;
}

/* Early bird pricing - target WooCommerce price structure */
.cbx-session-price .cbx-early-bird,
.cbx-session-price .cbx-early-bird .woocommerce-Price-amount,
.cbx-session-price .cbx-early-bird .amount,
.cbx-session-price .cbx-early-bird .woocommerce-Price-currencySymbol {
    color: var(--cbx-success-color) !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
}

/* Original price - target WooCommerce price structure */
.cbx-session-price .cbx-original-price,
.cbx-session-price .cbx-original-price .woocommerce-Price-amount,
.cbx-session-price .cbx-original-price .amount,
.cbx-session-price .cbx-original-price .woocommerce-Price-currencySymbol {
    color: var(--cbx-error-color) !important;
    text-decoration: line-through !important;
    margin-left: 6px;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
}

.cbx-seats-left {
    font-size: 0.8rem;
    color: #6b7280;
    font-style: italic;
}

.cbx-sidebar-hint {
    margin: 12px 0 0 0;
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
}

.cbx-no-sessions {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Selected state for sidebar radio */
.cbx-sidebar-radio.cbx-selected {
    border-color: #2563eb;
    background: #f0f9ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cbx-sidebar-radio.cbx-selected.cbx-early-bird-session {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Add to cart button states */
.cbx-sidebar .single_add_to_cart_button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #9ca3af;
}

/* Early bird message in sidebar */
.cbx-sidebar-picker .cbx-early-bird-message {
    margin: 8px 0 0 0;
    padding: 6px 10px;
    font-size: 0.8rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .cbx-product-layout {
        grid-template-columns: 1fr 300px;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .cbx-product-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 16px;
    }
    
    .cbx-sidebar {
        position: static;
        order: -1; /* Move sidebar above main content on mobile */
    }
    
    .cbx-product-title {
        font-size: 1.75rem;
    }
    
    /* Mobile cover image adjustments - let image determine its own size */
    
    /* Mobile tab adjustments */
    .cbx-tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .cbx-tab-button {
        padding: 10px 16px;
        font-size: 0.9rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .cbx-product-layout {
        padding: 12px;
    }
    
    .cbx-product-title {
        font-size: 1.5rem;
    }
    
    .cbx-sidebar-inner {
        padding: 16px;
    }
}

/* Ensure WooCommerce elements integrate well */
.cbx-sidebar .cart {
    margin: 0;
}

.cbx-sidebar .single_add_to_cart_button {
    width: 100%;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
}

/* Product Tabs */
.cbx-product-tabs {
    margin-top: 32px;
}

.cbx-tab-nav {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 24px;
    gap: 0;
}

.cbx-tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    top: 2px;
}

.cbx-tab-button:hover {
    color: #111;
    background: #f9fafb;
}

.cbx-tab-button.active {
    color: #111;
    font-weight: 600;
    border-bottom-color: #111;
}

.cbx-tab-content {
    min-height: 200px;
}

.cbx-tab-pane {
    display: none;
}

.cbx-tab-pane.active {
    display: block;
}

/* Course Details */
.cbx-course-info h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #111;
}

.cbx-info-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.cbx-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.cbx-info-item:last-child {
    border-bottom: none;
}

.cbx-info-item strong {
    color: #374151;
    font-weight: 500;
}

.cbx-info-item span {
    color: #111;
    font-weight: 400;
}

.cbx-front-text {
    margin-top: 24px;
}

.cbx-front-text h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #111;
}

/* Hide default WooCommerce product images on course products */
.cbx-course-product .woocommerce-product-gallery {
    display: none;
}