/* MoonLight — unified create / search modals (liquid glass mould) */

.lg-create-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 8, 20, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: lgCreateModalFadeIn 0.22s ease;
}

@keyframes lgCreateModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lg-create-modal-content {
    width: min(520px, 94vw);
    max-height: min(86vh, 720px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
    animation: lgCreateModalSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes lgCreateModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lg-create-modal-content--wide {
    width: min(560px, 94vw);
}

.lg-create-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(44, 146, 242, 0.08) 0%, transparent 100%);
}

.lg-create-modal-header-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.lg-create-modal-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.lg-create-modal-icon--chat {
    background: linear-gradient(145deg, rgba(44, 146, 242, 0.55), rgba(99, 102, 241, 0.45));
}

.lg-create-modal-icon--channel {
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.5), rgba(44, 146, 242, 0.45));
}

.lg-create-modal-icon--search {
    background: linear-gradient(145deg, rgba(168, 85, 247, 0.45), rgba(44, 146, 242, 0.4));
}

.lg-create-modal-icon--apps {
    background: linear-gradient(145deg, rgba(192, 132, 252, 0.5), rgba(99, 102, 241, 0.45));
}

.lg-create-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #f8fafc;
    line-height: 1.25;
}

.lg-create-modal-header p {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: rgba(148, 163, 184, 0.95);
}

.lg-create-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.15s;
}

.lg-create-modal-close:hover {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.28);
    color: #fca5a5;
    transform: scale(1.04);
}

.lg-create-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 16px 20px 20px;
    -webkit-overflow-scrolling: touch;
}

.lg-create-modal-body--form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.lg-create-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.lg-create-search {
    position: relative;
    margin-bottom: 14px;
}

.lg-create-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(148, 163, 184, 0.85);
    font-size: 14px;
    pointer-events: none;
}

.lg-create-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px 12px 42px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    font-size: 14px;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.lg-create-search input::placeholder {
    color: rgba(148, 163, 184, 0.75);
}

.lg-create-search input:focus {
    outline: none;
    border-color: rgba(44, 146, 242, 0.55);
    box-shadow: 0 0 0 3px rgba(44, 146, 242, 0.12);
    background: rgba(255, 255, 255, 0.07);
}

.lg-create-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    margin-bottom: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.lg-create-tab {
    flex: 1;
    padding: 9px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.lg-create-tab:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
}

.lg-create-tab.active {
    color: #fff;
    background: linear-gradient(145deg, rgba(44, 146, 242, 0.35), rgba(99, 102, 241, 0.28));
    box-shadow: 0 4px 14px rgba(44, 146, 242, 0.18);
}

.lg-create-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 120px;
}

.lg-create-empty,
.lg-create-hint,
.lg-create-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.lg-create-empty i,
.lg-create-hint i,
.lg-create-loading i {
    font-size: 22px;
    color: rgba(44, 146, 242, 0.75);
}

.lg-create-user-item,
.lg-find-app-item {
    width: 100%;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.18s;
}

.lg-create-user-item:hover,
.lg-find-app-item:hover {
    background: rgba(44, 146, 242, 0.1);
    border-color: rgba(44, 146, 242, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.lg-find-app-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lg-find-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
    overflow: hidden;
}

.lg-find-app-info {
    min-width: 0;
    flex: 1;
}

.lg-find-app-name {
    font-weight: 600;
    font-size: 14px;
    color: #f1f5f9;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lg-find-app-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lg-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.lg-type-pill--app {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
}

.lg-type-pill--bot {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

/* Form sections inside create modals */
.lg-form-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lg-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
}

.lg-form-label i {
    color: rgba(44, 146, 242, 0.85);
    font-size: 12px;
    width: 16px;
    text-align: center;
}

.lg-form-hint {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.4;
}

.lg-avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.lg-avatar-preview {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(44, 146, 242, 0.35), rgba(168, 85, 247, 0.28));
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.lg-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lg-btn-ghost,
.lg-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.18s, border-color 0.18s, transform 0.15s, box-shadow 0.18s;
}

.lg-btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.lg-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.09);
}

.lg-btn-primary {
    background: linear-gradient(145deg, rgba(44, 146, 242, 0.55), rgba(59, 130, 246, 0.45));
    border-color: rgba(96, 165, 250, 0.35);
    color: #fff;
    box-shadow: 0 6px 18px rgba(44, 146, 242, 0.22);
}

.lg-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(44, 146, 242, 0.28);
}

.lg-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.lg-create-modal-body input[type="text"],
.lg-create-modal-body textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.lg-create-modal-body input:focus,
.lg-create-modal-body textarea:focus {
    outline: none;
    border-color: rgba(44, 146, 242, 0.55);
    box-shadow: 0 0 0 3px rgba(44, 146, 242, 0.12);
}

.lg-member-pick-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.12);
}

/* Channel visibility — redesigned tiles */
.channel-visibility-options.lg-visibility-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.channel-visibility-options.lg-visibility-grid--stack {
    grid-template-columns: 1fr;
}

.channel-visibility-option.lg-visibility-tile {
    position: relative;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.channel-visibility-option.lg-visibility-tile input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.lg-visibility-tile-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.channel-visibility-option.lg-visibility-tile:hover .lg-visibility-tile-inner {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.channel-visibility-option.lg-visibility-tile:has(input:checked) .lg-visibility-tile-inner {
    border-color: rgba(44, 146, 242, 0.55);
    background: linear-gradient(160deg, rgba(44, 146, 242, 0.14), rgba(99, 102, 241, 0.08));
    box-shadow: 0 0 0 1px rgba(44, 146, 242, 0.2), 0 10px 24px rgba(44, 146, 242, 0.1);
}

.lg-visibility-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #fff;
}

.lg-visibility-icon--public {
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.45), rgba(44, 146, 242, 0.35));
}

.lg-visibility-icon--private {
    background: linear-gradient(145deg, rgba(148, 163, 184, 0.35), rgba(100, 116, 139, 0.4));
}

.lg-visibility-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    background: rgba(44, 146, 242, 0.9);
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.18s, transform 0.18s;
}

.channel-visibility-option.lg-visibility-tile:has(input:checked) .lg-visibility-check {
    opacity: 1;
    transform: scale(1);
}

.channel-visibility-options.lg-visibility-grid--compact .lg-visibility-tile-inner {
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    gap: 12px;
}

.channel-visibility-options.lg-visibility-grid--compact .channel-visibility-copy small {
    display: none;
}

.channel-visibility-options.lg-visibility-grid--compact .lg-visibility-check {
    position: static;
    margin-left: auto;
    opacity: 0;
}

.channel-visibility-options.lg-visibility-grid--compact .channel-visibility-option.lg-visibility-tile:has(input:checked) .lg-visibility-check {
    opacity: 1;
}

/* Channel search cards inside modal */
.lg-create-modal .channel-search-card {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    margin: 0;
}

.lg-create-modal .channel-search-card:hover {
    border-color: rgba(44, 146, 242, 0.28);
    background: rgba(44, 146, 242, 0.08);
}

.lg-create-modal .channel-search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: none;
    overflow: visible;
    padding: 0;
}

.lg-create-modal .subscribe-channel-btn {
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 520px) {
    .channel-visibility-options.lg-visibility-grid {
        grid-template-columns: 1fr;
    }

    .lg-create-modal {
        padding: 10px;
        align-items: flex-end;
    }

    .lg-create-modal-content {
        width: 100%;
        max-height: 92vh;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
}

html[data-theme-resolved="light"] .lg-create-modal {
    background: rgba(15, 23, 42, 0.35);
}

html[data-theme-resolved="light"] .lg-create-modal-header h3,
html[data-theme-resolved="light"] .lg-find-app-name {
    color: #0f172a;
}

html[data-theme-resolved="light"] .lg-create-user-item,
html[data-theme-resolved="light"] .lg-find-app-item {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme-resolved="light"] .lg-visibility-tile-inner {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}
