/* Applies only after the comments uploader is ready. */
.ui-dialog.dle-popup-mediaupload.comment-photos {
  --accent: #286bbc;
  box-sizing: border-box; position: fixed !important; inset: 50% auto auto 50% !important;
  transform: translate(-50%,-50%); width: min(720px,calc(100vw - 20px)) !important;
  height: auto !important; max-height: calc(100dvh - 20px) !important;
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
  background: white; color: #19202a; border: 1px solid #ccd4de; border-radius: 12px;
  box-shadow: 0 12px 40px #19263733; font: 15px/1.4 var(--cur-font,"Segoe UI",sans-serif);
}
.comment-photos > .ui-dialog-titlebar {
  position: relative; flex: none; background: white; color: #151a21; border: 0;
  padding: 17px 56px 8px 22px;
}
.comment-photos .ui-dialog-titlebar .ui-dialog-title {margin:0; font: bold 22px/1.25 var(--cur-font,"Segoe UI",sans-serif); color:inherit;}
.comment-photos .ui-dialog-titlebar button.ui-dialog-titlebar-close {
  display:grid!important; place-items:center; position:absolute; right:12px; top:50%; transform:translateY(-50%);
  width:34px; height:34px; margin:0; padding:0; background:transparent; color:#202732; border:0;
  text-indent:0; opacity:1; cursor:pointer; box-shadow:none;
}
.comment-photos .ui-dialog-titlebar-close::before {content:"×"; font:26px/1 Arial;}
.comment-photos #mediaupload {box-sizing:border-box; flex:0 1 auto; height:auto!important; min-height:0!important; max-height:none!important; overflow-x:hidden!important; overflow-y:auto!important; min-width:0; max-width:100%; padding:0 22px 12px;}
.comment-photos #mediaupload :is(.tabs,.mediaupload-box,.file-upload-box,.file-preview-box,.media-upload-button-area) {border:0; box-shadow:none; min-height:0; height:auto; padding:0; margin:0; background:none;}
.comment-photos #mediaupload .tabsitems {border:0; border-bottom:1px solid #d2d9e2; background:none; margin-bottom:14px;}
.comment-photos #mediaupload .tabsitems ul {display:flex; flex-wrap:wrap; padding:0; margin:0; list-style:none;}
.comment-photos #mediaupload .tabsitems li {margin:0; padding:0; border:0; background:none;}
.comment-photos #mediaupload .tabsitems a {display:block; padding:10px 12px; background:none; border:0; border-bottom:3px solid transparent; border-radius:0; color:#535d69; font-weight:600;}
.comment-photos #mediaupload .tabsitems a.current {color:#141a22; border-bottom-color:var(--accent);}
.comment-photos #file-uploader :is(.plupload_header,.plupload_filelist_header,.plupload_filelist_footer,.plupload_content,.ui-resizable-handle),
.comment-photos #stmode :is(.upload-restriction,.mediaupload-row:not(.cp-open),.upload-options:empty) {display:none!important;}
.comment-photos #file-uploader,.comment-photos #file-uploader :is(.plupload_wrapper,.plupload_container) {height:auto!important; min-height:0!important; margin:0; padding:0; border:0; background:none;}
.comment-photos .cp-tools,.comment-photos .cp-file {display:flex; align-items:center; gap:14px;}
.comment-photos .cp-tools {flex-wrap:wrap; padding:2px 0 8px;}
.comment-photos .cp-tools .cp-pick,.comment-photos #mediaupload-insert {
  position:relative; display:inline-flex; align-items:center; margin:0; overflow:hidden; background:var(--accent); color:white;
  border:0; border-radius:6px; padding:10px 18px; font-size:15px;line-height:1.4; font-family:inherit; font-weight:600; cursor:pointer; text-shadow:none;
}
.comment-photos .cp-pick input {position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer;}
.comment-photos .cp-pick:focus-within {outline:2px solid #173c77; outline-offset:2px;}
.comment-photos .cp-limit,.comment-photos .cp-status {color:#556170;}
.comment-photos button.cp-link,.comment-photos button.cp-remove {background:transparent; border:0; box-shadow:none; text-shadow:none; color:var(--accent); padding:5px; cursor:pointer;}
.comment-photos #stmode button.cp-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font: 600 15px/1.4 var(--cur-font,"Segoe UI",sans-serif);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.comment-photos #stmode .mediaupload-row.cp-open {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 0 4px;
  margin: 0;
}
.comment-photos #stmode .mediaupload-row::before,
.comment-photos #stmode .mediaupload-row::after,
.comment-photos .mediaupload-footer::before,
.comment-photos .mediaupload-footer::after { display: none; }
.comment-photos #stmode .mediaupload-row > div {
  display: block; position: static; float: none; width: auto; min-width: 0;
  margin: 0; padding: 0;
}
.comment-photos #stmode #copyurl,
.comment-photos #stmode .mediaupload-col3 button {
  display: block; box-sizing: border-box; height: 40px; margin: 0;
  border-radius: 6px; font: 400 15px/1.3 var(--cur-font,"Segoe UI",sans-serif);
}
.comment-photos #stmode #copyurl { min-width: 0; max-width: 100%; padding: 0 10px; }
.comment-photos #stmode .mediaupload-col3 button {
  padding: 0 16px; background: var(--accent); color: white; border: 0;
  font-weight: 600; text-shadow: none; box-shadow: none; cursor: pointer;
}
.comment-photos .cp-file {margin-top:6px; padding:8px; border:1px solid #d2d9e2; border-radius:8px;}
.comment-photos .cp-thumb img {width:64px; height:48px; object-fit:cover; border-radius:4px;}
.comment-photos .cp-info {flex:1; min-width:0;}
.comment-photos .cp-info strong {display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.comment-photos progress {width:100%;height:8px;accent-color:var(--accent);}
.comment-photos .cp-remove {font-size:22px;}
.comment-photos #cont1:not([style*="display: none"]):not([style*="display:none"]) {display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;}
.comment-photos #cont1 .file-preview-card {box-sizing:border-box;float:none; width:100%;height:auto; min-width:0;padding:0;margin:0;border:1px solid #cbd3dc;border-radius:8px;overflow:hidden;}
.comment-photos #cont1 .file-preview-card.active {outline:2px solid var(--accent);outline-offset:-2px;}
.comment-photos #cont1 .file-content:has(.cp-gallery-photo) {display:block;position:relative;height:auto;width:100%;padding:0;aspect-ratio:16/10;cursor:pointer;overflow:hidden;}
.comment-photos #cont1 .file-content > .cp-gallery-photo {position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;max-height:none;}
.comment-photos #cont1 .file-content:has(.cp-gallery-photo)::after {content:"";position:absolute;top:7px;left:7px;z-index:2;background:white;border:1px solid #97a4b2;border-radius:4px;width:20px;height:20px;text-align:center;line-height:20px;color:white;pointer-events:none;}
.comment-photos #cont1 .active .file-content:has(.cp-gallery-photo)::after {content:"✓";background:var(--accent);border-color:var(--accent);}
.comment-photos .mediaupload-footer {
  flex: none; position: static; display: grid; gap: 6px; box-sizing: border-box;
  width: 100%; min-width: 0; margin: 0; padding: 10px 18px;
  border: 0; border-top: 1px solid #e5e9ef; background: white;
}
.comment-photos .mediaupload-footer .ui-dialog-buttonset {
  float: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr);
  gap: 8px; width: 100%; min-width: 0; margin: 0;
}
.comment-photos .mediaupload-footer .ui-dialog-buttonset > button.ui-button {
  box-sizing: border-box; width: 100%; min-width: 0; height: 44px; margin: 0;
  padding: 0 6px; border: 1px solid #c6d0dc; border-radius: 6px;
  background: white; color: #273648; text-align: center; white-space: normal;
  font: 600 15px/1.15 var(--cur-font,"Segoe UI",sans-serif); justify-content: center;
}
.comment-photos .mediaupload-footer .ui-dialog-buttonset > #mediaupload-insert {
  color: white; background: var(--accent); border-color: var(--accent);
}
.comment-photos .mediaupload-footer .ui-dialog-buttonset:not(:has(.ui-button[id]:not([style*="display: none"]):not([style*="display:none"]))) {
  max-width: 180px; justify-self: end;
}
.comment-photos .cp-selected {font-weight:600;}
.comment-photos .cp-selected:empty {display:none;}
.comment-photos .mediaupload-insert-params {display:none!important;}
@media (max-width:540px) {
  .comment-photos #mediaupload {padding-inline:12px;}
  .comment-photos #cont1:not([style*="display: none"]):not([style*="display:none"]) {grid-template-columns:repeat(2,minmax(0,1fr));}
  .comment-photos .cp-tools {gap:8px;}
  .comment-photos #stmode .mediaupload-row.cp-open {grid-template-columns:minmax(0,1fr) auto;}
  .comment-photos #stmode .mediaupload-col1 {grid-column:1/-1;}
  .comment-photos .mediaupload-footer .ui-dialog-buttonset {grid-auto-flow:row;grid-template-columns:minmax(0,1fr);}
  .comment-photos .mediaupload-footer {padding:8px 12px;max-height:48dvh;overflow-y:auto;overflow-x:hidden;}
}

@media (max-width: 540px) {
  .comment-photos #mediaupload .tabs,
  .comment-photos #mediaupload .tabsitems,
  .comment-photos #mediaupload .tabsitems > ul,
  .comment-photos #mediaupload .tabsitems > ul > li {
    position: static;
    float: none;
    box-sizing: border-box;
    height: auto;
    max-height: none;
    min-width: 0;
    overflow: visible;
  }
  .comment-photos #mediaupload .tabs,
  .comment-photos #mediaupload .tabsitems,
  .comment-photos #mediaupload .tabsitems > ul {
    display: block;
    width: 100%;
  }
  .comment-photos #mediaupload .tabsitems > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .comment-photos #mediaupload .tabsitems > ul > li {
    flex: 1 0 max-content;
    width: auto;
    max-width: 100%;
  }
  .comment-photos #mediaupload .tabsitems li > a:is(#link1,#link2) {
    all: unset;
    display: block;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 5px;
    border-bottom: 3px solid transparent;
    color: #535d69;
    font: 600 15px/1.5 var(--cur-font,"Segoe UI",sans-serif);
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  /* Keep the DLE label for live counts, without its legacy clipping box. */
  .comment-photos #mediaupload .tabsitems li > :is(#link1,#link2) > span {
    all: unset;
    display: contents !important;
  }
  .comment-photos #mediaupload .tabsitems li > :is(#link1,#link2)::before,
  .comment-photos #mediaupload .tabsitems li > :is(#link1,#link2)::after,
  .comment-photos #mediaupload .tabsitems li > :is(#link1,#link2) > span::before,
  .comment-photos #mediaupload .tabsitems li > :is(#link1,#link2) > span::after {
    content: none;
  }
  .comment-photos #mediaupload .tabsitems li > a:is(#link1,#link2).current {
    color: #141a22;
    border-bottom-color: var(--accent);
  }
  .comment-photos #mediaupload .tabsitems li > a:is(#link1,#link2):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  .comment-photos #mediaupload #check-all-box {
    position: static;
    float: none;
    clear: both;
    margin: 0 0 8px;
    text-align: right;
  }
}
