/* ==========================================================================
   BMI LMS Stripe - Store Styles
   Consolidated from: stripe-payments.css, store-widget.css, store-success.css
   ========================================================================== */

/* Stripe Checkout Form */

.stripe-checkout-form {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
}

/* ==========================================================================
   Store Widget - Dropdown & Paywall Styles
   ========================================================================== */

.store-widget {
    padding: 0;
    margin: 0;
}

.store-widget-owned {
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.store-widget-subscribed.paywall {
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
    background-color: var(--store_subscribed_button_bg_color, #d1ecf1);
    border: 1px solid var(--store_subscribed_button_bg_color, #bee5eb);
}

.store-widget-paywall {
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.store-widget-pricing {
    margin-bottom: 10px;
}

.store-widget-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--money_color, #28a745);
}

.store-widget-member-price {
    margin-left: 10px;
}

.store-widget-sub-option,
.store-widget-bundle-options {
    margin: 10px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

.store-widget-bundle-option {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.store-widget-actions {
    margin-top: 15px;
}

.store-widget-add-to-cart {
    width: 100%;
}

.store-widget-view-bundle {
    font-size: 12px;
    padding: 2px 24px 8px;
    color: #888;
    display: block;
    text-decoration: none;
}

.store-widget-view-bundle:hover {
    color: #e97663;
    text-decoration: none;
    background-color: transparent;
}

.store-widget.no-text {
    background-color: unset; 
    border: unset;
    border-radius: 0px;  
    margin: 0px; 
    padding: 0px;
    width: min-content;
}

.store-widget.no-text .dropdown-toggle::after {
    display: none; 
}

.store-widget.store-widget-subscribed:not(.no-text) i,
.store-widget.store-widget-purchased:not(.no-text) i {
    margin-right: 0.5ch; 
}

.store-widget.store-widget-subscribed .dropdown-menu,
.store-widget.store-widget-purchased .dropdown-menu,
.store-widget.store-widget-subscribed.no-text .dropdown-menu {
    padding: .75rem 1.5rem;
    min-width: max-content; 
}

.store-widget.store-widget-subscribed button.btn-subscribed,
.store-widget.store-widget-purchased button.btn-purchased,
.store-widget.store-widget-dropdown button.store-cart-dropdown-button {
    padding: 6px 16px;
}

.store-widget.no-text.store-widget-subscribed button.btn-subscribed,
.store-widget.no-text.store-widget-purchased button.btn-purchased,
.store-widget.no-text.store-widget-dropdown button.store-cart-dropdown-button {
    padding: 8px 12px;
}

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: -4px;
    right: 1px;
    background-color: var(--error_color, #dc3545);
    color: var(--error_color_overlay, white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

#cart-btn {
    position: relative;
}

/* Cart Modal */

.cart-items-list {
    margin-bottom: 15px;
}

.cart-item {
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 10px;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-price {
    font-weight: bold;
    color: var(--cart_modal_color_price, #28a745);
    font-size: 1.15rem;
}

.cart-item button.text-danger {
    color: var(--cart_modal_color_remove, inherit) !important;
}

#store-cart-total {
    font-size: 1.3rem;
    color: var(--cart_modal_color_price, #28a745);
}

/* Course Preview Mode */

.course-body-truncate-preview-mode-msg-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--store_preview_truncate_wrapper_height, 350px);
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    background: var(--store_preview_truncate_wrapper_background, linear-gradient(to bottom, transparent, #fff 65%));
}

.course-body-truncate-preview-mode-msg {
    padding: 0 0 75px;
    text-align: center;
    border: none;
    box-shadow: none;
    width: 100%;
    z-index: 1000;
    pointer-events: auto;
}

.course-body-truncate-preview-mode-msg-text p {
    color: var(--store_preview_truncate_color, #888);
    font-family: var(--store_preview_truncate_font_family, inherit);
    font-size: var(--store_preview_truncate_font_size, 14px);
    letter-spacing: var(--store_preview_truncate_letter_spacing, 0.3px);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}

.course-body-truncate-preview-mode-msg-text p::before,
.course-body-truncate-preview-mode-msg-text p::after {
    content: '';
    flex: 0 1 80px;
    height: 1px;
    background-color: #ccc;
}

/* ==========================================================================
   Store Checkout Success Page
   ========================================================================== */

.store-success-container {
    max-width: 600px;
    margin: 40px auto;
    padding: 20px;
}

.store-success-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.store-success-header {
    background: var(--store_checkout_success_header_bg_color, linear-gradient(135deg, #4a4a4a 0%, #333333 100%));
    color: var(--store_checkout_success_header_color, white);
    padding: 40px 20px;
    text-align: center;
}

.store-success-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: inline-block;
    width: 60px;
    height: 60px;
    background: var(--store_checkout_success_checkmark_bg_color, rgba(255, 255, 255, 0.2));
    color: var(--store_checkout_success_checkmark_color, inherit) !important;
    border-radius: 50%;
    line-height: 60px;
}

.store-success-header h1 {
    margin: 16px 0 8px 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--store_checkout_success_header_color, inherit) !important;
}

.store-success-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.95;
}

.store-success-details {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.store-success-details h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.store-success-items {
    margin-bottom: 24px;
}

.store-success-items h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.store-success-items ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.store-success-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 14px;
}

.store-success-item:last-child {
    margin-bottom: 0;
}

.item-type {
    display: inline-block;
    background: color-mix(in srgb, var(--store_item_color, #1976d2) 15%, #FFF);
    color: var(--store_item_color, #1976d2);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    min-width: 60px;
    text-align: center;
}

.item-name {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.store-success-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid #eee;
    margin-top: 16px;
    font-size: 16px;
}

.store-success-amount strong {
    color: #333;
}

.store-success-amount .amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--money_color, #4CAF50);
}

.store-success-transaction {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 13px;
    color: #666;
}

.store-success-transaction strong {
    color: #333;
}

.transaction-id {
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 3px;
    word-break: break-all;
    max-width: 250px;
}

.store-success-actions {
    padding: 30px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.store-success-actions .btn,
.store-success-actions .button-primary,
.store-success-actions .button-secondary {
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 150px;
}

.store-success-footer {
    background: var(--page_bg_color_low_contrast, #f9f9f9);
    padding: 20px 30px;
    text-align: center;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #eee;
}

.store-success-footer p {
    margin: 8px 0;
}

.store-success-footer p:first-child {
    margin-top: 0;
}

.store-success-footer p:last-child {
    margin-bottom: 0;
}

.store-success-footer a {
    color: var(--money_color, #4CAF50);
    text-decoration: none;
    font-weight: 600;
}

.store-success-footer a:hover {
    text-decoration: underline;
}

/* Error state */
.store-success-error {
    max-width: 600px;
    margin: 40px auto;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.store-success-error h2 {
    color: var(--error_color, #d32f2f);
    margin: 0 0 16px 0;
    font-size: 24px;
}

.store-success-error p {
    color: #666;
    margin: 0 0 24px 0;
    font-size: 14px;
}

.store-success-error .btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--success_color, #4CAF50);
    color: var(--success_color_overlay, white);
    text-decoration: none;
    border-radius: var(--button_border_radius, 4px);
    font-weight: 600;
    transition: background 0.3s ease;
}

.store-success-error .btn:hover {
    background: color-mix(in srgb, var(--success_color, #4CAF50) 80%, var(--page_bg_color, white));
}

.course-preview-video-label {
    color: var(--store_preview_video_label_color, inherit); 
    font-family: var(--store_preview_video_label_font_family, inherit); 
    font-size: var(--store_preview_video_label_font-size, inherit); 
}

/* 
==========================================================================
                        PARAMETERIZATION STYLES
========================================================================== 
*/

/* Dropdown menu */
.store-widget .dropdown-menu {
    border-color: var(--page_bg_color_low_med_contrast);
    border-radius: var(--button_border_radius);
    color: var(--form_field_color);
}

/* Topnav Cart Button */
.top-nav-bar .top-nav-menu-container .top-nav-menu-icons-container #cart-btn {
    color: var(--topnav_color, rgba(38, 38, 38, 1));
    font-size: var(--topnav_font_size_cart_icon, inherit);
}

/* Topnav Cart Modal */
#cartModal.header-dropdown-modal .modal-dialog .modal-content {
    border-radius: var(--cart_modal_border_radius, inherit);
    border: var(--cart_modal_border, inherit);
    box-shadow: var(--cart_modal_box_shadow, inherit);
    color: var(--cart_modal_color, inherit); 
}
#cartModal hr {
    border-color: var(--cart_modal_color_hr, inherit);
}

/* Topnav Checkout Button */
button[id="store-cart-checkout"] {
    background-color: var(--cart_modal_bg_color_checkout_button, inherit) !important;
    border: var(--cart_modal_border_checkout_button, inherit) !important;
    color: var(--cart_modal_color_checkout_button, inherit) !important;
    min-width: 100px;
}
button[id="store-cart-checkout"]:active {
    background-color: var(--cart_modal_hover_bg_color_checkout_button, inherit) !important;
    border: var(--cart_modal_active_border_checkout_button, inherit) !important;
    color: var(--cart_modal_hover_color_checkout_button, inherit) !important;
}
button[id="store-cart-checkout"]:hover {
    background-color: var(--cart_modal_hover_bg_color_checkout_button, inherit) !important;
    border: var(--cart_modal_hover_border_checkout_button, inherit) !important;
    color: var(--cart_modal_hover_color_checkout_button, inherit) !important;
}
button[id="store-cart-checkout"]:disabled {
    background-color: var(--cart_modal_disabled_bg_color_checkout_button, inherit) !important;
    border: var(--cart_modal_disabled_border_checkout_button, inherit) !important;
    color: var(--cart_modal_disabled_color_checkout_button, inherit) !important;
    cursor: not-allowed;
}

/* Store Widget - Add to Cart Button */
.store-widget.store-widget-dropdown button.btn.btn-add-to-cart {
    background-color: var(--store_cart_button_bg_color, inherit) !important;
    border-color: var(--store_cart_button_border_color, inherit) !important;
    box-shadow: var(--store_cart_button_box_shadow, inherit) !important;
    color: var(--store_cart_button_color, inherit) !important;
}
.store-widget.store-widget-dropdown button.btn.btn-add-to-cart:hover:active,
.store-widget.store-widget-dropdown button.btn.btn-add-to-cart:active {
    background-color: var(--store_cart_button_active_bg_color, inherit) !important;
    border-color: var(--store_cart_button_active_border_color, inherit) !important;
    box-shadow: var(--store_cart_button_active_box_shadow, inherit) !important;
    color: var(--store_cart_button_active_color, inherit) !important;
}
.store-widget.store-widget-dropdown button.btn.btn-add-to-cart:hover {
    background-color: var(--store_cart_button_hover_bg_color, inherit) !important;
    border-color: var(--store_cart_button_hover_border_color, inherit) !important;
    box-shadow: var(--store_cart_button_hover_box_shadow, inherit) !important;
    color: var(--store_cart_button_hover_color, inherit) !important;
}
.store-widget.store-widget-dropdown button.btn.btn-add-to-cart:disabled {
    background-color: var(--store_cart_button_disabled_bg_color, inherit) !important;
    border-color: var(--store_cart_button_disabled_border_color, inherit) !important;
    box-shadow: var(--store_cart_button_disabled_box_shadow, inherit) !important;
    color: var(--store_cart_disabled_button_color, inherit) !important;
}

/* Store Widget - Bundle Button */
.store-widget.store-widget-dropdown button.btn.btn-bundle {
    background-color: var(--store_bundle_button_bg_color, inherit) !important;
    border-color: var(--store_bundle_button_border_color, inherit) !important;
    box-shadow: var(--store_bundle_button_box_shadow, inherit) !important;
    color: var(--store_bundle_button_color, inherit) !important;
}
.store-widget.store-widget-dropdown button.btn.btn-bundle:hover:active,
.store-widget.store-widget-dropdown button.btn.btn-bundle:active {
    background-color: var(--store_bundle_button_active_bg_color, inherit) !important;
    border-color: var(--store_bundle_button_active_border_color, inherit) !important;
    box-shadow: var(--store_bundle_button_active_box_shadow, inherit) !important;
    color: var(--store_bundle_button_active_color, inherit) !important;
}
.store-widget.store-widget-dropdown button.btn.btn-bundle:hover {
    background-color: var(--store_bundle_button_hover_bg_color, inherit) !important;
    border-color: var(--store_bundle_button_hover_border_color, inherit) !important;
    box-shadow: var(--store_bundle_button_hover_box_shadow, inherit) !important;
    color: var(--store_bundle_button_hover_color, inherit) !important;
}
.store-widget.store-widget-dropdown button.btn.btn-bundle:disabled {
    background-color: var(--store_bundle_button_disabled_bg_color, inherit) !important;
    border-color: var(--store_bundle_button_disabled_border_color, inherit) !important;
    box-shadow: var(--store_bundle_button_disabled_box_shadow, inherit) !important;
    color: var(--store_bundle_disabled_button_color, inherit) !important;
}

/* Store Widget - Purchased Button */
.store-widget.store-widget-purchased button.btn.btn-purchased {
    background-color: var(--store_purchased_button_bg_color, inherit) !important;
    border-color: var(--store_purchased_button_border_color, inherit) !important;
    box-shadow: var(--store_purchased_button_box_shadow, inherit) !important;
    color: var(--store_purchased_button_color, inherit) !important;
}
.store-widget.store-widget-purchased button.btn.btn-purchased:hover:active
.store-widget.store-widget-purchased button.btn.btn-purchased:active {
    background-color: var(--store_purchased_button_active_bg_color, inherit) !important;
    border-color: var(--store_purchased_button_active_border_color, inherit) !important;
    box-shadow: var(--store_purchased_button_active_box_shadow, inherit) !important;
    color: var(--store_purchased_button_active_color, inherit) !important;
}
.store-widget.store-widget-purchased button.btn.btn-purchased:hover {
    background-color: var(--store_purchased_button_hover_bg_color, inherit) !important;
    border-color: var(--store_purchased_button_hover_border_color, inherit) !important;
    box-shadow: var(--store_purchased_button_hover_box_shadow, inherit) !important;
    color: var(--store_purchased_button_hover_color, inherit) !important;
}
.store-widget.store-widget-purchased button.btn.btn-purchased:disabled {
    background-color: var(--store_purchased_button_disabled_bg_color, inherit) !important;
    border-color: var(--store_purchased_button_disabled_border_color, inherit) !important;
    box-shadow: var(--store_purchased_button_disabled_box_shadow, inherit) !important;
    color: var(--store_purchased_disabled_button_color, inherit) !important;
}

/* Store Widget - Subscribed Button */
.store-widget.store-widget-subscribed button.btn.btn-subscribed {
    background-color: var(--store_subscribed_button_bg_color, inherit) !important;
    border-color: var(--store_subscribed_button_border_color, inherit) !important;
    box-shadow: var(--store_subscribed_button_box_shadow, inherit) !important;
    color: var(--store_subscribed_button_color, inherit) !important;
}
.store-widget.store-widget-subscribed button.btn.btn-subscribed:hover:active
.store-widget.store-widget-subscribed button.btn.btn-subscribed:active {
    background-color: var(--store_subscribed_button_active_bg_color, inherit) !important;
    border-color: var(--store_subscribed_button_active_border_color, inherit) !important;
    box-shadow: var(--store_subscribed_button_active_box_shadow, inherit) !important;
    color: var(--store_subscribed_button_active_color, inherit) !important;
}
.store-widget.store-widget-subscribed button.btn.btn-subscribed:hover {
    background-color: var(--store_subscribed_button_hover_bg_color, inherit) !important;
    border-color: var(--store_subscribed_button_hover_border_color, inherit) !important;
    box-shadow: var(--store_subscribed_button_hover_box_shadow, inherit) !important;
    color: var(--store_subscribed_button_hover_color, inherit) !important;
}
.store-widget.store-widget-subscribed button.btn.btn-subscribed:disabled {
    background-color: var(--store_subscribed_button_disabled_bg_color, inherit) !important;
    border-color: var(--store_subscribed_button_disabled_border_color, inherit) !important;
    box-shadow: var(--store_subscribed_button_disabled_box_shadow, inherit) !important;
    color: var(--store_subscribed_disabled_button_color, inherit) !important;
}

/* 
==========================================================================
                    RESPONSIVE / MEDIA QUERIES 
========================================================================== 
*/

@media (max-width: 600px) {
    .store-success-container {
        margin: 20px 10px;
        padding: 10px;
    }
    
    .store-success-header {
        padding: 30px 15px;
    }
    
    .store-success-header h1 {
        font-size: 22px;
    }
    
    .store-success-details,
    .store-success-actions,
    .store-success-footer {
        padding: 20px 15px;
    }
    
    .store-success-actions {
        flex-direction: column;
    }
    
    .store-success-actions .btn {
        width: 100%;
    }
    
    .store-success-amount {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .store-success-transaction {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Chart container — ensures C3/D3 charts have dimensions before rendering */
.store-chart-container {
    min-height: 300px;
}

/* ==========================================================================
   Store Financial Tables (Revenue Share, Distribution)
   ========================================================================== */

.finance-table {
    width: 100%;
    border-collapse: collapse;
}

.finance-table th,
.finance-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #dee2e6;
}

.finance-table th.number,
.finance-table td.number {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    white-space: nowrap;
}

.finance-table th.text,
.finance-table td.text {
    text-align: left;
}

.finance-table td.number .pos-pad {
    color: transparent;
    user-select: none;
}

.finance-table tr.subtotal {
    background-color: #f8f9fa;
}

.finance-table tr.section-header {
    background-color: #d1ecf1;
}

.finance-table tr.deduction td.number {
    color: #dc3545;
}

.finance-table tr.distribution td.number {
    color: #28a745;
    font-weight: bold;
}
