/**
 * Estilos frontend para Gestión de Envíos B2B/B2C
 *
 * @package Gestion_Envios_B2B
 */

/* ==========================================================================
   Formulario de presupuesto
   ========================================================================== */

.geb2b-quote-form-wrapper {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 1230px !important;
    width: 100% !important;
    box-sizing: border-box;
}

/* =====================================================================
   Checkout Blocks: cuando está activo el modo presupuesto, ocultar
   los campos nativos de WooCommerce para evitar duplicidad.
   ===================================================================== */

body.geb2b-quote-active .wp-block-woocommerce-checkout-payment-block,
body.geb2b-quote-active .wp-block-woocommerce-checkout-actions-block,
body.geb2b-quote-active .wp-block-woocommerce-checkout-express-payment-block,
body.geb2b-quote-active .wc-block-components-checkout-step--payment,
body.geb2b-quote-active .wc-block-checkout__actions,
body.geb2b-quote-active .wc-block-components-checkout-place-order-button,
body.geb2b-quote-active #payment,
body.geb2b-quote-active .woocommerce-checkout-payment,
body.geb2b-quote-active button#place_order,
body.geb2b-quote-active .place-order {
    display: none !important;
}
/* =====================================================================
   Checkout clásico: cuando está activo el modo presupuesto, ocultar
   el bloque de pago y el botón de realizar pedido.
   ===================================================================== */

body.geb2b-quote-active .woocommerce-checkout #payment,
body.geb2b-quote-active .woocommerce-checkout .woocommerce-checkout-payment,
body.geb2b-quote-active .woocommerce-checkout .place-order,
body.geb2b-quote-active .woocommerce-checkout #place_order,
body.geb2b-quote-active .woocommerce-checkout button[name="woocommerce_checkout_place_order"],
body.geb2b-quote-active .woocommerce-checkout .woocommerce-terms-and-conditions-wrapper,
body.geb2b-quote-active .woocommerce-checkout .wc_payment_methods,
body.geb2b-quote-active .woocommerce-checkout .payment_box {
    display: none !important;
}

/* Estilo del aviso dentro del panel */
.geb2b-panel-notice {
    background: #fff3cd !important;
    border-left: 4px solid #ffb700 !important;
    padding: 12px 14px !important;
    margin: 0 0 14px 0 !important;
}
.geb2b-panel-help {
    margin: 0 0 16px 0;
}

/* En el total de envío (Blocks), reemplazar visualmente el valor por
   el texto que inyecta el JS (data-geb2b-shiptext). */
.wc-block-components-totals-item--shipping.geb2b-shipping-total-override .wc-block-components-totals-item__value {
    font-size: 0 !important;
}
.wc-block-components-totals-item--shipping.geb2b-shipping-total-override .wc-block-components-totals-item__value::after {
    content: attr(data-geb2b-shiptext);
    font-size: 14px;
    font-weight: 700;
}


.geb2b-quote-form {
    background: #ffffff;
    padding: 25px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.geb2b-quote-notice {
    background: #e7f3ff;
    border-left: 4px solid #2271b1;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 4px;
}

.geb2b-quote-notice h3 {
    margin-top: 0;
    color: #2271b1;
    font-size: 1.3em;
}

.geb2b-quote-notice p {
    margin: 10px 0;
    line-height: 1.6;
}

.geb2b-reason {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 4px;
    display: inline-block;
}

/* Formulario */
.geb2b-quote-request-form h3 {
    border-bottom: 2px solid #e5e5e5;
    padding-bottom: 10px;
    margin-top: 25px;
    margin-bottom: 20px;
    color: #333;
}

.geb2b-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.geb2b-form-field {
    flex: 1;
    margin-bottom: 15px;
}

.geb2b-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.geb2b-form-field .required {
    color: #d00;
}

.geb2b-form-field input[type="text"],
.geb2b-form-field input[type="email"],
.geb2b-form-field input[type="tel"],
.geb2b-form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.geb2b-form-field input:focus,
.geb2b-form-field textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.geb2b-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.geb2b-form-submit {
    margin-top: 25px;
    text-align: center;
}

.geb2b-form-submit button {
    background-color: #2271b1;
    color: #fff;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.geb2b-form-submit button:hover {
    background-color: #135e96;
}

/* Avisos en carrito y checkout */
.geb2b-checkout-notice {
    background: #fff3cd !important;
    border-left: 4px solid #ffb700 !important;
    padding: 15px !important;
    margin-bottom: 20px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .geb2b-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .geb2b-quote-form-wrapper {
        padding: 15px;
    }
    
    .geb2b-quote-form {
        padding: 15px;
    }
}


/* Spinner en botón */
#geb2b-submit-btn.geb2b-is-loading {
    position: relative;
    opacity: 0.85;
    pointer-events: none;
}
.geb2b-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    /* Forzamos un contraste alto para que el spinner se vea
       incluso si el tema sobreescribe el color del botón. */
    border: 2px solid rgba(255,255,255,0.85);
    border-right-color: transparent;
    border-radius: 50%;
    animation: geb2b-spin 0.8s linear infinite;
}
@keyframes geb2b-spin { to { transform: rotate(360deg); } }

/* Nota de envío en Checkout Blocks */
.geb2b-shipping-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-left: 4px solid #cc0000;
    background: #fff5f5;
    font-size: 14px;
}


/* ==========================================================================
   Panel simplificado (Checkout uses Woo fields)
   ========================================================================== */
.geb2b-quote-panel{
  width:100%;
  max-width:1230px;
  margin: 24px auto 40px;
  padding: 0 16px;
  box-sizing:border-box;
}
.geb2b-quote-panel__inner{
  background:#fff;
  border:1px solid #e5e5e5;
  border-left:4px solid #1e73be;
  padding:18px 18px 22px;
}
.geb2b-quote-panel h3{
  margin:0 0 6px;
}
.geb2b-quote-badge{
  display:inline-block;
  margin:10px 0 16px;
  padding:10px 12px;
  background:#d8f0d8;
  border:1px solid #b7e3b7;
  border-radius:3px;
  color:#1f6b1f;
  font-weight:600;
}
.geb2b-label{
  display:block;
  font-weight:600;
  margin: 10px 0 6px;
}
.geb2b-textarea{
  width:100%;
  box-sizing:border-box;
  border:1px solid #ccc;
  border-radius:3px;
  padding:10px 12px;
}
.geb2b-btn{
  margin-top:16px;
  background:#e40000;
  color:#fff;
  border:none;
  padding:14px 18px;
  font-weight:700;
  letter-spacing:0.5px;
  text-transform:uppercase;
  cursor:pointer;
  width: 280px;
  max-width:100%;
  position:relative;
}
.geb2b-btn.is-loading{
  opacity:0.85;
  cursor:wait;
}
.geb2b-spinner{
  display:none;
  width:16px;
  height:16px;
  border:2px solid rgba(255,255,255,0.35);
  border-top-color:#fff;
  border-radius:50%;
  animation:geb2bspin 0.8s linear infinite;
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
}
.geb2b-btn.is-loading .geb2b-spinner{
  display:inline-block;
}
@keyframes geb2bspin{ to { transform:translateY(-50%) rotate(360deg); } }

.geb2b-quote-msg{
  margin-top:12px;
  padding:10px 12px;
  border-radius:3px;
}
.geb2b-quote-msg.is-ok{ background:#eef9ee; border:1px solid #b7e3b7; color:#1f6b1f; }
.geb2b-quote-msg.is-err{ background:#fde8e8; border:1px solid #f1b2b2; color:#a10000; }

/* Ocultar pagos cuando está activo (refuerzo CSS contra re-render blocks) */
body.geb2b-quote-active .wp-block-woocommerce-checkout-payment-block,
body.geb2b-quote-active .wp-block-woocommerce-checkout-actions-block,
body.geb2b-quote-active .wp-block-woocommerce-checkout-express-payment-block,
body.geb2b-quote-active .wc-block-checkout__payment-method,
body.geb2b-quote-active .wc-block-checkout__actions,
body.geb2b-quote-active .wc-block-components-checkout-place-order-button{
  display:none !important;
}
