/*
 PRISMA ONE V8.7.2 - UI SHELL FIX
 ------------------------------------------------------------
 Corrección de V8.7:
 - El sidebar colapsado ahora libera espacio real.
 - El menú móvil ya no deja sombra bloqueada.
 - El botón "Cerrar menú" cierra de verdad.
 - El JS deja de convertir contenedores grandes/hero/index en grid de productos.
 - eCommerce mantiene grid moderno sin romper la pantalla principal.
*/

:root{
  --prisma-sidebar-w: 292px;
  --prisma-sidebar-collapsed-w: 68px;
  --prisma-primary: #5428f5;
  --prisma-ink: #0f172a;
  --prisma-muted: #64748b;
  --prisma-soft: #f8fafc;
  --prisma-line: #e2e8f0;
}

/* =============================
   ADMIN SHELL
============================= */
body.prisma-admin-shell{
  background:#eef2f7;
  overflow-x:hidden;
}

body.prisma-admin-shell .prisma-shell-layout{
  display:grid !important;
  grid-template-columns:var(--prisma-sidebar-w) minmax(0, 1fr) !important;
  width:100% !important;
  max-width:100vw !important;
  min-height:100vh !important;
  transition:grid-template-columns .22s ease;
}

body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-shell-layout{
  grid-template-columns:var(--prisma-sidebar-collapsed-w) minmax(0, 1fr) !important;
}

body.prisma-admin-shell .prisma-sidebar{
  width:var(--prisma-sidebar-w) !important;
  max-width:var(--prisma-sidebar-w) !important;
  min-width:var(--prisma-sidebar-w) !important;
  transition:width .22s ease, min-width .22s ease, max-width .22s ease, transform .22s ease;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  z-index:9000;
}

body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar{
  width:var(--prisma-sidebar-collapsed-w) !important;
  max-width:var(--prisma-sidebar-collapsed-w) !important;
  min-width:var(--prisma-sidebar-collapsed-w) !important;
}

body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar img,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .avatar,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .logo{
  max-width:44px !important;
}

body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .menu-text,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .label,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .submenu,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .small,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .name,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar .user-name,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar p,
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar strong:not(.icon),
body.prisma-admin-shell.prisma-sidebar-collapsed .prisma-sidebar span:not(.icon):not(.badge):not(.dot){
  opacity:0 !important;
  max-width:0 !important;
  overflow:hidden !important;
  white-space:nowrap !important;
}

body.prisma-admin-shell .prisma-main{
  min-width:0 !important;
  width:100% !important;
  max-width:100% !important;
  overflow-x:hidden !important;
  transition:all .22s ease;
}

.prisma-v87-mobile-toggle{
  position:fixed;
  left:14px;
  top:14px;
  z-index:10050;
  width:44px;
  height:44px;
  border:0;
  border-radius:14px;
  background:#ffffff;
  color:var(--prisma-ink);
  box-shadow:0 12px 32px rgba(15,23,42,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  cursor:pointer;
}

.prisma-v87-desktop-collapse{
  position:fixed;
  left:calc(var(--prisma-sidebar-w) - 17px);
  top:118px;
  z-index:10020;
  width:34px;
  height:34px;
  border:0;
  border-radius:999px;
  background:#ffffff;
  color:var(--prisma-primary);
  box-shadow:0 8px 24px rgba(15,23,42,.18);
  font-weight:900;
  cursor:pointer;
}

body.prisma-sidebar-collapsed .prisma-v87-desktop-collapse{
  left:calc(var(--prisma-sidebar-collapsed-w) - 17px);
}

.prisma-v87-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  z-index:8999;
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
}

body.prisma-menu-open .prisma-v87-overlay{
  opacity:1;
  pointer-events:auto;
}

.prisma-v87-close-menu{
  display:none;
  width:calc(100% - 24px);
  margin:12px;
  border:0;
  border-radius:14px;
  padding:12px;
  background:#fff;
  color:#0f172a;
  font-weight:900;
  cursor:pointer;
}

@media (min-width:981px){
  .prisma-v87-mobile-toggle{display:none !important;}
}

@media (max-width:980px){
  body.prisma-admin-shell .prisma-shell-layout{
    display:block !important;
    grid-template-columns:1fr !important;
  }

  .prisma-v87-desktop-collapse{display:none !important;}

  body.prisma-admin-shell .prisma-sidebar{
    position:fixed !important;
    left:0 !important;
    top:0 !important;
    bottom:0 !important;
    width:min(86vw, 318px) !important;
    max-width:318px !important;
    min-width:0 !important;
    height:100vh !important;
    z-index:10000 !important;
    transform:translateX(-108%) !important;
    box-shadow:24px 0 48px rgba(15,23,42,.24);
  }

  body.prisma-admin-shell.prisma-menu-open .prisma-sidebar{
    transform:translateX(0) !important;
  }

  body.prisma-admin-shell .prisma-main,
  body.prisma-admin-shell main,
  body.prisma-admin-shell .content,
  body.prisma-admin-shell .main-content,
  body.prisma-admin-shell .admin-content{
    margin-left:0 !important;
    width:100% !important;
    max-width:100vw !important;
    padding-left:10px !important;
    padding-right:10px !important;
  }

  .prisma-v87-close-menu{display:block !important;}
}

/* =============================
   SHOP / ECOMMERCE
============================= */
body.prisma-shop-shell{
  background:#f8fafc;
  overflow-x:hidden;
}

body.prisma-shop-shell header,
body.prisma-shop-shell .header,
body.prisma-shop-shell .site-header,
body.prisma-shop-shell .shop-header{
  position:sticky;
  top:0;
  z-index:8000;
  backdrop-filter:blur(14px);
}

/* No forzar main a grid. Solo contenedores detectados como grid de productos */
body.prisma-shop-shell .container,
body.prisma-shop-shell .shop-container,
body.prisma-shop-shell .products-section,
body.prisma-shop-shell .home-section,
body.prisma-shop-shell .page-container{
  max-width:min(1540px, 96vw) !important;
}

body.prisma-shop-shell main{
  max-width:none !important;
}

body.prisma-shop-shell .prisma-product-grid{
  display:grid !important;
  grid-template-columns:repeat(auto-fill, minmax(205px, 1fr)) !important;
  gap:22px !important;
  align-items:stretch !important;
  width:100% !important;
  min-width:0 !important;
}

body.prisma-shop-shell .prisma-product-card{
  min-width:0 !important;
  width:100% !important;
  min-height:410px !important;
  display:flex !important;
  flex-direction:column !important;
  overflow:hidden !important;
  border-radius:18px !important;
  background:#fff !important;
  border:1px solid #e5e7eb !important;
  box-shadow:0 12px 34px rgba(15,23,42,.06) !important;
}

body.prisma-shop-shell .prisma-product-card img{
  object-fit:contain !important;
  max-width:100% !important;
}

body.prisma-shop-shell .prisma-product-card .prisma-img-zone{
  height:178px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:16px !important;
}

body.prisma-shop-shell .prisma-product-title{
  display:-webkit-box !important;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden !important;
  min-height:38px !important;
  line-height:1.15 !important;
  word-break:break-word !important;
}

body.prisma-shop-shell .prisma-card-actions{
  margin-top:auto !important;
  display:grid !important;
  grid-template-columns:minmax(84px, .7fr) minmax(118px, 1fr) !important;
  gap:10px !important;
  align-items:center !important;
  width:100% !important;
}

body.prisma-shop-shell .prisma-qty-control{
  display:grid !important;
  grid-template-columns:28px 1fr 28px !important;
  gap:4px !important;
  align-items:center !important;
  min-width:84px !important;
  overflow:hidden !important;
}

body.prisma-shop-shell .prisma-qty-control button,
body.prisma-shop-shell .prisma-qty-control input{
  min-width:0 !important;
  height:36px !important;
}

body.prisma-shop-shell .prisma-add-cart-btn{
  min-width:0 !important;
  width:100% !important;
  white-space:normal !important;
  line-height:1.08 !important;
  padding:10px 12px !important;
  border-radius:10px !important;
  overflow:visible !important;
}

/* Fallback seguro: solo en cards marcadas por JS o clases explícitas */
body.prisma-shop-shell .product-card,
body.prisma-shop-shell .shop-product-card,
body.prisma-shop-shell .card-product{
  min-width:0 !important;
  overflow:hidden !important;
}

body.prisma-shop-shell .product-card button,
body.prisma-shop-shell .shop-product-card button,
body.prisma-shop-shell .card-product button{
  white-space:normal !important;
  line-height:1.08 !important;
}

@media (max-width:760px){
  body.prisma-shop-shell .prisma-product-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
    gap:12px !important;
  }

  body.prisma-shop-shell .prisma-product-card{
    min-height:360px !important;
  }

  body.prisma-shop-shell .prisma-card-actions{
    grid-template-columns:1fr !important;
  }
}

/* =============================
   POS / DOCUMENTOS
============================= */
.prisma-admin-shell .pos-order-panel{
  min-width:min(470px, 100%) !important;
}

.prisma-admin-shell .pos-order-table,
.prisma-admin-shell .doc-detail-panel{
  border-radius:16px !important;
  border:1px solid #dbeafe !important;
  overflow:hidden !important;
}

.prisma-admin-shell .pos-order-scroll,
.prisma-admin-shell .doc-lines-scroll{
  overflow:auto !important;
}

.prisma-admin-shell .pos-order-head,
.prisma-admin-shell .doc-line-grid-head{
  position:sticky !important;
  top:0 !important;
  z-index:6 !important;
}


/* ==========================================================
   PRISMA ONE V8.9.7.8.8-R2 — corrección estable del index
   El formulario de compra debe ser vertical. Solo .qty-row
   puede recibir el layout de control de cantidad.
   ========================================================== */
body.prisma-shop-shell .storefront-card-v89788
.storefront-card-cart-v89788.prisma-card-actions,
body.prisma-shop-shell .storefront-card-v89788
.storefront-card-cart-v89788.prisma-card-actions-stacked{
  display:flex !important;
  flex-direction:column !important;
  grid-template-columns:none !important;
  align-items:stretch !important;
  gap:9px !important;
  width:100% !important;
  overflow:visible !important;
}

body.prisma-shop-shell .storefront-card-v89788
form.storefront-card-cart-v89788.prisma-qty-control{
  display:flex !important;
  flex-direction:column !important;
  grid-template-columns:none !important;
  min-width:0 !important;
  overflow:visible !important;
}

body.prisma-shop-shell .storefront-card-v89788
.storefront-card-cart-v89788 .qty-row.prisma-qty-control,
body.prisma-shop-shell .storefront-card-v89788
.storefront-card-cart-v89788 [data-qty-control="1"].prisma-qty-control{
  display:grid !important;
  grid-template-columns:40px minmax(44px,1fr) 40px !important;
  gap:8px !important;
  width:100% !important;
  min-width:0 !important;
  overflow:visible !important;
}

body.prisma-shop-shell .storefront-card-v89788
.storefront-card-cart-v89788 .qty-row.prisma-qty-control button{
  width:40px !important;
  min-width:40px !important;
}

body.prisma-shop-shell .storefront-card-v89788
.storefront-card-cart-v89788 .add-cart-btn.prisma-add-cart-btn{
  display:flex !important;
  width:100% !important;
  min-width:0 !important;
  min-height:44px !important;
  position:static !important;
  margin:0 !important;
}

@media (max-width:620px){
  body.prisma-shop-shell .storefront-card-v89788
  .storefront-card-cart-v89788 .qty-row.prisma-qty-control,
  body.prisma-shop-shell .storefront-card-v89788
  .storefront-card-cart-v89788 [data-qty-control="1"].prisma-qty-control{
    grid-template-columns:36px minmax(38px,1fr) 36px !important;
    gap:6px !important;
  }

  body.prisma-shop-shell .storefront-card-v89788
  .storefront-card-cart-v89788 .qty-row.prisma-qty-control button{
    width:36px !important;
    min-width:36px !important;
  }
}
