/* Website Widget (Add-ons): the settings of the Live Widget on the left, the real widget in a small screen on the right. */

.wg-note { margin-bottom: 14px; }

/* the website and its switch */
.wg-bar {
    position: relative;
    z-index: 20;   /* the website list floats over the cards below (each glass card is its own layer) */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 16px;
}

.wg-site { flex: 1 1 280px; max-width: 420px; min-width: 0; }

.wg-onoff { display: flex; align-items: center; gap: 12px; }
.wg-onoff-t { display: flex; flex-direction: column; line-height: 1.25; }
.wg-onoff-l { font-size: 14px; font-weight: 700; color: var(--color-text); }
.wg-onoff-s { font-size: 12.5px; color: var(--color-text-soft); }
.wg-onoff-s.is-on { color: var(--color-green-dark); font-weight: 600; }
:root[data-theme="dark"] .wg-onoff-s.is-on { color: var(--color-green); }

/* the switch: grey when off, green when on (as in Settings) */
.wg-switch {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-text) 20%, transparent);
    transition: background .18s var(--ease);
}
.wg-switch-k {
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
    transition: transform .18s var(--ease);
}
.wg-switch[aria-checked="true"] { background: var(--color-green); }
.wg-switch[aria-checked="true"] .wg-switch-k { transform: translateX(20px); }
[dir="rtl"] .wg-switch[aria-checked="true"] .wg-switch-k { transform: translateX(-20px); }
.wg-switch:disabled { opacity: .45; cursor: not-allowed; }
.wg-switch[aria-busy="true"] { cursor: progress; opacity: .7; }

/* two columns: the settings and the preview (sticky); one column on narrower screens, the preview first */
.wg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    gap: 18px;
    align-items: start;
}

.wg-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.wg-card { padding: 16px 18px; border-radius: 16px; }
.wg-card-t { margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--color-black); letter-spacing: -.01em; }

.wg-row {
    display: grid;
    grid-template-columns: minmax(140px, 210px) minmax(0, 1fr);
    align-items: center;
    gap: 8px 16px;
    padding: 8px 0;
}
.wg-row + .wg-row { border-top: 1px solid var(--color-border-soft); }
.wg-row-top { align-items: start; }
.wg-row-top > .wg-label { padding-top: 9px; }

.wg-label { font-size: 13.5px; font-weight: 700; color: var(--color-text); }
.wg-sub { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--color-text-soft); min-width: 0; }
.wg-field { min-width: 0; }
.wg-hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--color-text-soft); }
.wg-err { margin: 6px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ws-bad, #dc2626); }
.wg-narrow { width: auto; min-width: 90px; max-width: 140px; }
.wg-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--color-text-soft); }

.wg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }

.wg-range { display: flex; align-items: center; gap: 12px; }
.wg-range input { flex: 1; min-width: 0; accent-color: var(--color-green); }
.wg-range output { min-width: 52px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-text-soft); }

.wg-check, .wg-radio { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--color-text); cursor: pointer; }
.wg-check input, .wg-radio input { width: 17px; height: 17px; margin: 0; accent-color: var(--color-green); flex: none; }
.wg-radios { display: flex; flex-direction: column; gap: 8px; }

.wg-colors { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wg-colors input[type="color"] {
    width: 44px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    background: var(--color-bg);
    cursor: pointer;
}
.wg-colors input[type="color"]:disabled { opacity: .45; cursor: default; }

/* the modules: a list with a tick and two arrows each (the order is the order in the panel) */
.wg-mods { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wg-mod {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    background: var(--glass-field, transparent);
}
.wg-mod .wg-check { flex: 1; min-width: 0; }
.wg-mod.is-off .wg-check span { color: var(--color-text-soft); }
.wg-mod-ico { font-size: 19px !important; color: var(--color-text-soft); }
.wg-mv {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-soft);
}
.wg-mv:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text); }
.wg-mv:disabled { opacity: .3; cursor: default; }
.wg-mv .material-symbols-outlined { font-size: 19px; }

/* the path rules */
.wg-rules { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-soft); }
.wg-rule-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.wg-rule { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.wg-rule .ws-input.is-bad { border-color: var(--ws-bad, #dc2626); }

.wg-quiet { margin-top: 8px; }

/* the publish bar: always at hand at the bottom of the screen */
.wg-save {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 16px;
    border-radius: 14px;
}
.wg-save-t { flex: 1; min-width: 0; margin: 0; font-size: 13px; color: var(--color-text-soft); }
.wg-save-t.is-dirty { color: var(--color-text); font-weight: 600; }
.wg-save-t.is-bad { color: var(--ws-bad, #dc2626); font-weight: 600; }
#WG_PUBLISH:disabled { opacity: .55; cursor: default; filter: none; }

/* the preview */
.wg-preview { position: sticky; top: 76px; padding: 14px; border-radius: 16px; min-width: 0; }
.wg-pv-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.wg-pv-h .wg-card-t { margin: 0 auto 0 0; }
[dir="rtl"] .wg-pv-h .wg-card-t { margin: 0 0 0 auto; }
.wg-pv-h .ws-seg button { min-height: 28px; padding: 0 9px; font-size: 12.5px; }

/* the "screen": a desktop page (1200 x 760) or a phone (375 x 740) drawn smaller with a CSS scale */
.wg-screen {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-bg-soft);
}
.wg-screen[data-device="phone"] {
    width: 300px;
    max-width: 100%;
    margin: 0 auto;
    border-width: 8px;
    border-color: #0b1120;
    border-radius: 28px;
}
.wg-frame {
    position: absolute;
    top: 0;
    left: 0;
    border: 0;
    transform-origin: 0 0;
    background: #fff;
}
.wg-pv-note { margin-top: 10px; }

@media (max-width: 1080px) {
    .wg-layout { grid-template-columns: minmax(0, 1fr); }
    .wg-preview { position: static; order: -1; }
}

@media (max-width: 640px) {
    .wg-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .wg-row-top > .wg-label { padding-top: 0; }
    .wg-pair { grid-template-columns: minmax(0, 1fr); }
    .wg-rule { grid-template-columns: minmax(0, 1fr) auto; }
    .wg-rule select { grid-column: 1 / -1; }
    .wg-save { flex-wrap: wrap; }
    .wg-save-t { flex-basis: 100%; }
}
