/**
 * Petmarket+ — Estilos frontend
 *
 * Estilos mínimos con clases BEM para que el equipo de frontend
 * los personalice según el diseño del sitio.
 *
 * Clases disponibles:
 *   .pmplus-petcash-message   – Mensaje Petcash en PDP
 *   .pmplus-petcash-message.pmplus-member    – Estado miembro activo
 *   .pmplus-petcash-message.pmplus-prospect  – Estado no miembro
 *   .pmplus-member-badge      – Badge en Mi Cuenta y Checkout
 *   .pmplus-badge-icon        – El símbolo "+"
 *   .pmplus-badge-label       – El texto "Petmarket+"
 *   .pmplus-badge-desc        – El subtexto "Membresía activa"
 *
 * v2.0:
 *   .pmplus-petcash-earn-checkout  – Mensaje "ganarás X Petcash" en checkout
 *   .pmplus-petcash-redeem         – Formulario de redención (tiene saldo)
 *   .pmplus-petcash-applied        – Estado Petcash aplicado
 *   .pmplus-petcash-frozen         – Estado saldo congelado
 *   .pmplus-petcash-blocked        – Estado bloqueado (cupón externo)
 *   .pmplus-petcash-redeem-form    – Form inline
 *   .pmplus-petcash-remove         – Link quitar
 *   .pmplus-item-petcash           – Petcash por item en carrito/checkout
 *   .pmplus-shipping-notice        – Aviso shipping Petmarket+
 */

/* Global: todos los textos del plugin usan Nunito */
[class*="pmplus-"],
.pmplus-cart-petcash-notice {
    font-family: "Nunito", Sans-serif;
}

/* -----------------------------------------------------------------
   Mensaje Petcash en la ficha de producto (PDP)
   ----------------------------------------------------------------- */

.pmplus-petcash-message {
    display: inline-block;
    width: 100%;
    margin-bottom: 16px;
    border: 1px dashed #2e9b47;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    font-weight: 600;
    color: #2e9b47;
}

.pmplus-petcash-message .woocommerce-Price-amount,
.pmplus-petcash-message bdi {
    display: inline;
}

.pmplus-petcash-message.pmplus-member {
    border-color: #2e9b47;
    color: #2e9b47;
}

.pmplus-petcash-message.pmplus-prospect {
    border-color: #dc4614;
    color: #dc4614;
}

/* -----------------------------------------------------------------
   Upsell membresía Petmarket+ en PDP
   ----------------------------------------------------------------- */

.pmplus-membership-upsell {
    margin: 8px 0 16px;
}

.pmplus-membership-upsell-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.2s, background 0.2s;
}

.pmplus-membership-upsell-label:hover {
    border-color: #2e9b47;
    background: #f6fff8;
}

.pmplus-membership-upsell-input {
    margin: 0;
    cursor: pointer;
}

.pmplus-membership-upsell-input:checked + .pmplus-membership-upsell-content {
    color: #1a6b2f;
}

.pmplus-membership-upsell-label:has(.pmplus-membership-upsell-input:checked) {
    border-color: #2e9b47;
    background: #f6fff8;
}

.pmplus-membership-upsell-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pmplus-membership-upsell-title {
    font-weight: 700;
    font-size: 0.95em;
    color: #333;
}

.pmplus-membership-upsell-price {
    font-size: 0.88em;
    color: #555;
}

.pmplus-membership-upsell-price .woocommerce-Price-amount,
.pmplus-membership-upsell-price bdi {
    display: inline;
}

.pmplus-petcash-message * {
    display: inline;
    white-space: nowrap;
}

/* -----------------------------------------------------------------
   Badge "Petmarket+" en Mi Cuenta y Checkout
   ----------------------------------------------------------------- */

.pmplus-member-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 6px 14px 6px 10px;
    background: linear-gradient(135deg, #1a6b2f 0%, #2e9b47 100%);
    color: #ffffff;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3);
    text-decoration: none;
}

.pmplus-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 1em;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.pmplus-badge-label {
    font-size: 0.95em;
}

.pmplus-badge-desc {
    font-size: 0.78em;
    opacity: 0.85;
    font-weight: 400;
}

/* Separador visual entre label y desc */
.pmplus-badge-label::after {
    content: "·";
    margin: 0 4px;
    opacity: 0.6;
}

/* -----------------------------------------------------------------
   Petcash por item en carrito/checkout
   ----------------------------------------------------------------- */

.pmplus-item-petcash {
    display: block;
    margin-top: 0;
    color: #2e7d32;
    font-size: 0.70em;
    font-weight: 700;
}

/* -----------------------------------------------------------------
   Aviso shipping Petmarket+ en checkout
   ----------------------------------------------------------------- */

.pmplus-shipping-notice-wrap {
    margin-top: 2px;
    margin-bottom: 4px;
}

.pmplus-shipping-notice {
    display: inline-block;
    color: #2e7d32;
    font-size: 0.82em;
    font-weight: 500;
    font-style: italic;
}

/* -----------------------------------------------------------------
   Mensaje "ganarás X Petcash" en checkout/carrito
   ----------------------------------------------------------------- */

.pmplus-petcash-earn-checkout {
    color: #1b5e20;
    font-size: 1em;
}

.pmplus-petcash-earn-checkout .pmplus-petcash-icon {
    margin-right: 5px;
}

/* -----------------------------------------------------------------
   Formulario de redención Petcash en checkout/carrito
   ----------------------------------------------------------------- */

.pmplus-petcash-redeem {
    margin-bottom: 32px;
}

.pmplus-petcash-redeem .pmplus-petcash-message,
.pmplus-petcash-redeem .pmplus-petcash-message * {
    white-space: normal !important;
}

.pmplus-petcash-redeem p {
    margin: 0 0 8px;
}

.pmplus-petcash-redeem-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pmplus-petcash-redeem-form label {
    font-weight: 500;
    font-size: 0.9em;
    white-space: nowrap;
}

.pmplus-petcash-redeem-form input[type="number"] {
    width: 120px;
    padding: 5px 8px;
    border: 1px solid #90caf9;
    border-radius: 3px;
    font-size: 0.95em;
}

.pmplus-petcash-redeem-form .button {
    padding: 5px 14px;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Botón CTA "Usar mis PETCASH" */
.pmplus-petcash-open-modal {
    display: inline-block;
    background: #4739a0;
    border: 1px solid #4739a0;
    color: #fff;
    line-height: 32px;
    border-radius: 99px;
    padding: 0 32px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.25px;
}

.pmplus-petcash-open-modal:hover {
    background: #ed6436;
    border-color: #ed6436;
}

/* -----------------------------------------------------------------
   Modal Petcash
   ----------------------------------------------------------------- */

.pmplus-petcash-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pmplus-petcash-modal {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.pmplus-petcash-modal h3 {
    line-height: 24px;
    margin: 0 0 16px !important;
    font-size: 20px !important;
    font-weight: 700;
    color: #333;
    text-align: center;
}

.pmplus-petcash-modal-body {
    margin-bottom: 20px;
    text-align: center;
}

.pmplus-petcash-modal-input {
    width: 100% !important;
    padding: 10px 14px !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    font-size: 1.2em !important;
    text-align: center;
    font-weight: 700;
}

.pmplus-petcash-modal-input:focus {
    border-color: #2e9b47 !important;
    outline: none;
}

.pmplus-petcash-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.pmplus-petcash-modal-cancel {
    background: #eee !important;
    color: #333 !important;
    border: none !important;
    padding: 10px 24px !important;
    border-radius: 6px !important;
    font-weight: 600;
    cursor: pointer;
}

.pmplus-petcash-modal-cancel:hover {
    background: #ddd !important;
}

.pmplus-petcash-modal-accept {
    background: #2e9b47 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 24px !important;
    border-radius: 6px !important;
    font-weight: 700;
    cursor: pointer;
}

.pmplus-petcash-modal-accept:hover {
    background: #1a6b2f !important;
}

/* -----------------------------------------------------------------
   Estado: Petcash aplicado
   ----------------------------------------------------------------- */

.pmplus-petcash-applied {
    margin-bottom: 32px;
}

.pmplus-petcash-applied p {
    margin: 0;
    display: inline;
}



/* -----------------------------------------------------------------
   Aviso Petcash en carrito
   ----------------------------------------------------------------- */

.pmplus-cart-petcash-notice {
    font-weight: 600;
}

.pmplus-cart-petcash-notice strong {
    font-weight: 900;
}

/* -----------------------------------------------------------------
   Totales periódicos organizados en carrito/checkout
   ----------------------------------------------------------------- */

.pmplus-recurring-totals,
.pmplus-recurring-totals * {
    color: #333 !important;
    padding: 0;
}

.pmplus-recurring-totals {
    padding: 16px 0 0 !important;
}

.pmplus-recurring-totals-heading {
    font-weight: 700;
    font-size: 1.05em;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
}

.pmplus-recurring-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

.pmplus-recurring-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
}

.pmplus-recurring-label {
    font-weight: 600;
    color: #333;
}

.pmplus-recurring-value {
    text-align: right;
}

.pmplus-first-renewal {
    margin-top: 4px;
}

.pmplus-first-renewal small {
    color: #666;
    font-style: italic;
}

.pmplus-recurring-item .includes_tax {
    color: #666;
}

/* -----------------------------------------------------------------
   Estado: Petcash congelado (membresía inactiva)
   ----------------------------------------------------------------- */

.pmplus-petcash-frozen-checkout {
    margin-bottom: 16px;
    color: #1b5e20;
    font-size: 1em;
}
.pmplus-petcash-frozen-checkout .pmplus-frozen-inner {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px !important;
    box-sizing: border-box;
}
.pmplus-petcash-frozen-checkout .pmplus-frozen-inner,
.pmplus-petcash-frozen-checkout .pmplus-frozen-inner *  {
    white-space: normal !important;
}
.pmplus-petcash-frozen-checkout .pmplus-frozen-text {
    flex: 1;
    min-width: 0;
    display: block !important;
    line-height: 1.4;
    text-align: left;
}
.pmplus-petcash-frozen-checkout .pmplus-frozen-text span,
.pmplus-petcash-frozen-checkout .pmplus-frozen-text small {
    display: inline !important;
}
.pmplus-petcash-frozen-checkout .pmplus-frozen-text small {
    display: block !important;
}
.pmplus-petcash-frozen-checkout .pmplus-renew-membership-btn {
    flex-shrink: 0;
}
.pmplus-renew-membership-btn,
.pmplus-petcash-open-modal-style {
    display: inline-block;
    line-height: 32px;
    padding: 0 32px;
    background: #4739a0;
    color: #fff !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 99px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}
.pmplus-renew-membership-btn:hover,
.pmplus-petcash-open-modal-style:hover {
    background: #ed6436;
    color: #fff !important;
}

/* -----------------------------------------------------------------
   Estado: Petcash bloqueado (cupón externo activo)
   ----------------------------------------------------------------- */

.pmplus-petcash-blocked {
    margin-bottom: 16px;
    padding: 10px 14px;
    background-color: #fce4ec;
    border: 1px solid #f8bbd0;
    border-left: 3px solid #c62828;
    border-radius: 4px;
    color: #b71c1c;
    font-size: 0.9em;
}

.pmplus-petcash-blocked p {
    margin: 0;
}

/* -----------------------------------------------------------------
   Columna PM+ en el admin (listado de productos)
   ----------------------------------------------------------------- */

.column-pmplus_petcash {
    width: 48px;
    text-align: center !important;
}

/* -----------------------------------------------------------------
   Página "Mis Petcash" en Mi Cuenta
   ----------------------------------------------------------------- */

.pmplus-petcash-balance-card {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #1a6b2f 0%, #2e9b47 100%);
    border-radius: 8px;
    color: #ffffff;
    text-align: center;
}

.pmplus-petcash-balance-card h3 {
    margin: 0 0 8px;
    color: #ffffff;
    font-size: 0.95em;
    font-weight: 400;
    opacity: 0.9;
}

.pmplus-petcash-balance-amount {
    font-size: 2em;
    font-weight: 700;
    line-height: 1.2;
}

.pmplus-petcash-balance-amount .woocommerce-Price-amount {
    color: #ffffff;
}

.pmplus-petcash-active-note {
    margin: 10px 0 0;
    font-size: 0.85em;
    opacity: 0.85;
}

.pmplus-petcash-frozen-note {
    margin: 10px 0 0;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-size: 0.85em;
}

.pmplus-petcash-log-table {
    width: 100%;
    margin-top: 12px;
}

.pmplus-amount-positive {
    color: #2e7d32;
    font-weight: 600;
}

.pmplus-amount-negative {
    color: #c62828;
    font-weight: 600;
}

/* -----------------------------------------------------------------
   Badge "PM PLUS" en header
   ----------------------------------------------------------------- */

.block-top-link {
    display: flex;
    align-items: center;
}

.pmplus-header-badge {
    display: inline-flex;
    align-items: center;
    margin-right: 24px;
}

.pmplus-header-badge img {
    height: 30px;
    width: auto;
}


/* -----------------------------------------------------------------
   Tipografía producto en carrito/checkout
   ----------------------------------------------------------------- */

.woocommerce-checkout .product-total {
    text-align: right;
}

.woocommerce-checkout .product-total .woocommerce-Price-amount,
.woocommerce-cart .product-subtotal .woocommerce-Price-amount {
    font-weight: 700;
}

.woocommerce-checkout .subscription-details,
.woocommerce-cart .subscription-details {
    color: #666666 !important;
}

.checkout .woocommerce-checkout-review-order .product-total .subscription-price {
    font-size: 14px !important;
}

.checkout .woocommerce-checkout-review-order .product-total .subscription-price .subscription-details {
    font-size: 10px !important;
    display: block;
    margin-top: 4px;
}

.header-right,
.header-right *:not(i):not([class*="icon"]):not([class*="wpb-icon"]) {
    font-family: Nunito, sans-serif !important;
}

.woocommerce-checkout .product-quantity,
.woocommerce-cart .product-quantity {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 900 !important;
}

.woocommerce-checkout .pmplus-recurring-totals {
    display: none !important;
}

.woocommerce-checkout .cart-discount[class*="petcash"],
.woocommerce-cart .cart-discount[class*="petcash"] {
    margin-bottom: 16px;
}

.woocommerce-checkout .cart-discount[class*="petcash"] div:last-child,
.woocommerce-cart .cart-discount[class*="petcash"] div:last-child {
    text-align: right !important;
}

div[class*="petcash"] .woocommerce-remove-coupon,
.cart-discount[class*="petcash"] .woocommerce-remove-coupon,
div[class*="petcash"] a[data-coupon*="petcash"] {
    display: none !important;
}

.woocommerce-cart .product-name,
.woocommerce-cart .product-name a,
.woocommerce-checkout .product-name,
.woocommerce-checkout .product-name a,
.woocommerce-cart .product-subtotal,
.woocommerce-cart .product-subtotal *,
.woocommerce-cart .product-price,
.woocommerce-cart .product-price *,
.woocommerce-checkout .product-total,
.woocommerce-checkout .product-total *,
.woocommerce-cart .woocommerce-Price-amount,
.woocommerce-checkout .woocommerce-Price-amount {
    font-family: Nunito, sans-serif !important;
}

/* -----------------------------------------------------------------
   Override checkout-top spacing
   ----------------------------------------------------------------- */

.checkout-top {
    margin: -40px -15px 16px;
}

/* -----------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------- */

@media (max-width: 480px) {
    .pmplus-member-badge {
        display: flex;
        width: 100%;
        justify-content: center;
        border-radius: 8px;
    }

    .pmplus-petcash-redeem-form {
        flex-direction: column;
        align-items: stretch;
    }

    .pmplus-petcash-redeem .pmplus-petcash-message {
        flex-direction: column !important;
        align-items: flex-start !important;
        font-size: 0.9em;
    }

    .pmplus-petcash-redeem-form input[type="number"] {
        width: 100%;
    }

    .pmplus-petcash-frozen-checkout .pmplus-frozen-inner {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* -----------------------------------------------------------------
   Badge Petmarket+ en loops / carruseles de productos
   ----------------------------------------------------------------- */

.pmplus-loop-badge {
    display: block;
    width: 100%;
    text-align: left;
    margin: 6px 0 8px;
    line-height: 0;
}

.pmplus-loop-badge img {
    display: inline-block;
    width: 46px;
    height: auto;
}

.pmplus-loop-badge--locked {
    line-height: 1;
}

.pmplus-lock-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px 0 8px;
    background: #2c9b46;
    color: #ffffff;
    border-radius: 20px;
    box-sizing: border-box;
}

.pmplus-lock-circle svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.pmplus-lock-text {
    font-family: 'Nunito', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: 12px;
    color: #ffffff;
    white-space: nowrap;
    line-height: 1;
    padding: 2px 0 0 0;
}

/* -----------------------------------------------------------------
   Upsell membresía Petmarket+ en PDP — ocultar en sticky bar
   ----------------------------------------------------------------- */

.sticky-product .pmplus-membership-upsell,
.sticky-product .pmplus-petcash-message {
    display: none !important;
}
