/* space-create-dialog.css — Space creation wizard */
/* Prefix: ch-space-create- */

.ch-space-create-dialog {
    width: 560px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    animation: ch-space-create-in 0.15s ease-out;
}

.ch-space-create-dialog--open {
    opacity: 1;
    transform: translateY(0);
}

@keyframes ch-space-create-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Section ── */
.ch-space-create-section {
    padding: 20px 24px 12px;
}

.ch-space-create-section + .ch-space-create-section {
    border-top: 1px solid var(--border, #2e2e2e);
    padding-top: 16px;
}

.ch-space-create-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #666);
    margin-bottom: 12px;
}

/* ── Identity row ── */
.ch-space-create-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.ch-space-create-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.12s, box-shadow 0.12s;
}

.ch-space-create-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px var(--bg-surface, #242424), 0 0 0 5px var(--accent, #00B4EA);
}

.ch-space-create-name {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border, #2e2e2e);
    color: var(--text-primary, #e5e5e5);
    font-size: 18px;
    font-weight: 500;
    padding: 8px 0;
    outline: none;
    box-sizing: border-box;
}

.ch-space-create-name:focus {
    border-bottom-color: var(--accent, #00B4EA);
}

.ch-space-create-name::placeholder {
    color: var(--text-muted, #666);
    font-weight: 400;
}

/* ── Description ── */
.ch-space-create-desc-wrap {
    margin-top: 4px;
    padding-left: 52px; /* align with name input (40px icon + 12px gap) */
}

.ch-space-create-desc-toggle {
    font-size: 13px;
    color: var(--text-muted, #666);
    text-decoration: none;
    cursor: pointer;
}

.ch-space-create-desc-toggle:hover {
    color: var(--accent, #00B4EA);
}

.ch-space-create-desc {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border, #2e2e2e);
    border-radius: 6px;
    color: var(--text-primary, #e5e5e5);
    font-size: 13px;
    font-family: inherit;
    padding: 8px 10px;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
}

.ch-space-create-desc:focus {
    border-color: var(--accent, #00B4EA);
}

.ch-space-create-desc::placeholder {
    color: var(--text-muted, #666);
}

/* ── Cloud permissions ── */
.ch-space-create-cloud {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding-left: 52px;
}

.ch-space-create-select {
    background: var(--bg-surface, #242424);
    border: 1px solid var(--border, #2e2e2e);
    border-radius: 6px;
    color: var(--text-primary, #e5e5e5);
    font-size: 13px;
    padding: 6px 10px;
    outline: none;
    cursor: pointer;
}

.ch-space-create-select:hover,
.ch-space-create-select:focus {
    border-color: var(--accent, #00B4EA);
}

.ch-space-create-toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    user-select: none;
}

.ch-space-create-toggle {
    accent-color: var(--accent, #00B4EA);
}

/* ── Template grid ── */
.ch-space-create-templates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ch-space-create-tpl-card {
    border: 1px solid var(--border, #2e2e2e);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.ch-space-create-tpl-card:hover {
    background: var(--bg-hover, #2a2a2a);
}

.ch-space-create-tpl-card--selected {
    border-color: var(--accent, #00B4EA);
    background: rgba(0, 180, 234, 0.06);
}

.ch-space-create-tpl-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #e5e5e5);
    margin-bottom: 2px;
}

.ch-space-create-tpl-desc {
    font-size: 11px;
    color: var(--text-muted, #666);
    margin-bottom: 6px;
}

.ch-space-create-tpl-views {
    font-size: 10px;
    color: var(--text-secondary, #aaa);
    margin-bottom: 6px;
}

/* ── Status chain (dots + arrows) ── */
.ch-space-create-tpl-chain {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.ch-space-create-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ch-space-create-status-arrow {
    font-size: 9px;
    color: var(--text-muted, #666);
}

.ch-space-create-status-name {
    font-size: 11px;
    color: var(--text-secondary, #aaa);
    margin-right: 2px;
}

/* ── Customize defaults ── */
.ch-space-create-customize-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-muted, #666);
    font-size: 12px;
    cursor: pointer;
    padding: 8px 0;
    margin-top: 4px;
}

.ch-space-create-customize-btn::before {
    content: '\25B6';
    font-size: 8px;
    transition: transform 0.15s;
}

.ch-space-create-customize-btn--open::before {
    transform: rotate(90deg);
}

.ch-space-create-customize-btn:hover {
    color: var(--accent, #00B4EA);
}

.ch-space-create-customize {
    /* container for expandable rows */
}

.ch-space-create-custom-row {
    padding: 8px 0;
    border-top: 1px solid var(--border, #2e2e2e);
}

.ch-space-create-custom-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #666);
    margin-bottom: 6px;
}

/* Pill-style toggle chips instead of native checkboxes */
.ch-space-create-custom-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.ch-space-create-check-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 12px;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid var(--border, #2e2e2e);
    background: var(--bg-surface, #242424);
    transition: all 0.12s ease;
}

.ch-space-create-check-label:hover {
    border-color: var(--text-muted, #555);
    color: var(--text-primary, #e5e5e5);
}

/* Hide the native checkbox */
.ch-space-create-check-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Checked = filled pill */
.ch-space-create-check--on {
    background: color-mix(in srgb, var(--accent, #00B4EA) 15%, transparent);
    border-color: var(--accent, #00B4EA);
    color: var(--accent, #00B4EA);
}

.ch-space-create-custom-row {
    padding: 10px 0;
    border-top: 1px solid var(--border, #2e2e2e);
    margin: 0 4px;
}

/* ── Color picker popover ── */
.ch-space-create-color-pop {
    display: grid;
    grid-template-columns: repeat(5, 28px);
    gap: 4px;
    padding: 8px;
    background: var(--bg-surface, #242424);
    border: 1px solid var(--border, #2e2e2e);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.ch-space-create-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s;
}

.ch-space-create-swatch:hover {
    transform: scale(1.15);
}

.ch-space-create-swatch--active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent, #00B4EA);
}

/* ── Footer ── */
.ch-space-create-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--border, #2e2e2e);
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .ch-space-create-dialog {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .ch-space-create-templates {
        grid-template-columns: 1fr;
    }
    .ch-space-create-section {
        padding: 16px;
    }
    .ch-space-create-footer {
        padding: 12px 16px;
    }
    .ch-space-create-cloud {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-left: 0;
    }
    .ch-space-create-desc-wrap {
        padding-left: 0;
    }
}

/* ── Light theme overrides ── */
@media (prefers-color-scheme: light) {
    .ch-space-create-color-pop {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }

    .ch-space-create-swatch--active {
        border-color: #333;
    }
}
