/* kliklink.my — modal scrolling and consistent icon picker, 22 Nov 2026 */
/* The editor's modal must stay inside the visible viewport, including on smaller laptops. */
.modal-backdrop:has(#link-form){
  padding:clamp(10px,2vh,20px);
  overflow:hidden;
  align-items:center;
}
.modal-backdrop .modal:has(#link-form){
  width:min(670px,100%);
  max-width:670px;
  max-height:calc(100dvh - 24px);
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  padding:22px 25px 0;
}
.modal:has(#link-form)>.modal-head{
  flex:0 0 auto;
  margin-bottom:15px;
  padding-bottom:10px;
  border-bottom:1px solid #eee8fa;
}
.modal:has(#link-form)>#link-form{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior-y:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
  scrollbar-color:#d2c1f7 transparent;
  padding:0 4px;
}
.modal:has(#link-form) #link-form>.editor-actions{
  position:sticky;
  bottom:0;
  z-index:5;
  background:#fff;
  box-shadow:0 -6px 14px #fff;
  padding:15px 3px 17px;
  margin-top:12px;
}
.kl-sp-dialog:has(#kl-sp-link-form){
  max-height:calc(100dvh - 26px);
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  padding:22px 24px 0;
}
.kl-sp-dialog:has(#kl-sp-link-form) .kl-sp-form-wrap{
  min-height:0;
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.kl-sp-dialog:has(#kl-sp-link-form) .kl-sp-modal-head{
  flex:0 0 auto;
  padding-bottom:12px;
  border-bottom:1px solid #eee8fa;
}
.kl-sp-dialog:has(#kl-sp-link-form) #kl-sp-link-form{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior-y:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
  scrollbar-color:#d2c1f7 transparent;
  padding:0 4px;
}
.kl-sp-dialog:has(#kl-sp-link-form) #kl-sp-link-form>.editor-actions{
  position:sticky;
  bottom:0;
  z-index:5;
  background:#fff;
  box-shadow:0 -6px 14px #fff;
  padding:15px 4px 17px;
}
.kl-sp-icon-picker .kl-icon-grid{
  grid-template-columns:repeat(6,minmax(0,1fr));
  max-height:255px;
  overflow-y:auto;
  padding:3px;
  scrollbar-width:thin;
}
.kl-sp-icon-picker .kl-icon-choice{min-height:67px;}
.kl-sp-icon-picker .kl-icon-choice.selected{
  background:#f4edff;
  border-color:#7c3ced;
  box-shadow:inset 0 0 0 1px #7c3ced;
}
@media(max-width:620px){
  .modal-backdrop .modal:has(#link-form){padding:16px 15px 0;max-height:calc(100dvh - 12px)}
  .kl-sp-dialog:has(#kl-sp-link-form){padding:16px 15px 0;max-height:calc(100dvh - 12px)}
  .kl-sp-icon-picker .kl-icon-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media(max-height:550px){
  .modal-backdrop .modal:has(#link-form){max-height:calc(100dvh - 8px)}
  .kl-sp-dialog:has(#kl-sp-link-form){max-height:calc(100dvh - 8px)}
}
