/**
 * Consolidated CSS for CruelCRM price styling
 * Version: 1.0.2
 */

/* ---------- BASE PRICE BOX STYLING ---------- */

/* Main price box container */
.price-box {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    box-shadow: none;
    clear: both;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Customer-specific styling */
.customer-price-box {
    background: #ffffff;
    border-left: 3px solid #AB8912;
}

/* Box for variations */
.variation-price-box {
    color: #000 !important; /* Ensures text is black */
}

/* Regular price box */
.normal-price-box {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    position: relative !important;
}

/* Smaller regular price for resellers */
.normal-price-box.small-price {
    font-size: 0.85em;
    color: #888;
    padding: 4px 0;
    order: 2; /* Shows regular price second */
}

/* Remove border from last element */
.price-box > div:last-child {
    border-bottom: none;
}

/* Reseller price box */
.reseller-price-box {
    padding: 6px 0;
    margin-top: 0;
    font-size: 1.1em;
    border-bottom: 1px solid #f0f0f0;
    order: 1; /* Shows reseller price first */
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Admin view for reseller price */
.reseller-price-box.admin-view {
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px dashed #ddd !important;
    font-size: 0.9em !important;
    color: #666 !important;
}

/* Price labels */
.price-label {
    display: inline-block;
    font-weight: 500;
    color: #666;
    margin-right: 5px;
}

.reseller-price-label {
    display: inline-block;
    font-weight: 600;
    color: #AB8912;
    margin-right: 5px;
    margin-left: 8px !important;
    font-size: 0.85em !important;
}

.admin-price-section .admin-price-value {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

/* ---------- DISCOUNT STYLING ---------- */

/* Sale price styling */
.price ins, .normal-price-box ins {
    text-decoration: none !important;
    font-weight: 700 !important;
    margin-right: 8px !important;
    margin-left: 0 !important;
    color: #AB8912 !important;
    order: 1 !important;
}

/* Original price styling */
.price del, .normal-price-box del,
.price-box .normal-price-box del,
.customer-price-box .normal-price-box del {
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-weight: normal !important;
    font-size: 0.9em !important;
    margin-left: 8px !important;
    order: 2 !important;
}

/* Ensure text within del is struck through */
del .woocommerce-Price-amount,
del .woocommerce-Price-amount bdi,
del .woocommerce-Price-amount span {
    text-decoration: line-through !important;
}

/* Make price and del display inline */
.price ins, .price del, .normal-price-box ins, .normal-price-box del {
    display: inline-block !important;
}

/* Hide screen reader text */
.screen-reader-text {
    display: none !important;
}

/* Remove decorative elements except strikethrough */
.price ins::before, .price ins::after,
.price del::before,
.normal-price-box ins::before, .normal-price-box ins::after,
.normal-price-box del::before {
    display: none !important;
    content: "" !important;
}

/* Ensure sale price and original price are on the same line */
.price, .normal-price-box {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

/* ---------- TAX DISPLAY ---------- */

/* Position "IVA inclusa" at the end, to the right of the strikethrough price */
.price-box .normal-price-box:after {
    content: " IVA inclusa";
    position: relative !important;
    order: 3 !important;
    margin-left: 5px !important;
    font-size: 0.8em !important;
    color: #666 !important;
    font-weight: normal !important;
}

/* Style for the "+ IVA" text */
.price-box .price-tax-info {
    font-size: 0.75em;
    color: #666;
    font-weight: normal;
    white-space: nowrap;
    display: inline-block !important;
    margin-left: 1px !important;
}

/* Remove strikethrough from "+ IVA" text when inside del tag */
del .price-tax-info {
    text-decoration: none !important;
}

/* Don't show VAT text when explicitly disabled */
.price-box.no-tax-suffix .normal-price-box:after,
.price-box.no-tax-suffix .reseller-price-box:after {
    content: "";
}

/* ---------- ADMIN DISPLAY ---------- */

/* Style for admin notice */
.admin-price-notice {
    font-size: 0.8em !important;
    color: #666 !important;
    font-style: italic !important;
    margin: 5px 0 !important;
    padding: 3px 0 !important;
    border-top: 1px dashed #ddd !important;
    border-bottom: 1px dashed #ddd !important;
    text-align: center !important;
    background-color: #f9f9f9 !important;
}

/* Admin price section */
.admin-price-section .admin-price-value ins {
    text-decoration: none !important;
    font-weight: 700 !important;
    margin-right: 8px !important;
    color: #AB8912 !important;
    order: 1 !important;
}

.admin-price-section .admin-price-value del {
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-weight: normal !important;
    font-size: 0.9em !important;
    margin-left: 8px !important;
    order: 2 !important;
}

/* Reseller price section */
.admin-price-section.reseller-price .admin-price-value ins {
    color: #AB8912 !important;
    font-weight: 600 !important;
}

/* Badge for discounted reseller price */
.admin-price-section.reseller-price .admin-price-value ins:after {
    content: " (scontato)" !important;
    font-size: 0.8em !important;
    color: #AB8912 !important;
    font-weight: normal !important;
    font-style: italic !important;
}

/* ---------- VARIATIONS STYLING ---------- */

/* Price in variations */
.woocommerce-variation-price .price ins {
    display: inline-block !important;
}

.woocommerce-variation-price .price del {
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-size: 0.9em !important;
    margin-left: 8px !important;
}

/* Fix white text in variations */
.woocommerce-variation-price {
    color: #000 !important;
}

.woocommerce-variation-price .price {
    color: #000 !important;
}

.woocommerce-variation-price .price-box * {
    color: inherit !important;
}

.woocommerce-variation-price .reseller-price-label {
    color: #AB8912 !important;
}

.woocommerce-variation-price .price-label {
    color: #666 !important;
}

/* Compatibility with themes */
.oxy-product-price .price {
    display: block;
}

.woocommerce-Price-amount {
    display: inline-block !important;
}

/* ---------- PAGE-SPECIFIC STYLING ---------- */

/* Product pages */
.single-product .price ins {
    font-size: 1.2em !important;
}

.single-product .price del {
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-size: 0.9em !important;
}

.single-product .variations_form .reseller-price-box {
    font-size: 1em;
    padding: 8px 0;
}

.single-product .variations_form .reseller-price-label {
    font-size: 1em;
}

/* Hide duplicate price boxes */
.cruelcrm-configuration-option.selected ~ .price-box.customer-price-box,
.woocommerce-variation-price,
.single_variation .woocommerce-variation-price {
    display: none !important;
}

/* Archive pages */
.products .price-box {
    padding: 8px;
    font-size: 0.9em;
}

.products .price ins {
    font-size: 1em !important;
}

.products .price del {
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-size: 0.85em !important;
}

/* Make the price bold and consistent */
.price-box .woocommerce-Price-amount {
    font-weight: 700 !important;
    font-family: inherit !important;
    font-size: 1.2em !important;
}

/* Style the currency symbol to match */
.price-box .woocommerce-Price-currencySymbol {
    font-weight: 700 !important;
    font-family: inherit !important;
    font-size: 1em !important;
}

/* ---------- CARD PRICE STYLING FOR [card_price] SHORTCODE ---------- */

/* Base style for prices in cards */
.cp-wrapper {
    display: inline-block;
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin: 5px 0;
    line-height: 1.4;
    /* No border */
    /* No colored line on the left */
}

/* Override price-box inside cp-wrapper to remove borders and lines */
.cp-wrapper .price-box,
.cp-wrapper .customer-price-box {
    border: none !important;
    border-left: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Style for VAT information */
.cp-wrapper .cp-tax-info {
    font-size: 0.8em;
    font-weight: normal;
    color: #666;
    margin-left: 2px;
}

/* Style for reseller price */
.cp-wrapper.cp-reseller {
    color: #AB8912;
}

/* Style for discounted price */
.cp-wrapper ins {
    text-decoration: none !important;
    font-weight: 700 !important;
    margin-right: 8px !important;
    color: #AB8912 !important;
}

.cp-wrapper del {
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-weight: normal !important;
    font-size: 0.9em !important;
    margin-left: 8px !important;
}

/* Style for admin view */
.cp-wrapper.cp-admin {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
    /* No left border */
    background-color: #F0F7FF;
}

.cp-wrapper.cp-admin .cp-customer {
    font-size: 0.95em;
}

.cp-wrapper.cp-admin .cp-reseller-price {
    font-size: 0.9em;
    color: #AB8912;
}

/* Theme compatibility */
.products .cp-wrapper {
    font-size: 0.95em;
}

.single-product .cp-wrapper {
    font-size: 1.1em;
}

/* Style for displaying sale price */
.cp-wrapper .cp-price-regular {
    display: inline-block;
}

.cp-wrapper .cp-price-sale {
    display: inline-block;
    color: #AB8912;
    font-weight: 700;
}

/* Currency symbol support */
.cp-wrapper .cp-currency {
    font-weight: inherit;
}

/* VAT information after the euro symbol */
.cp-wrapper .cp-vat-info {
    font-size: 0.75em;
    color: #666;
    font-weight: normal;
    white-space: nowrap;
    display: inline-block !important;
    margin-left: 1px !important;
}

/* Remove strikethrough from price-tax-info in card-price context */
.card-price del .price-tax-info {
    text-decoration: none !important;
}

/* Fix order of prices in card-price shortcode */
.card-price .price-value {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

/* Ensure ins (sale price) comes before del (original price) */
.card-price .price-value ins {
    order: 1 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    margin-right: 8px !important;
    color: #AB8912 !important;
}

.card-price .price-value del {
    order: 2 !important;
    display: inline-block !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-weight: normal !important;
    font-size: 0.9em !important;
    margin-left: 8px !important;
}

/* Hide screen reader text in card-price */
.card-price .screen-reader-text {
    display: none !important;
}

/* ---------- ADMIN VIEW SPECIFIC FIXES ---------- */

/* Fix price order in admin view customer price */
.card-price.admin-view .price-row.customer .price-value {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

/* Ensure correct order for customer prices in admin view */
.card-price.admin-view .price-row.customer ins {
    order: 1 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    margin-right: 8px !important;
}

.card-price.admin-view .price-row.customer del {
    order: 2 !important;
    text-decoration: line-through !important;
    color: #999 !important;
    font-weight: normal !important;
    font-size: 0.9em !important;
}

/* Remove strikethrough from + IVA in reseller price when inside del */
.card-price.admin-view .price-row.reseller del .price-tax-info {
    text-decoration: none !important;
    display: inline !important;
}