/* =======================
   ESTILOS SENDU WELCOME
   ======================= */

.sendu-container {
  font-family: Arial, sans-serif;
  margin: 60px auto 20px auto;
  padding: 20px;
  background-color: #f7f9fc;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,.1);
  max-width: 800px;
}

.sendu-header { text-align: center; margin-bottom: 20px; }

.sendu-logo-wrapper {
  background-color: #ffffff;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  display: inline-block;
  padding: 30px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.sendu-logo { max-width: 120px; height: auto; }

.sendu-header h1 { font-size: 24px; color: #333; }

.sendu-description, .sendu-plugin-info {
  font-size: 16px; line-height: 1.5; color: #555; margin: 10px 0; text-align: center;
}

.sendu-links { text-align: center; margin-top: 20px; }

.sendu-button {
  display: inline-block; padding: 10px 20px; font-size: 16px; color: #fff;
  background-color: #0073aa; text-decoration: none; border-radius: 5px; margin: 5px;
  transition: background-color .3s ease;
}
.sendu-button:hover { background-color: #005885; }


/* =======================
   TABLA DE LOGS
   ======================= */

.widefat {
  width: 100%; border-collapse: collapse; margin-top: 20px; font-family: Arial, sans-serif;
  font-size: 14px; background-color: #f9f9f9; border: 1px solid #ddd;
}
.widefat th {
  background-color: #0073aa; color: #fff; padding: 10px; text-align: left; border: 1px solid #ddd;
  white-space: nowrap;
}
.widefat td { padding: 8px; border: 1px solid #ddd; vertical-align: top; word-break: break-word; }
.widefat tbody tr:nth-child(odd) { background-color: #f1f1f1; }
.widefat tbody tr:nth-child(even) { background-color: #fff; }
.widefat th:first-child, .widefat td:first-child { width: 180px; white-space: nowrap; }
.widefat tbody tr { height: auto; }
.widefat tbody tr:hover { background-color: #eaf2f8; }


/* =======================
   AJUSTES (admin)
   ======================= */

.woocommerce .form-table th { font-size: 16px; font-weight: bold; padding-bottom: 10px; }
.woocommerce .form-table td { padding: 10px 20px; padding-left: 40px; }

.sendu-container input[type="text"],
.sendu-container input[type="email"],
.sendu-container input[type="number"]{
  width: 70% !important; max-width: 300px !important; padding: 8px; border: 1px solid #ccc;
  border-radius: 5px; font-size: 14px;
}

.woocommerce .form-table .form-field-title{
  font-size: 18px; font-weight: bold; margin-bottom: 10px; padding-left: 0;
}
.woocommerce .form-table td p{
  font-size: 12px; color: #666; margin: 5px 0 0 40px;
}


/* =======================================================
   ESTILOS SENDU CHECKOUT (MÉTODOS DE ENVÍO)
   ======================================================= */

   /* Forzar visualmente el radio seleccionado cuando hay solo una opción (li.selected) */
  .woocommerce-shipping-methods li.selected label::before {
    background-color: #0073aa;
    border-color: #0073aa;
    box-shadow: inset 0 0 0 3px #fff;
  }
  
   .woocommerce-shipping-methods li.sendu-li-ready {
  margin-bottom: 12px !important;
  border: 2px solid #e1e5e9 !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  background-color: var(--sendu-bg, #ffffff) !important;
  transition: all 0.3s ease !important;
  position: relative !important;
  min-height: 60px !important;
  min-width: 200px !important;
  max-width: 100% !important;
  width: 100% !important;
  display: flex !important;
  align-items: flex-start !important;
  color: var(--sendu-text, #2c3e50) !important;
}
/* Evita que WooCommerce nativamente desplace el contenido del método de envío */
.woocommerce-shipping-methods li.sendu-li-ready {
  text-indent: 0 !important;
}


/* Lista principal */
.woocommerce-shipping-methods{
  margin: 0; padding: 0; list-style: none; background-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: flex-end;   /* pega los <li> al borde derecho */
  width: auto;             /* en vez de ocupar todo el ancho */
  max-width: 100%;
  box-sizing: border-box;
}


/* Cada <li> como tarjeta */
.woocommerce-checkout .woocommerce-shipping-methods li,
.woocommerce .woocommerce-shipping-methods li,
body.woocommerce-checkout .woocommerce-shipping-methods li,
#payment .woocommerce-shipping-methods li{
  margin-bottom: 12px !important;
  margin-left: auto;
  margin-right: 0;
  border: 2px solid #e1e5e9 !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  background-color: var(--sendu-bg, #ffffff) !important;
  color: var(--sendu-text, #2c3e50) !important;
  transition: all .3s ease !important;
  position: relative !important;
  min-height: 60px !important;
  min-width: 200px !important;
  width: 100% !important; /* (checkout) */
  max-width: 100% !important;
  display: flex !important;            /* radio + label */
  align-items: flex-start !important;  /* evita pisadas verticales */
  box-sizing: border-box;
}

/* Hover y seleccionado */
.woocommerce-shipping-methods li:hover{
  border-color: #0073aa; box-shadow: 0 2px 8px rgba(0,115,170,.1);
}
.woocommerce-shipping-methods li.selected,
.woocommerce-shipping-methods li:has(input:checked){
  border-color: #0073aa !important;
  background-color: #f8fffe !important;
  box-shadow: 0 2px 12px rgba(0,115,170,.15) !important;
}

/* Input radio nativo oculto */
.woocommerce-shipping-methods input[type="radio"]{
  position: absolute; opacity: 0; width: 0; height: 0;
}

/* Círculo custom previo al contenido */
.woocommerce-shipping-methods label::before{
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid #ddd; border-radius: 50%;
  background-color: #fff; transition: all .2s ease;
  align-self: center !important;
  flex: 0 0 18px;
  margin-right: 0;
  margin-top: 0 !important;
}

/* Estado checked */
.woocommerce-shipping-methods input:checked + label::before{
  background-color: #0073aa; border-color: #0073aa; box-shadow: inset 0 0 0 3px #fff;
}

/* El LABEL es el contenedor principal */
.woocommerce-shipping-methods label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;  /* ← centrado vertical */
  justify-content: space-between !important;  /* ← separa checkbox y contenido */
  gap: 12px;
  width: 100%;
  cursor: pointer;
  font-size: 15px !important;
  font-weight: 500;
  color: #2c3e50;
  margin: 0 !important;
  padding: 0;
  position: relative;
  min-height: 60px;
  min-width: 0;
}


/* Bloque creado por JS */
.sendu-shipping-option {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}


.sendu-shipping-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}


.sendu-custom-label{ /* === NEW === */
  font-weight: 600;
  line-height: 1.25;
  min-width: 0;
}
.sendu-courier-logo{ max-height: 24px; width: auto; object-fit: contain; }
.sendu-delivery-date{
  line-height: 1.25; margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sendu-delivery-date .woocommerce-Price-amount,
.sendu-delivery-date .woocommerce-Price-currencySymbol {
  color: inherit !important;
  font-weight: normal !important;
  font-size: inherit !important;
}

/* Precio */
.woocommerce-shipping-methods .woocommerce-Price-amount{
  margin-left: 6px !important;
  font-weight: normal !important;
  color: inherit !important;
  font-size: inherit !important;
  white-space: normal !important;
}
.woocommerce-shipping-methods .woocommerce-Price-currencySymbol{ font-weight: 600; }

/* Transiciones */
.woocommerce-shipping-methods *{
  transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

/* Overrides tablas */
.woocommerce-shipping-methods table,
.woocommerce-shipping-methods tbody,
.woocommerce-shipping-methods tr,
.woocommerce-shipping-methods td{
  display: block !important; 
  width: 100% !important; 
  border: none !important;
  padding: 0 !important; 
  margin: 0 !important; 
  background: transparent !important;
}


/* === NEW: WooCommerce Blocks compatibilidad === */
.wc-block-components-totals-item[data-testid="cart-shipping"]{
  display: grid !important;
  grid-template-columns: 30% 70% !important;
}
.wc-block-components-totals-item__label,
.wc-block-components-totals-item__value{
  min-width: 0 !important;
}

/* === NEW: li marcados por JS === */
.woocommerce-shipping-methods li.sendu-li-ready{
  box-sizing: border-box;
}

/* =======================
   RESPONSIVE
   ======================= */

@media (max-width: 768px){
  .woocommerce-checkout .woocommerce-shipping-methods li,
  .woocommerce .woocommerce-shipping-methods li,
  body.woocommerce-checkout .woocommerce-shipping-methods li,
  #payment .woocommerce-shipping-methods li{
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
    min-height: 60px !important;
    min-width: 200px !important;
  }

  .woocommerce-shipping-methods label{
    font-size: 14px !important;
    min-height: 50px;
    padding: 4px 6px;
    gap: 10px;
  }
  .sendu-shipping-option{ gap: 8px; }

}

@media (max-width: 480px){
  .woocommerce-checkout .woocommerce-shipping-methods li,
  .woocommerce .woocommerce-shipping-methods li,
  body.woocommerce-checkout .woocommerce-shipping-methods li,
  #payment .woocommerce-shipping-methods li{
    min-width: 180px !important;
    min-height: 55px !important;
    padding: 8px 12px !important;
  }

  .shop_table.woocommerce-checkout-review-order-table tfoot tr.woocommerce-shipping-totals.shipping > th,
  .shop_table.woocommerce-checkout-review-order-table tfoot tr.woocommerce-shipping-totals.shipping > td{
    width: 100% !important;
    display: block !important;
  }
}
