/* Janela de ajuste de imagem (foto de perfil e logo). */
:root {
    --bs-editor-viewport: 320px;
}

.bs-profile-editor-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(2, 6, 23, 0.84);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.bs-profile-editor-shell {
    position: relative;
    width: min(100%, 920px);
    max-height: 100%;
}

.bs-profile-editor-modal {
    width: 100%;
    max-height: 100%;
    overflow: auto;
    border-radius: 24px;
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.16), transparent 40%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
    border: 1px solid rgba(51, 65, 85, 0.9);
    box-shadow: 0 30px 70px rgba(2, 6, 23, 0.55);
    color: #e2e8f0;
}

.bs-profile-editor-close {
    position: absolute;
    top: -12px;
    right: -12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 1px solid rgba(71, 85, 105, 0.9);
    background: #1e293b;
    color: #e2e8f0;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.5);
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.bs-profile-editor-close:hover {
    background: #334155;
    transform: translateY(-1px);
}

.bs-profile-editor-topbar {
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 24px 24px 0 0;
}

.bs-profile-editor-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.5rem;
    padding: 1.5rem;
}

.bs-profile-editor-stage {
    min-height: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border-radius: 24px;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.92));
}

.bs-profile-editor-viewport {
    position: relative;
    width: var(--bs-editor-viewport);
    height: var(--bs-editor-viewport);
    border-radius: 36px;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.85));
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.45);
    touch-action: none;
    user-select: none;
    cursor: grab;
}

.bs-profile-editor-viewport:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 3px;
}

.bs-profile-editor-viewport.is-dragging {
    cursor: grabbing;
}

.bs-profile-editor-viewport.logo-mode {
    border-radius: 26px;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, 0.10) 25%, transparent 25%, transparent 75%, rgba(148, 163, 184, 0.10) 75%, rgba(148, 163, 184, 0.10)),
        linear-gradient(45deg, rgba(148, 163, 184, 0.10) 25%, transparent 25%, transparent 75%, rgba(148, 163, 184, 0.10) 75%, rgba(148, 163, 184, 0.10));
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
}

.bs-profile-editor-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    max-width: none;
    pointer-events: none;
}

.bs-profile-editor-image.is-spinning {
    transition: transform 0.36s cubic-bezier(0.34, 1.28, 0.5, 1);
}

.bs-profile-editor-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 9999px rgba(2, 6, 23, 0.42);
}

.bs-profile-editor-mask::before {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 9999px;
    box-shadow:
        0 0 0 9999px rgba(2, 6, 23, 0.5),
        inset 0 0 0 1px rgba(147, 197, 253, 0.12);
}

.bs-profile-editor-mask::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 9999px;
    border: 2px solid rgba(147, 197, 253, 0.92);
    background:
        linear-gradient(rgba(147, 197, 253, 0.18), rgba(147, 197, 253, 0.18)) center/1px 100% no-repeat,
        linear-gradient(rgba(147, 197, 253, 0.18), rgba(147, 197, 253, 0.18)) center/100% 1px no-repeat,
        radial-gradient(circle at center, transparent 42%, rgba(147, 197, 253, 0.12) 42.3%, transparent 43%);
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.10);
}

.bs-profile-editor-viewport.logo-mode .bs-profile-editor-mask::before {
    inset: 16px;
    border-radius: 24px;
    box-shadow:
        0 0 0 9999px rgba(2, 6, 23, 0.30),
        inset 0 0 0 1px rgba(147, 197, 253, 0.14);
}

.bs-profile-editor-viewport.logo-mode .bs-profile-editor-mask::after {
    inset: 16px;
    border-radius: 24px;
    background:
        linear-gradient(rgba(147, 197, 253, 0.16), rgba(147, 197, 253, 0.16)) center/1px 100% no-repeat,
        linear-gradient(rgba(147, 197, 253, 0.16), rgba(147, 197, 253, 0.16)) center/100% 1px no-repeat;
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.08);
}

.bs-profile-editor-degree {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(51, 65, 85, 0.9);
    background: rgba(2, 6, 23, 0.78);
    color: #bfdbfe;
    font-size: 0.75rem;
    font-weight: 800;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bs-profile-editor-degree.is-visible {
    opacity: 1;
}

.bs-profile-editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bs-profile-editor-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: #f8fafc;
}

.bs-profile-editor-subtitle {
    font-size: 0.9rem;
    line-height: 1.45;
    color: #94a3b8;
}

.bs-profile-editor-card {
    border-radius: 20px;
    border: 1px solid rgba(51, 65, 85, 0.85);
    background: rgba(15, 23, 42, 0.7);
    padding: 1rem;
}

.bs-profile-editor-label {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bs-profile-editor-slider {
    width: 100%;
    accent-color: #3b82f6;
}

.bs-profile-editor-remove-bg {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
}

.bs-profile-editor-remove-bg input {
    margin-top: 0.15rem;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #3b82f6;
    flex-shrink: 0;
}

.bs-profile-editor-remove-bg .bs-profile-editor-label {
    margin-bottom: 0.2rem;
}

.bs-profile-editor-remove-bg-hint {
    display: block;
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0;
}

.bs-profile-editor-rotate-row {
    display: flex;
    gap: 0.75rem;
}

.bs-profile-editor-mini-button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    font-weight: 700;
    font-size: 0.85rem;
    /* Rotulo de botao nao quebra em duas linhas: regra da casa. */
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.bs-profile-editor-mini-button svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.bs-profile-editor-mini-button:hover {
    transform: translateY(-1px);
    background: rgba(51, 65, 85, 0.95);
    border-color: rgba(59, 130, 246, 0.5);
}

.bs-profile-editor-meta {
    display: grid;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.bs-profile-editor-meta strong {
    color: #f8fafc;
}

.bs-profile-editor-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: auto;
}

.bs-profile-editor-button {
    border: none;
    border-radius: 14px;
    padding: 0.8rem 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background-color 0.18s ease;
}

.bs-profile-editor-button:hover {
    transform: translateY(-1px);
}

.bs-profile-editor-button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.bs-profile-editor-button.secondary {
    background: rgba(51, 65, 85, 0.9);
    color: #e2e8f0;
}

.bs-profile-editor-button.primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.bs-profile-editor-modal :focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

@media (max-width: 820px) {
    .bs-profile-editor-content {
        grid-template-columns: 1fr;
    }

    .bs-profile-editor-stage {
        min-height: auto;
    }

    .bs-profile-editor-viewport {
        width: min(78vw, var(--bs-editor-viewport));
        height: min(78vw, var(--bs-editor-viewport));
    }
}

/* Fica em 640: a janela de ajuste cobre a tela inteira por cima de tudo, e o menu de 288px não
   tira largura dela. O limite aqui é o do aparelho, não o do conteúdo atrás do menu. */
@media (max-width: 640px) {
    .bs-profile-editor-backdrop {
        padding: 0;
    }

    .bs-profile-editor-shell {
        width: 100%;
        height: 100%;
        max-height: none;
    }

    .bs-profile-editor-modal {
        height: 100%;
        max-height: none;
        border: none;
        border-radius: 0;
    }

    .bs-profile-editor-topbar {
        border-radius: 0;
    }

    .bs-profile-editor-close {
        display: none;
    }

    .bs-profile-editor-actions {
        margin-top: 0.5rem;
    }

    .bs-profile-editor-actions .bs-profile-editor-button {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bs-profile-editor-image.is-spinning {
        transition: none;
    }
}
