/* ==========================================================================
   WOOCOMMERCE OVERRIDES (Mi Cuenta & General)
   ========================================================================== */

/* Contenedor Propio Blindado de Mi Cuenta (Reemplaza a Astra) */
.woocommerce-account .woocommerce,
.woocommerce-account .ast-woo-my-account-wrap {
    display: block !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

/* ==========================================================================
   LAYOUT PARA USUARIOS LOGUEADOS (Navegación Izquierda, Contenido Derecha)
   ========================================================================== */
body.logged-in .woocommerce-account .woocommerce {
    display: flex !important;
    flex-direction: row !important;
    gap: 40px !important;
    align-items: flex-start !important;
    margin-top: 20px !important;
    width: 100% !important;
}

/* En móviles, apilar */
@media (max-width: 768px) {
    body.logged-in .woocommerce-account .woocommerce {
        flex-direction: column !important;
        gap: 24px !important;
    }
}

/* 1. Navegación (Menú Lateral Izquierdo) */
.woocommerce-MyAccount-navigation {
    background: var(--surface) !important;
    border: 1px solid var(--borde) !important;
    border-radius: 12px !important;
    padding: 24px !important;
    flex: 0 0 250px !important;
    max-width: 250px !important;
    width: 250px !important;
}

@media (max-width: 768px) {
    .woocommerce-MyAccount-navigation {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}

.woocommerce-MyAccount-navigation ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important; /* Apilados verticalmente */
    gap: 8px !important;
}

.woocommerce-MyAccount-navigation ul li {
    margin: 0 !important;
    border: none !important;
}

/* Ocultar iconos inyectados por Astra */
.woocommerce-MyAccount-navigation ul li a::before,
.woocommerce-MyAccount-navigation ul li a::after {
    display: none !important;
    content: none !important;
}

.woocommerce-MyAccount-navigation ul li a {
    display: block !important;
    padding: 12px 16px !important;
    color: var(--subtexto) !important;
    background: transparent !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    font-size: 15px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

.woocommerce-MyAccount-navigation ul li a:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--blanco) !important;
}

/* Pestaña Activa */
.woocommerce-MyAccount-navigation ul li.is-active a {
    background: rgba(249,171,0,0.1) !important; /* Fondo sutil acento */
    color: var(--acento) !important;
    border-color: var(--acento) !important;
}

/* Enlace Salir (rojo) */
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout {
    margin-top: 16px !important;
    border-top: 1px solid var(--borde) !important;
    padding-top: 16px !important;
}
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout a {
    color: var(--rojo) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    background: rgba(239, 68, 68, 0.05) !important;
}
.woocommerce-MyAccount-navigation ul li.woocommerce-MyAccount-navigation-link--customer-logout a:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--rojo) !important;
}

/* 2. Área de Contenido */
.woocommerce-MyAccount-content {
    background: var(--surface) !important;
    border: 1px solid var(--borde) !important;
    border-radius: 12px !important;
    padding: 32px !important;
    flex: 1 1 auto !important;
    width: calc(100% - 290px) !important;
    max-width: 100% !important;
    min-width: 0 !important; /* Para evitar desbordamientos en flex */
}

/* --- CAJAS DE LOGIN Y REGISTRO (Lado a lado en Desktop) --- */
body:not(.logged-in) .woocommerce {
    max-width: 900px !important;
    margin: 60px auto !important;
    display: block !important;
}

body:not(.logged-in) .woocommerce > h2 {
    text-align: center !important;
    margin-bottom: 48px !important;
    display: block !important;
    width: 100% !important;
    font-size: 32px !important;
    font-weight: 700 !important;
    color: var(--blanco) !important;
}

/* Contenedor nativo de 2 columnas en WooCommerce (Login) */
#customer_login {
    display: flex !important;
    flex-direction: row !important;
    gap: 48px !important;
    align-items: flex-start !important;
    justify-content: center !important;
    width: 100% !important;
}

/* IMPORTANTÍSIMO: Destruir el clearfix de WooCommerce/Astra porque rompe layouts modernos */
#customer_login::before, #customer_login::after {
    display: none !important;
    content: none !important;
}

@media (max-width: 768px) {
    #customer_login {
        flex-direction: column !important;
        gap: 32px !important;
    }
}

#customer_login .u-column1.col-1,
#customer_login .u-column2.col-2 {
    background: var(--surface) !important;
    border: 1px solid var(--borde) !important;
    border-radius: 12px !important;
    padding: 32px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
    flex: 1 1 0 !important;
    width: 100% !important;
    max-width: 500px !important;
    float: none !important;
    margin: 0 !important;
}

#customer_login .u-column1.col-1 h2,
#customer_login .u-column2.col-2 h2 {
    font-family: 'Epilogue', sans-serif !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin-bottom: 24px !important;
    text-align: left !important;
}

/* ==========================================================================
   FORMULARIOS: OJO DE CONTRASEÑA EN BLANCO
   ========================================================================== */
.woocommerce form .show-password-input,
.woocommerce form .show-password-input::after {
    color: #ffffff !important;
}

/* 3. Formularios Generales (Login, Registro, Editar) */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--borde) !important;
    color: var(--texto) !important;
    padding: 14px 16px !important;
    border-radius: 8px !important;
    font-family: inherit !important;
    font-size: 15px !important;
    transition: border-color 0.3s ease !important;
}

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus {
    border-color: var(--acento) !important;
    outline: none !important;
}

.woocommerce form .form-row label {
    color: var(--subtexto) !important;
    font-size: 14px !important;
    margin-bottom: 8px !important;
    display: block !important;
}

/* Checkboxes (Recuérdame, Privacidad) */
.woocommerce form .form-row input[type="checkbox"] {
    width: auto !important;
    margin-right: 8px !important;
    accent-color: var(--acento) !important;
    cursor: pointer !important;
}
.woocommerce form .form-row label.woocommerce-form__label-for-checkbox {
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    margin-bottom: 0 !important;
}

/* Enlaces pequeños en Login (Contraseña olvidada) */
.woocommerce-LostPassword, .woocommerce-LostPassword a {
    font-size: 13px !important;
    color: var(--acento) !important;
    text-decoration: none !important;
    margin-top: 16px !important;
    display: block !important;
}

/* 4. Tablas (Pedidos, Descargas) */
.woocommerce table.shop_table {
    width: 100% !important;
    border-collapse: collapse !important;
    text-align: left !important;
    font-size: 15px !important;
    border: none !important;
    border-radius: 0 !important;
}

.woocommerce table.shop_table th {
    padding: 16px 8px !important;
    color: var(--blanco) !important;
    font-weight: 600 !important;
    border-bottom: 1px solid var(--borde) !important;
    background: transparent !important;
}

.woocommerce table.shop_table td {
    padding: 16px 8px !important;
    color: var(--subtexto) !important;
    border-bottom: 1px solid var(--borde) !important;
    border-top: none !important;
    background: transparent !important;
}

/* 5. Botones Nativos */
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button {
    background-color: var(--acento) !important;
    color: var(--negro) !important;
    border-radius: 8px !important;
    padding: 14px 28px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    border: none !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    width: 100% !important; /* Forzar 100% ancho en login/registro */
}

.woocommerce button.button:hover,
.woocommerce a.button:hover,
.woocommerce input.button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(249,171,0,0.3) !important;
    background-color: var(--acento) !important;
    color: var(--negro) !important;
}

/* Botón de Registro: Outline (para diferenciarlo del Login) */
.woocommerce form.register button.button {
    background-color: transparent !important;
    color: var(--blanco) !important;
    border: 1px solid var(--borde) !important;
    box-shadow: none !important;
}

.woocommerce form.register button.button:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--borde) !important;
    color: var(--blanco) !important;
    transform: translateY(-2px) !important;
}

/* Mensajes de error/exito nativos de WooCommerce */
.woocommerce-error,
.woocommerce-info,
.woocommerce-message {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--borde) !important;
    color: var(--blanco) !important;
    border-radius: 8px !important;
}
.woocommerce-error {
    border-top: 3px solid var(--rojo) !important;
}
.woocommerce-message {
    border-top: 3px solid var(--verde) !important;
}
.woocommerce-info {
    border-top: 3px solid var(--acento) !important;
}

/* ==========================================================================
   CHECKOUT (Forzado 2 columnas en Desktop)
   ========================================================================== */
.woocommerce-checkout form.checkout {
    display: block !important;
    width: 100% !important;
    float: none !important;
    margin-top: 30px !important;
}

/* Forzar la cuadrícula del Checkout (Igual que en local) */
.checkout-grid {
    display: grid !important;
    grid-template-columns: 3fr 2fr !important;
    gap: 48px !important;
    align-items: start !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
}

.checkout-form-col {
    width: 100% !important;
}

/* Ocultar encabezados nativos basura de WooCommerce */
.woocommerce-checkout .woocommerce-billing-fields h3,
.woocommerce-checkout .woocommerce-additional-fields h3 {
    display: none !important;
}

.woocommerce-checkout #order_review_heading {
    display: none !important;
}

.woocommerce-checkout .checkout-summary-col {
    width: 100% !important;
    position: sticky !important;
    top: 100px !important;
}

.woocommerce-checkout .summary-box {
    background: var(--surface) !important;
    border: 1px solid var(--borde) !important;
    border-radius: 12px !important;
    padding: 32px !important; /* Ajustado padding a 32px como local */
}

.woocommerce-checkout #order_review {
    width: 100% !important;
    float: none !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Ocultar pie de página (Footer) en el checkout */
.woocommerce-checkout footer,
.woocommerce-checkout .ede-footer,
.woocommerce-checkout .site-footer,
.page-template-page-finalizar-compra footer,
.page-template-page-finalizar-compra .ede-footer {
    display: none !important;
}

@media (max-width: 992px) {
    .checkout-grid {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    .woocommerce-checkout .checkout-summary-col {
        position: relative !important;
        top: 0 !important;
    }
}

/* ==========================================================================
   ALIGNMENT WITH LOCAL MOCKUP (Force layout, inputs and table cleanup)
   ========================================================================== */

/* Grid para los campos de Nombre y Apellidos (Lado a lado) */
@media (min-width: 768px) {
  .woocommerce-billing-fields__field-wrapper {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
  }
  .woocommerce-billing-fields__field-wrapper p#billing_email_field {
    grid-column: span 2 !important;
  }
  .woocommerce-billing-fields__field-wrapper p#billing_first_name_field {
    grid-column: span 1 !important;
  }
  .woocommerce-billing-fields__field-wrapper p#billing_last_name_field {
    grid-column: span 1 !important;
  }
}

/* Ajustes de inputs del Checkout */
.woocommerce-billing-fields__field-wrapper p.form-row {
  margin-bottom: 20px !important;
  width: 100% !important;
  float: none !important;
}
.woocommerce-billing-fields__field-wrapper p.form-row label {
  display: block !important;
  font-size: 13px !important;
  color: var(--subtexto) !important;
  margin-bottom: 8px !important;
  font-weight: 500 !important;
}
.woocommerce-billing-fields__field-wrapper p.form-row input.input-text {
  background: var(--surface2) !important;
  border: 1.5px solid var(--borde) !important;
  color: #fff !important;
  padding: 12px 16px !important;
  border-radius: 8px !important;
  width: 100% !important;
  font-size: 14px !important;
  outline: none !important;
  transition: border-color 0.2s ease !important;
}
.woocommerce-billing-fields__field-wrapper p.form-row input.input-text:focus {
  border-color: var(--acento) !important;
}

/* Ocultar cabeceras y filas redundantes en la tabla de WooCommerce */
.woocommerce-checkout-review-order-table thead {
  display: none !important;
}
.woocommerce-checkout-review-order-table tr.cart-subtotal {
  display: none !important;
}
.woocommerce-checkout-review-order-table, 
.woocommerce-checkout-review-order-table th, 
.woocommerce-checkout-review-order-table td {
  border: none !important;
  background: transparent !important;
  padding: 8px 0 !important;
}
.woocommerce-checkout-review-order-table td.product-total {
  text-align: right !important;
  font-family: 'Epilogue', sans-serif;
  font-weight: 700;
  color: var(--acento) !important;
  font-size: 15px;
}
.woocommerce-checkout-review-order-table tr.order-total th {
  font-family: 'Epilogue', sans-serif;
  font-size: 20px !important;
  font-weight: 800 !important;
  color: #fff !important;
  padding-top: 20px !important;
  border-top: 1px solid var(--borde) !important;
}
.woocommerce-checkout-review-order-table tr.order-total td {
  font-family: 'Epilogue', sans-serif;
  font-size: 20px !important;
  font-weight: 800 !important;
  color: var(--acento) !important;
  padding-top: 20px !important;
  border-top: 1px solid var(--borde) !important;
  text-align: right !important;
}

/* Estilar textos legales del checkout de WooCommerce */
.woocommerce-privacy-policy-text, 
.woocommerce-terms-and-conditions-wrapper {
  font-size: 12px !important;
  color: var(--subtexto) !important;
  line-height: 1.5 !important;
  margin-top: 16px !important;
  margin-bottom: 12px !important;
}
.woocommerce-form__label-for-checkbox {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
  cursor: pointer !important;
}
.woocommerce-form__input-checkbox {
  margin-top: 3px !important;
  accent-color: var(--acento) !important;
}

/* Forzar el ancho del checkout a 1080px (igual que local) para todos los usuarios, anulando el límite de 900px */
body.woocommerce-checkout .woocommerce,
body:not(.logged-in).woocommerce-checkout .woocommerce,
.page-template-page-finalizar-compra .woocommerce {
  max-width: 1080px !important;
  margin: 0 auto !important;
  width: 100% !important;
}

/* Ocultar el formulario y banner de cupón nativo de WooCommerce (para evitar anidación) */
.woocommerce-checkout form.checkout_coupon,
.woocommerce-checkout .woocommerce-form-coupon-toggle,
.woocommerce-checkout .woocommerce-info {
  display: none !important;
}

/* Estilar cajetín falso de cupón de descuento */
.checkout_coupon_fake {
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
}
.checkout_coupon_fake input {
  background: var(--surface2) !important;
  border: 1.5px solid var(--borde) !important;
  color: #fff !important;
  padding: 8px 12px !important;
  border-radius: 5px !important;
  width: 100% !important;
  font-size: 13px !important;
  outline: none !important;
  box-sizing: border-box !important;
}
.checkout_coupon_fake button {
  background: var(--acento) !important;
  color: #0a0a0a !important;
  border: none !important;
  font-weight: 700 !important;
  padding: 8px 16px !important;
  border-radius: 5px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  width: auto !important;
  transition: opacity 0.15s !important;
  white-space: nowrap !important;
}
.checkout_coupon_fake button:hover {
  opacity: 0.9 !important;
}

