/* Free subdomains — button + modal on the Servers page. Uses dashboard theme vars. */

/* header icon button (matches #shop-btn / #resources-btn) */
/* Robust fix for the action-button row: the .button-container had NO css (plain inline flow),
   so an <svg> icon button never lined up with the <img> ones. Flexbox + center aligns every
   action button (icons + Create) on one axis regardless of box quirks. Only loaded on the
   servers page (this stylesheet isn't linked elsewhere), so it can't affect other pages. */
.button-container {
    display: flex;
    align-items: center;
}

/* Match #shop-btn / #resources-btn exactly (same box) so it sits inline with the other
   action icons; vertical-align:middle on the SVG removes the inline-SVG baseline gap. */
#subdomain-btn {
    position: relative;
    /* refresh-btn already supplies a 10px margin-right on its side, so ml:0 here; add mr:10px
       so we don't collide with the (margin-less) Create button. Result: even 10px gaps. */
    margin-left: 0;
    margin-right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    vertical-align: middle;
    color: var(--text-light, #fff);
    transition: color .3s;
}

#subdomain-btn svg {
    /* Identical to `#shop-btn img` (inline, baseline, 22px) so the button gets the same line-box
       descender as the other icon buttons and the icon lands at the same height under flex-center. */
    width: 22px;
    height: 22px;
}

#subdomain-btn:hover {
    color: var(--primary-color, #38b1ed);
}

/* modal overlay */
.sd-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 3000;
    padding: 40px 16px;
    overflow-y: auto;
}

.sd-modal.open {
    display: flex;
}

.sd-modal-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: var(--secondary-bg, #1c2039);
    border: 1px solid var(--border-color, rgba(255, 255, 255, .12));
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    padding: 26px;
}

.sd-modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 26px;
    line-height: 1;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    transition: color .2s;
}

.sd-modal-close:hover {
    color: var(--text-light, #fff);
}

.sd-title {
    color: var(--text-light, #fff);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.sd-subtitle {
    color: var(--text-secondary, #c7cbe0);
    font-size: .9rem;
    margin-bottom: 20px;
    line-height: 1.45;
}

.sd-card {
    background: var(--tertiary-bg, rgba(255, 255, 255, .05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, .12));
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
}

.sd-card h2 {
    color: var(--text-light, #fff);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.sd-label {
    display: block;
    color: var(--text-secondary, #c7cbe0);
    font-size: .8rem;
    font-weight: 600;
    margin: 14px 0 6px;
}

.sd-input,
.sd-select {
    width: 100%;
    padding: 11px 13px;
    font-size: .95rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, .15));
    border-radius: 6px;
    background-color: var(--dark-bg, #15182d);
    color: var(--text-light, #fff);
    transition: border-color .2s, box-shadow .2s;
}

.sd-input:focus,
.sd-select:focus {
    border-color: var(--primary-color, #38b1ed);
    outline: none;
    box-shadow: 0 0 0 2px rgba(56, 177, 237, .25);
}

.sd-fqdn-row {
    display: flex;
    align-items: stretch;
}

.sd-fqdn-row .sd-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.sd-suffix {
    display: flex;
    align-items: center;
    padding: 0 13px;
    background: var(--tertiary-bg, rgba(255, 255, 255, .08));
    border: 1px solid var(--border-color, rgba(255, 255, 255, .15));
    border-left: none;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    color: var(--text-muted, #9ca3af);
    font-size: .95rem;
    white-space: nowrap;
}

.sd-hint {
    font-size: .82rem;
    margin: 7px 0 0;
    min-height: 18px;
}

.sd-hint.ok { color: #4ade80; }
.sd-hint.bad { color: #f87171; }
.sd-hint.neutral { color: var(--text-muted, #9ca3af); }

.sd-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    color: var(--text-secondary, #c7cbe0);
    font-size: .88rem;
}

.sd-checkbox input { width: auto; }

.sd-btn {
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--primary-color, #38b1ed);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: filter .2s;
    margin-top: 18px;
    width: 100%;
}

.sd-btn:hover:not(:disabled) { filter: brightness(1.08); }
.sd-btn:disabled { opacity: .5; cursor: not-allowed; }

/* list */
.sd-list {
    width: 100%;
    border-collapse: collapse;
}

.sd-list th,
.sd-list td {
    text-align: left;
    padding: 11px 8px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, .1));
    color: var(--text-light, #fff);
    font-size: .88rem;
    vertical-align: middle;
}

.sd-list th {
    color: var(--text-muted, #9ca3af);
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.sd-fqdn-cell {
    font-family: 'Courier New', monospace;
    color: var(--primary-color, #38b1ed);
    word-break: break-all;
}

.sd-del-btn {
    background: transparent;
    border: 1px solid rgba(248, 113, 113, .4);
    color: #f87171;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: .82rem;
    cursor: pointer;
    transition: background .2s;
}

.sd-del-btn:hover { background: rgba(248, 113, 113, .12); }

.sd-empty {
    color: var(--text-muted, #9ca3af);
    font-size: .9rem;
    padding: 18px 0;
    text-align: center;
}

.sd-disabled-banner {
    background: rgba(248, 113, 113, .08);
    border: 1px solid rgba(248, 113, 113, .3);
    color: #fca5a5;
    padding: 16px;
    border-radius: 8px;
    font-size: .92rem;
}

/* toast */
.sd-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: rgba(30, 150, 70, .95);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    font-size: .9rem;
    z-index: 3200;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease;
}

.sd-toast.show { opacity: 1; transform: translateY(0); }
.sd-toast.error { background: rgba(200, 40, 40, .95); }

/* ── ephemeral "new feature" spotlight on the header button ── */
.sd-new-badge {
    position: absolute;
    top: -7px;
    right: -9px;
    background: #f43f5e;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.4;
    padding: 1px 5px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    pointer-events: none;
}

@keyframes sd-pulse-kf {
    0% { box-shadow: 0 0 0 0 rgba(56, 177, 237, .55); }
    70% { box-shadow: 0 0 0 11px rgba(56, 177, 237, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 177, 237, 0); }
}

#subdomain-btn.sd-pulse {
    color: var(--primary-color, #38b1ed);
    border-radius: 8px;
    animation: sd-pulse-kf 1.8s ease-out infinite;
}

.sd-callout {
    position: fixed;
    z-index: 3300;
    max-width: 250px;
    background: var(--primary-color, #38b1ed);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: .85rem;
    line-height: 1.35;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .25s, transform .25s;
}

.sd-callout.show {
    opacity: 1;
    transform: translateY(0);
}

/* ── provisioning progress (proxied HTTPS subdomains) ── */
.sd-progress {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--tertiary-bg, rgba(255, 255, 255, .05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, .12));
    font-size: .85rem;
    color: var(--text-secondary, #c7cbe0);
}

.sd-progress.ok { border-color: rgba(74, 222, 128, .4); color: #86efac; }
.sd-progress.bad { border-color: rgba(248, 113, 113, .4); color: #fca5a5; }
.sd-progress a { color: var(--primary-color, #38b1ed); word-break: break-all; }

.sd-prog-bar {
    height: 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .1);
    overflow: hidden;
    margin-bottom: 8px;
}

.sd-prog-bar span {
    display: block;
    height: 100%;
    background: var(--primary-color, #38b1ed);
    transition: width .4s ease;
}

.sd-prog-text {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light, #fff);
}

.sd-prog-sub {
    font-family: 'Courier New', monospace;
    color: var(--text-muted, #9ca3af);
    margin-top: 4px;
    font-size: .8rem;
}

.sd-spin {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, .25);
    border-top-color: var(--primary-color, #38b1ed);
    border-radius: 50%;
    display: inline-block;
    animation: sd-spin-kf .8s linear infinite;
}

@keyframes sd-spin-kf { to { transform: rotate(360deg); } }

.sd-retry-btn {
    margin-left: 8px;
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: .8rem;
    cursor: pointer;
}

.sd-status-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: .68rem;
    font-weight: 600;
    background: rgba(56, 177, 237, .15);
    color: var(--primary-color, #38b1ed);
    vertical-align: middle;
    font-family: 'Poppins', sans-serif;
}

.sd-status-tag.bad { background: rgba(248, 113, 113, .15); color: #fca5a5; }
