/* ===================================================================
   The dialogs of the WEBSITES select (scripts/sitedialogs.js): "Add website" and "Websites". Glass, light + dark, RTL-safe.
   =================================================================== */

.sd-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 12px;
    background: rgba(15, 23, 42, .38);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: sd-fade .15s ease;
}

.sd-dialog {
    display: flex;
    flex-direction: column;
    width: min(460px, 100%);
    max-height: min(680px, calc(100dvh - 24px));
    overflow: hidden;
    border: 1px solid var(--glass-border, var(--color-border));
    border-radius: 18px;
    background: var(--glass-pop, color-mix(in srgb, var(--color-bg) 95%, transparent));
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    backdrop-filter: blur(22px) saturate(1.5);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
    color: var(--color-text);
    font-family: var(--font-sans);
    animation: sd-pop .18s ease;
}

.sd-dialog.sd-wide {
    width: min(640px, 100%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .sd-dialog { background: var(--color-bg); }
}

@keyframes sd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sd-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .sd-backdrop, .sd-dialog { animation: none; }
}

.sd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px 20px;
    border-bottom: 1px solid var(--color-border-soft);
}

.sd-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.sd-x {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: var(--color-text-soft);
}

.sd-x:hover {
    background: color-mix(in srgb, var(--color-text) 8%, transparent);
}

.sd-x .material-symbols-outlined { font-size: 22px; }

.sd-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px 18px;
    overflow-y: auto;
}

.sd-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sd-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sd-field label {
    font-size: 13px;
    font-weight: 700;
}

.sd-field input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-bg) 70%, transparent);
    color: var(--color-text);
    font: inherit;
    font-size: 14.5px;
}

.sd-field input:disabled { opacity: .55; cursor: not-allowed; }   /* (e.g. a plan with no room: the note above says why) */

.sd-field input:focus {
    outline: 0;
    border-color: var(--color-green);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-green) 20%, transparent);
}

.sd-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--color-text-soft);
}

.sd-error {
    margin: 0;
    padding: 8px 11px;
    border-radius: 9px;
    background: color-mix(in srgb, #ef4444 13%, transparent);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
}

:root[data-theme="dark"] .sd-error { color: #fca5a5; }

.sd-error[hidden] { display: none; }

/* a full plan: the way out, right after the words */
.sd-upgrade {
    color: inherit;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.sd-upgrade:hover { text-decoration-thickness: 2px; }

.sd-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 11px;
    border-radius: 9px;
    background: color-mix(in srgb, #f59e0b 16%, transparent);
    font-size: 12.5px;
    font-weight: 600;
}

.sd-note .material-symbols-outlined { font-size: 18px; }

.sd-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.sd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    transition: background .15s, filter .15s;
}

.sd-btn:disabled { opacity: .6; cursor: default; }

.sd-btn-primary {
    background: var(--color-green);
    color: var(--color-green-ink);
}

.sd-btn-primary:hover:not(:disabled) { filter: brightness(.95); }

.sd-btn-text { color: var(--color-text-soft); }
.sd-btn-text:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

.sd-btn-soft {
    background: color-mix(in srgb, var(--color-green) 14%, transparent);
    color: var(--color-green-dark);
}

:root[data-theme="dark"] .sd-btn-soft { color: var(--color-green); }

.sd-btn-soft:hover { background: color-mix(in srgb, var(--color-green) 24%, transparent); }

.sd-btn .material-symbols-outlined { font-size: 18px; }

.sd-small {
    min-height: 32px;
    padding: 0 11px;
    font-size: 12.5px;
}

.sd-snippet {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.sd-sub {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.sd-code {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-text) 5%, transparent);
    color: var(--color-text);
    font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    resize: none;
    direction: ltr;
    text-align: left;
}

/* ----- the list ----- */

.sd-list {
    display: flex;
    flex-direction: column;
}

.sd-row {
    border-bottom: 1px solid var(--color-border-soft);
}

.sd-row:last-child { border-bottom: 0; }

.sd-row-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 0;
}

.sd-row-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.sd-row-name {
    overflow: hidden;
    font-size: 14.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-row-sub {
    overflow: hidden;
    font-size: 12px;
    color: var(--color-text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-badge {
    --size: 32px;
    display: grid;
    place-items: center;
    flex: none;
    width: var(--size);
    height: var(--size);
    border-radius: 9px;
    overflow: hidden;
}

.sd-badge.has-img { background: #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, .1); }
.sd-badge img { width: 100%; height: 100%; padding: 3px; object-fit: contain; }

.sd-badge.is-initial {
    background: var(--c);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.sd-swatch {
    flex: none;
    width: 30px;
    height: 30px;
    border: 3px solid color-mix(in srgb, var(--c) 28%, transparent);
    border-radius: 50%;
    background: var(--c);
    background-clip: padding-box;
    transition: transform .12s;
}

.sd-swatch:hover:not([aria-disabled="true"]) { transform: scale(1.1); }
.sd-swatch[aria-disabled="true"] { cursor: not-allowed; opacity: .75; }

.sd-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 4px 0 14px 44px;
}

[dir="rtl"] .sd-palette { padding: 4px 44px 14px 0; }

.sd-palette[hidden] { display: none; }

.sd-dot {
    width: 26px;
    height: 26px;
    border: 3px solid transparent;
    border-radius: 50%;
    background: var(--c);
    background-clip: padding-box;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .14);
}

.sd-dot[aria-pressed="true"] {
    border-color: var(--color-bg);
    box-shadow: 0 0 0 2px var(--c);
}

.sd-dot:hover { transform: scale(1.12); }

.sd-empty {
    padding: 18px 0;
    color: var(--color-text-muted);
    text-align: center;
}

@media (max-width: 520px) {
    .sd-row-main { flex-wrap: wrap; }
    .sd-row-info { flex-basis: calc(100% - 100px); }
    .sd-row-main .sd-btn { margin-inline-start: 44px; }
}

/* the short name of a website, under its name */
.sd-short {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.sd-short input {
    flex: 1 1 120px;
    min-width: 0;
    max-width: 200px;
    height: 26px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    font-size: 13px;
}

.sd-short input:focus {
    outline: 2px solid color-mix(in srgb, var(--color-green) 55%, transparent);
    border-color: var(--color-green);
}

.sd-short input:disabled {
    opacity: .6;
}
