/* FIX 17.1 — Restauración global de la estructura WooCommerce */

/* El marco principal del tema nunca debe ser limitado por reglas de plugins. */
body.tc-wc-unified-frame,
body.tc-wc-unified-frame #page,
body.tc-wc-unified-frame .site,
body.tc-wc-unified-frame main {
  width:100%;
  max-width:none;
  margin:0;
}

body.tc-wc-unified-frame .tc-site-header,
body.tc-wc-unified-frame .tc-site-footer {
  width:100%;
  max-width:none;
  margin-left:0;
  margin-right:0;
  flex:none;
}

body.tc-wc-unified-frame .tc-site-header {
  position:sticky;
  top:0;
  z-index:50;
}

/* Páginas operativas renderizadas por page.php: carrito, checkout y cuenta. */
.tc-wc-page-shell {
  width:100%;
  min-width:0;
  background:var(--tc-cc-bg,var(--tc-body-bg,#f8fafc));
}

.tc-wc-page-container {
  width:min(var(--tc-cc-max,1400px),calc(100% - 48px));
  max-width:1400px;
  margin:0 auto;
  padding:var(--tc-cc-py,64px) 0;
}

.tc-wc-page-entry,
.tc-wc-page-content,
.tc-wc-page-content > .woocommerce,
.tc-wc-page-content > .wp-block-woocommerce-cart,
.tc-wc-page-content > .wp-block-woocommerce-checkout {
  width:100%;
  max-width:none;
  min-width:0;
  margin:0;
}

/* Producto y endpoints controlados por el template loader de WooCommerce. */
.tc-wc-global-shell {
  width:100%;
  min-width:0;
  background:var(--tc-body-bg,#f8fafc);
}

.tc-wc-global-container {
  width:min(1400px,calc(100% - 48px));
  margin:0 auto;
  padding:64px 0 84px;
  min-width:0;
}

.tc-wc-global-container > .woocommerce,
.tc-wc-global-container .woocommerce-notices-wrapper,
.tc-wc-global-container div.product {
  width:100%;
  max-width:none;
  min-width:0;
}

/* La tienda conserva su shell propio, pero sin wrappers heredados. */
.tc-wc-shop-page .tc-shop-page-shell,
.tc-wc-shop-page .tc-shop-container {
  width:100%;
  min-width:0;
}

.tc-wc-shop-page .tc-shop-container {
  max-width:var(--tc-shop-max,1400px);
  margin-left:auto;
  margin-right:auto;
}

/* Neutraliza límites frecuentes de temas/plugins sobre el contenido WC. */
body.tc-wc-unified-frame :where(.site-content,.content-area,.site-main,.entry-content,.wp-site-blocks) {
  max-width:none;
}

body.tc-wc-unified-frame :where(.woocommerce,.woocommerce-page) {
  box-sizing:border-box;
}

body.tc-wc-unified-frame :where(.woocommerce *, .woocommerce-page *) {
  box-sizing:border-box;
}

/* Evita que la capa de carrito vuelva a reducir el <main> global. */
.tc-wc-cart-page main,
.tc-wc-checkout-page main,
.tc-wc-order-received main,
.tc-wc-account-page main {
  width:100%;
  max-width:none;
  margin:0;
  padding:0;
}

.tc-wc-cart-page .tc-wc-page-container,
.tc-wc-checkout-page .tc-wc-page-container,
.tc-wc-order-received .tc-wc-page-container {
  width:min(var(--tc-cc-max,1400px),calc(100% - 48px));
  max-width:1400px;
}

.tc-wc-account-page .tc-wc-page-shell {
  background:var(--tc-account-page,var(--tc-body-bg,#f8fafc));
}

.tc-wc-account-page .tc-wc-page-container {
  width:min(var(--tc-account-max,1280px),calc(100% - 48px));
  max-width:1400px;
}

/* Bloques modernos: no heredan límites estrechos del contenido editorial. */
.tc-wc-page-content .wc-block-cart,
.tc-wc-page-content .wc-block-checkout,
.tc-wc-page-content .wc-block-components-sidebar-layout {
  width:100%;
  max-width:none;
}

/* Footer siempre separado del contenido y con su geometría original. */
body.tc-wc-unified-frame .tc-site-footer {
  clear:both;
  position:relative;
  z-index:1;
}

@media (max-width:1023px) {
  .tc-wc-page-container,
  .tc-wc-global-container,
  .tc-wc-cart-page .tc-wc-page-container,
  .tc-wc-checkout-page .tc-wc-page-container,
  .tc-wc-order-received .tc-wc-page-container,
  .tc-wc-account-page .tc-wc-page-container {
    width:calc(100% - 32px);
  }

  .tc-wc-global-container {
    padding:48px 0 64px;
  }
}

@media (max-width:767px) {
  .tc-wc-page-container,
  .tc-wc-global-container,
  .tc-wc-cart-page .tc-wc-page-container,
  .tc-wc-checkout-page .tc-wc-page-container,
  .tc-wc-order-received .tc-wc-page-container,
  .tc-wc-account-page .tc-wc-page-container {
    width:calc(100% - 24px);
  }

  .tc-wc-page-container {
    padding:32px 0 48px;
  }

  .tc-wc-global-container {
    padding:32px 0 52px;
  }
}
