/* MDANI TECH — custom dashboard sections, buttons, backgrounds (public) + the Customize editor (admin). */

/* ---------- page background layer ---------- */
.bg-custom { position: absolute; inset: 0; pointer-events: none; }
.bg-custom[hidden], .bg-grid[hidden] { display: none; }
.preview-tag { position: fixed; z-index: 120; top: 10px; left: 50%; translate: -50% 0; padding: 6px 14px; border-radius: 99px; pointer-events: none;
  font: 700 10px/1 var(--font-tech); letter-spacing: .18em; color: #1a1200; background: var(--gold-grad); box-shadow: 0 6px 20px -6px rgba(232,185,35,.8); }

/* ---------- custom sections ---------- */
#customTop, #customBottom { display: flex; flex-direction: column; gap: 18px; }
#customTop:empty, #customBottom:empty { display: none; }
.csec { position: relative; overflow: hidden; padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; isolation: isolate; }
.csec-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.csec-bg[hidden] { display: none; }
.csec-head { display: flex; align-items: center; gap: 16px; }
.csec-head h2 { margin: 0; font: 700 14px/1.2 var(--font-tech); letter-spacing: .2em; text-transform: uppercase; }
.csec-head p { margin: 6px 0 0; white-space: pre-line; max-width: 820px; }
.csec-img { flex: none; width: 64px; height: 64px; object-fit: contain; border-radius: 14px; }
.cbtns { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.layout-row .cbtns { display: flex; flex-wrap: wrap; }
.layout-list .cbtns { grid-template-columns: 1fr; }

.cbtn { --cb-bg: rgba(10,40,20,.45); --cb-fg: var(--text); position: relative; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 14px 16px;
  border-radius: 14px; color: var(--cb-fg); background: var(--cb-bg); border: 1px solid var(--line); text-decoration: none; cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s; overflow-wrap: anywhere; }
.cbtn:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 0 26px -8px rgba(43,255,79,.6); }
.cbtn-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--neon);
  background: radial-gradient(circle at 30% 20%, rgba(43,255,79,.25), rgba(3,29,5,.6)); border: 1px solid var(--line-strong); }
.cbtn-icon svg { width: 24px; height: 24px; }
.cicon-img { display: block; width: 26px; height: 26px; object-fit: contain; }
.cbtn-text { display: grid; gap: 3px; min-width: 0; }
.cbtn-text b { font: 700 15px/1.25 var(--font-display); }
.cbtn-text small { font-size: 12.5px; opacity: .78; white-space: pre-line; }
.cbtn.size-sm { min-height: 46px; padding: 9px 12px; } .cbtn.size-sm .cbtn-icon { width: 34px; height: 34px; } .cbtn.size-sm .cbtn-text b { font-size: 13.5px; }
.cbtn.size-lg { min-height: 92px; padding: 20px 22px; } .cbtn.size-lg .cbtn-icon { width: 56px; height: 56px; } .cbtn.size-lg .cbtn-text b { font-size: 18px; }
.cbtn.style-glass { backdrop-filter: blur(14px); }
.cbtn.style-solid { --cb-bg: linear-gradient(135deg, var(--neon), var(--emerald)); --cb-fg: #021006; border-color: transparent; }
.cbtn.style-solid .cbtn-icon { color: #021006; background: rgba(255,255,255,.2); border-color: rgba(2,16,6,.3); }
.cbtn.style-outline { --cb-bg: transparent; border: 1.5px solid var(--neon); }
.cbtn.style-neon { border-color: var(--neon); box-shadow: 0 0 18px -4px var(--neon), inset 0 0 18px -8px var(--neon); }
.cbtn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.cbtn.is-static { cursor: default; } .cbtn.is-static:hover { transform: none; }
@media (max-width: 520px) { .cbtns { grid-template-columns: 1fr; } .csec { padding: 18px 16px; } }

/* ---------- Customize editor (Cloud Management) ---------- */
.cz-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; position: sticky; top: 84px; z-index: 15; background: var(--glass-strong); }
.cz-bar .cz-status { flex: 1; min-width: 200px; display: grid; gap: 2px; }
.cz-bar .cz-status b { font-size: 14px; } .cz-bar .cz-status small { color: var(--muted); font-size: 12px; }
.cz-bar .btn { min-height: 38px; padding: 0 14px; font-size: 13px; }
.cz-bar .btn svg { width: 16px; height: 16px; }
.cz-dirty { color: var(--gold-light); }
.cz-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
.cz-edit { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cz-prev { position: sticky; top: 160px; display: flex; flex-direction: column; gap: 10px; padding: 12px; min-width: 0; }
.cz-prev-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cz-prev-head h3 { margin: 0; font: 700 12px/1 var(--font-tech); letter-spacing: .16em; text-transform: uppercase; }
.cz-frame { height: min(72vh, 760px); border-radius: 12px; overflow: auto; background: #000; border: 1px solid var(--line); display: flex; justify-content: center; }
.cz-frame iframe { border: 0; width: 100%; height: 100%; background: var(--black); transition: width .25s; }
.cz-frame[data-device="tablet"] iframe { width: 768px; flex: none; }
.cz-frame[data-device="mobile"] iframe { width: 375px; flex: none; }
.seg.sm button { min-height: 32px; padding: 0 10px; font-size: 12px; }

.cz-list { display: grid; gap: 8px; }
.cz-item { border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.25); transition: border-color .2s, opacity .2s; }
.cz-item.open { border-color: var(--line-strong); box-shadow: 0 0 20px -10px var(--neon); }
.cz-item.dragging { opacity: .4; }
.cz-item.drop-before { box-shadow: 0 -3px 0 var(--neon); }
.cz-item.drop-after { box-shadow: 0 3px 0 var(--neon); }
.cz-item.off .cz-row b { color: var(--muted); text-decoration: line-through; }
.cz-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-width: 0; }
.cz-row .cz-handle { cursor: grab; touch-action: none; color: var(--muted); display: grid; place-items: center; width: 22px; flex: none; }
.cz-row .cz-handle svg { width: 16px; height: 16px; }
.cz-row .cz-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--neon); border: 1px solid var(--line); background: rgba(0,0,0,.3); overflow: hidden; }
.cz-row .cz-ic svg { width: 18px; height: 18px; } .cz-row .cz-ic img { width: 22px; height: 22px; object-fit: contain; }
.cz-row .cz-name { flex: 1; min-width: 0; }
.cz-row .cz-name b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-row .cz-name small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cz-row .icon-btn { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.cz-row .icon-btn svg { width: 15px; height: 15px; }
.cz-row .icon-btn:disabled { opacity: .25; cursor: default; }
.cz-row .tagpill { font-size: 10.5px; padding: 2px 7px; border-radius: 99px; border: 1px solid rgba(232,185,35,.45); color: var(--gold-light); flex: none; }
.cz-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 4px 12px 14px; border-top: 1px solid rgba(43,255,79,.08); }
.cz-form > label, .cz-form .cz-field { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); align-content: start; min-width: 0; }
.cz-form .wide { grid-column: 1 / -1; }
.cz-form input[type=text], .cz-form input[type=url], .cz-form select, .cz-form textarea { min-height: 40px; font-size: 13.5px; width: 100%; }
.cz-form textarea { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); font: inherit; resize: vertical; min-height: 64px; }
.cz-form textarea:focus { outline: none; border-color: var(--neon); }
.cz-form .switch { font-size: 13px; color: var(--text); }
.cz-color { display: flex; gap: 8px; align-items: center; }
.cz-color input[type=color] { width: 44px; height: 38px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.35); cursor: pointer; flex: none; }
.cz-color .link-btn { font-size: 12px; }
.cz-pick { display: flex; align-items: center; gap: 10px; }
.cz-pick .cz-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--neon); border: 1px solid var(--line-strong); background: rgba(0,0,0,.3); overflow: hidden; }
.cz-pick .cz-ic svg { width: 22px; height: 22px; } .cz-pick .cz-ic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cz-pick .btn { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.cz-sub { grid-column: 1 / -1; margin-top: 4px; padding-top: 10px; border-top: 1px dashed rgba(43,255,79,.15); display: grid; gap: 8px; }
.cz-sub h4 { margin: 0; font: 700 11px/1 var(--font-tech); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-light); }
.cz-add { display: flex; flex-wrap: wrap; gap: 8px; }
.cz-add .btn { min-height: 36px; font-size: 13px; padding: 0 14px; }
.cz-range { display: flex; align-items: center; gap: 8px; } .cz-range input { flex: 1; accent-color: var(--neon); } .cz-range output { min-width: 40px; text-align: right; color: var(--text); font-size: 12px; }

/* picker dialog */
.cz-picker { width: min(760px, calc(100vw - 24px)); }
.cz-picker .dialog-inner { gap: 12px; }
.cz-picker .seg { flex-wrap: wrap; }
.cz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 46vh; overflow: auto; padding: 2px; }
.cz-tile { display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 84px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.3); cursor: pointer; color: var(--text); font-size: 10.5px; text-align: center; overflow-wrap: anywhere; }
.cz-tile svg { width: 24px; height: 24px; color: var(--neon); }
.cz-tile img { width: 100%; height: 48px; object-fit: contain; }
.cz-tile:hover, .cz-tile[aria-pressed="true"] { border-color: var(--neon); background: rgba(43,255,79,.1); }
.cz-picked { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(43,255,79,.06); }
.cz-picked .cz-ic { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; background: rgba(0,0,0,.35); color: var(--neon); overflow: hidden; }
.cz-picked .cz-ic svg { width: 30px; height: 30px; } .cz-picked .cz-ic img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cz-picked div { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.cz-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 1280px) { .cz-wrap { grid-template-columns: 1fr; } .cz-prev { position: static; } .cz-frame { height: 70vh; } }
@media (max-width: 900px) { .cz-bar { position: static; } }
@media (max-width: 600px) {
  .cz-form { grid-template-columns: 1fr; }
  .cz-bar .btn { flex: 1 1 45%; }
  .cz-frame[data-device="tablet"] iframe { width: 100%; }
  .cz-row { flex-wrap: wrap; }
  .cz-row .cz-name { flex-basis: calc(100% - 80px); }
}
/* panel tabs and picker tabs wrap on narrow screens instead of widening the page */
.cz-edit > .seg, .cz-picker .seg, .cz-prev-head .seg { display: flex; flex-wrap: wrap; max-width: 100%; }
.cz-edit > .seg button, .cz-picker .seg button { flex: 1 1 auto; justify-content: center; }
@media (max-width: 600px) { .cz-edit > .seg button { flex: 1 1 40%; } }
