/* CodeLearnShop responsive safety layer — public site and admin */
html,body{max-width:100%;overflow-x:hidden}
img,svg,video,iframe{max-width:100%}
button,input,select,textarea{max-width:100%}
.container{width:min(1180px,calc(100% - 32px))!important}

/* Admin: prevent every content card from forcing horizontal overflow. */
.admin-main,.admin-main>*,#admin-content,#admin-content>*{min-width:0!important;max-width:100%}
.admin-main h1,.admin-main h2,.admin-main h3,.admin-main p,.admin-main a,.admin-main strong{overflow-wrap:anywhere}
.admin-main .btn{white-space:normal}
.learning-product-card>*{min-width:0}
.learning-product-card h3{font-size:clamp(1.05rem,2.1vw,1.55rem)!important;line-height:1.2!important;overflow-wrap:anywhere}
.learning-product-card>[data-add-for]{justify-self:end;max-width:120px}
.content-row>*{min-width:0}

@media(max-width:1200px){
  .learning-product-list,.tutoring-grid{grid-template-columns:1fr!important}
  .admin-product-grid,.admin-category-grid,.commerce-grid,.vat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .finance-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

@media(max-width:850px){
  body{min-width:0!important}
  .admin-sidebar{position:sticky!important;inset:auto!important;top:0!important;z-index:11000!important;width:100%!important;height:auto!important;max-height:none!important;padding:14px 14px 12px!important;overflow:visible!important;border-radius:0 0 22px 22px!important;box-shadow:0 12px 32px rgba(7,19,29,.18)!important}
  .admin-brand{display:flex!important;align-items:center!important;width:max-content!important;margin:0 0 12px 6px!important}
  .admin-brand-logo{width:138px!important;max-height:72px!important;object-fit:contain!important}
  .admin-sidebar nav{display:flex!important;gap:7px!important;width:100%!important;padding:0 2px 5px!important;overflow-x:auto!important;overflow-y:hidden!important;scroll-snap-type:x proximity;overscroll-behavior-inline:contain;scrollbar-width:thin}
  .admin-sidebar nav button,.admin-sidebar nav a{flex:0 0 auto!important;width:auto!important;min-width:max-content!important;margin:0!important;padding:11px 14px!important;white-space:nowrap!important;scroll-snap-align:start}
  .admin-main{width:100%!important;margin:0!important;padding:24px 16px 48px!important}
  .admin-main>header{position:relative!important;top:auto!important;margin-bottom:22px!important;padding:20px!important;border-radius:20px!important;z-index:10000!important}
  .admin-main>header h1{font-size:clamp(1.45rem,6vw,2rem)!important}
  .admin-main>header #add-product{width:auto!important;min-width:44px!important;padding:10px 13px!important}
  .admin-notification-popover{position:fixed!important;top:150px!important;right:16px!important;left:16px!important;width:auto!important;max-height:calc(100dvh - 175px)!important}
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important}
  .stat-card{min-width:0!important;padding:18px!important}
  .stat-card strong{font-size:clamp(1.35rem,6vw,2rem)!important}
  .learning-head,.commerce-head,.category-admin-head,.admin-users-head,.admin-reviews-head,.email-design-toolbar{align-items:stretch!important;flex-direction:column!important;gap:14px!important}
  .learning-head .btn,.commerce-head .btn,.category-admin-head .btn{width:100%!important}
  .learning-product-card{grid-template-columns:64px minmax(0,1fr) auto!important;padding:18px!important;gap:12px!important}
  .learning-product-card>img{width:64px!important;height:80px!important}
  .content-row{grid-template-columns:24px minmax(0,1fr)!important;gap:9px!important}
  .content-row .btn{grid-column:2!important;width:100%!important}
  .learning-admin-form{grid-template-columns:1fr!important}
  .learning-admin-form>*{grid-column:1!important}
  .form-actions{display:grid!important;grid-template-columns:1fr 1fr!important}
  .tutoring-card header,.tutoring-card footer{flex-wrap:wrap!important}
  .session-list>div{grid-template-columns:1fr auto!important}
  .session-list>div>*{min-width:0}
  .admin-order-grid,.admin-user-grid,.admin-category-grid,.commerce-grid,.vat-grid{grid-template-columns:1fr!important}
  .finance-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .finance-table-wrap,.finance-chart,.table-responsive{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
  .modal-dialog{width:auto!important;max-width:calc(100% - 16px)!important;margin:8px!important}
  .modal-body{max-height:calc(100dvh - 145px)!important;overflow-y:auto!important}
  .media-library-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .email-preview-frame{min-height:620px!important}
}

@media(max-width:560px){
  .container{width:min(1180px,calc(100% - 22px))!important}
  .admin-sidebar{padding:12px 10px 10px!important}
  .admin-brand-logo{width:120px!important;max-height:62px!important}
  .admin-sidebar nav button,.admin-sidebar nav a{padding:10px 12px!important;font-size:.84rem!important}
  .admin-main{padding:18px 10px 40px!important}
  .admin-main>header{padding:16px!important}
  .admin-notification-popover{top:132px!important;right:10px!important;left:10px!important;max-height:calc(100dvh - 150px)!important}
  .stat-grid{grid-template-columns:1fr 1fr!important;gap:9px!important}
  .stat-card{padding:15px!important}
  .learning-product-card{grid-template-columns:54px minmax(0,1fr)!important;padding:15px!important}
  .learning-product-card>img{width:54px!important;height:70px!important}
  .learning-product-card>[data-add-for]{grid-column:1/-1!important;justify-self:stretch!important;width:100%!important;max-width:none!important}
  .content-row-list{grid-column:1/-1!important}
  .tutoring-kpis{grid-template-columns:1fr!important}
  .finance-kpis{grid-template-columns:1fr!important}
  .media-library-grid{grid-template-columns:1fr!important}
  .form-actions{grid-template-columns:1fr!important}
  .email-template-tabs{grid-template-columns:1fr!important}
}

/* Public storefront */
@media(max-width:900px){
  .hero-grid,.shop-layout,.product-detail,.product-content-grid,.cart-layout,.account-dashboard-grid,.thank-you-grid,.footer-newsletter,.reader-layout{grid-template-columns:1fr!important}
  .products-grid,.feature-grid,.reviews-grid,.video-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .customer-library-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .product-card,.product-info,.product-media,.checkout-form,.order-summary,.profile-card,.account-shortcuts,.order-receipt,.payment-card{min-width:0!important;max-width:100%!important}
  .order-summary{position:static!important}
  .footer-newsletter{gap:25px!important;padding:28px!important}
  .footer-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .thank-you-hero{align-items:flex-start!important;flex-wrap:wrap!important}
  .shop-toolbar{align-items:stretch!important;flex-direction:column!important}
}

@media(max-width:620px){
  .products-grid,.feature-grid,.reviews-grid,.video-grid,.footer-grid,.customer-library-grid{grid-template-columns:1fr!important}
  .hero,.page-hero,.shop-hero{padding-left:0!important;padding-right:0!important}
  .hero-actions{display:grid!important;grid-template-columns:1fr!important}
  .hero-actions .button{width:100%!important;text-align:center!important}
  .product-card{width:100%!important}
  .cart-item{grid-template-columns:78px minmax(0,1fr)!important;gap:12px!important}
  .cart-item img{width:78px!important;height:98px!important}
  .cart-item-side{grid-column:2!important;align-items:flex-start!important}
  .checkout-form,.order-summary,.order-receipt,.payment-card{padding:20px 15px!important;border-radius:20px!important}
  .document-choice{grid-template-columns:1fr!important}
  .receipt-items article{grid-template-columns:56px minmax(0,1fr)!important}
  .receipt-items article>strong{grid-column:2!important}
  .account-head{align-items:flex-start!important;flex-direction:column!important}
  .customer-orders .order-card header{align-items:flex-start!important;grid-template-columns:1fr!important}
  .footer-newsletter{padding:22px 16px!important}
  .footer-newsletter form>div{height:auto!important;display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .footer-newsletter input,.footer-newsletter button{width:100%!important;min-height:48px!important;border-radius:12px!important}
  .footer-bottom{align-items:flex-start!important;flex-direction:column!important;gap:7px!important}
  .cookie-modal-card{width:calc(100% - 20px)!important;max-height:calc(100dvh - 20px)!important;overflow:auto!important}
  .learning-tabs{display:grid!important;grid-template-columns:1fr!important}
  .library-card,.customer-tutoring-list>article{min-width:0!important}
  .tuition-summary{grid-template-columns:1fr!important}
  .customer-session-list>div{grid-template-columns:1fr!important}
  .reader-stage>header{align-items:stretch!important;flex-direction:column!important}
  .reader-stage>header .button{width:100%!important}
  .secure-frame-wrap{min-height:55vh!important}
  .auth-unified,.auth-card,.auth-switch{width:100%!important;max-width:100%!important}
}
