/* customdialog.css — popup engine (anchored popover + confirm dialog) */
.cp-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,0); pointer-events: none; transition: background .2s ease; }
.cp-backdrop--visible { background: rgba(0,0,0,.4); pointer-events: auto; }

.cp-panel { position: fixed; z-index: 901; min-width: 200px; background: var(--surface-primary, #fff); color: var(--text-primary, #1D1D1F);
  border: 1px solid var(--border-color, #D2D2D7); border-radius: 16px; box-shadow: 0 4px 6px rgba(0,0,0,.04), 0 14px 40px rgba(0,0,0,.14);
  opacity: 0; transform: scale(.94) translateY(6px); pointer-events: none;
  transition: opacity .18s cubic-bezier(.4,0,.2,1), transform .18s cubic-bezier(.34,1.4,.64,1); }
.cp-panel--open { opacity: 1; transform: none; pointer-events: auto; }

/* Opens downward from the top bar */
.cp-panel--below { transform-origin: top right; }
.cp-panel--below:not(.cp-panel--open) { transform: scale(.95) translateY(-8px); }

.cp-panel--centered { top: 50% !important; left: 50% !important; width: 380px !important; transform: translate(-50%, -50%) scale(.94); }
.cp-panel--centered.cp-panel--open { transform: translate(-50%, -50%) scale(1); }

/* Customize content */
#cp-customize { display: flex; flex-direction: column; gap: 18px; padding: 16px; }
.cp-head { display: flex; align-items: center; justify-content: space-between; }
.cp-title { font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.cp-close { background: none; border: 0; cursor: pointer; color: var(--text-secondary); font-size: .85rem; padding: 4px 8px; border-radius: 8px; }
.cp-close:hover { color: var(--text-primary); background: var(--hover-bg); }
.cp-sec { display: flex; flex-direction: column; gap: 8px; }
.cp-label { font-size: .75rem; font-weight: 600; color: var(--text-secondary); }
.cp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.cp-theme-btn { min-width: 38px; min-height: 38px; display: grid; place-items: center; font-size: 1rem; cursor: pointer; border-radius: 10px;
  background: var(--surface-tertiary, #E8E8ED); border: 2px solid transparent; transition: border-color .15s, transform .12s; }
.cp-theme-btn:hover { transform: scale(1.08); }
.cp-theme-btn[aria-pressed="true"] { border-color: var(--accent-color); }

.cp-dot { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid transparent; cursor: pointer; padding: 0; flex: none; transition: transform .15s, border-color .15s; }
.cp-dot:hover { transform: scale(1.15); }
.cp-dot[aria-pressed="true"] { border-color: var(--text-primary); transform: scale(1.1); }
.cp-dot--custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); display: block; overflow: hidden; }
.cp-dot--custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.cp-toggle-row { display: flex; align-items: center; gap: 10px; }
.cp-toggle { position: relative; width: 38px; height: 22px; border-radius: 999px; border: 0; cursor: pointer; padding: 0; background: var(--surface-tertiary, #D1D1D6); transition: background .2s; }
.cp-toggle[aria-checked="true"] { background: var(--accent-color); }
.cp-toggle i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.cp-toggle[aria-checked="true"] i { transform: translateX(16px); }
.cp-toggle-text { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }

/* Confirm dialog */
#cp-dialog-inner { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.cp-dialog-title { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; }
.cp-dialog-message { font-size: .9rem; line-height: 1.55; color: var(--text-secondary); }
.cp-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.cp-btn { padding: 9px 18px; border-radius: 10px; border: 0; font-size: .9rem; font-weight: 600; cursor: pointer; }
.cp-btn--cancel { background: var(--surface-tertiary, #E8E8ED); color: var(--text-secondary); }
.cp-btn--default { background: var(--accent-color); color: #fff; }
.cp-btn--danger { background: #FF3B30; color: #fff; }

@media (max-width: 768px) {
  .cp-panel--centered { width: calc(100vw - 32px) !important; }
}
@media (prefers-reduced-motion: reduce) { .cp-panel, .cp-backdrop { transition: none; } }
